Files
mckernel/test/issues/1473/xpmem_attach02.sh.in
Yoshihisa Morizumi d2db639853 xpmem: support large page
1. try to use as large page as possible on attach
2. pre-map resident remote pages on attach

Change-Id: I5580682a4199e94085a9bad9ce3958a0f14cdcea
2021-03-03 05:07:49 +00:00

64 lines
1.9 KiB
Bash

#!/usr/bin/bash
declare -A addr=()
declare -A pgsize_kmsg=()
declare -A pgsize_expected=()
SCRIPT_PATH=$(readlink -m "${BASH_SOURCE[0]}")
SCRIPT_NAME="${SCRIPT_PATH##*/}"
# prepare recorddir
. @CMAKE_INSTALL_PREFIX@/bin/common.sh
recorddir=$WORKDIR/output/$SCRIPT_NAME
[[ ! -d $recorddir ]] && mkdir -p $recorddir
# define patch function
. @CMAKE_INSTALL_PREFIX@/bin/util.sh
patch_and_build large_page ihk_kmsg_size || exit 1
# boot patched McKernel
if [[ -e ${AUTOTEST_HOME}/bin/config.sh ]]; then
${AUTOTEST_HOME}/bin/boot.sh reboot
else
. @WITH_MCK_SRC@/test/common.sh
fi
sudo insmod @WITH_XPMEM@/lib/modules/`uname -r`/xpmem.ko
sudo chmod og+rw /dev/xpmem
for small_pgshift in $PGSHIFT_LIST; do
for large_pgshift in $PGSHIFT_LIST; do
if (( small_pgshift < large_pgshift )); then
echo "small_pgshift: $small_pgshift, large_pgshift: $large_pgshift"
log_file=$recorddir/${SCRIPT_NAME%.sh}-${small_pgshift}-${large_pgshift}.log
@WITH_MCK@/sbin/ihkosctl 0 clear_kmsg
@WITH_MCK@/bin/mcexec @CMAKE_INSTALL_PREFIX@/bin/xpmem_attach02 $small_pgshift $large_pgshift | tee $log_file
@WITH_MCK@/sbin/ihkosctl 0 kmsg >> $log_file
pgsize_expected[head]=$((1 << $small_pgshift))
pgsize_expected[middle]=$((1 << $large_pgshift))
pgsize_expected[tail]=$((1 << $small_pgshift))
for i in head middle tail; do
addr[$i]=$(grep "child.*${i}_addr" $log_file | awk '{ print $NF; }')
pgsize_kmsg[$i]=$(grep -o "xpmem_page_attach.*${addr[$i]}.*" $log_file | awk '{ print $NF; }')
[[ "${pgsize_kmsg[$i]}" == "" ]] && pgsize_kmsg[$i]=$PAGE_SIZE
echo "pgsize_kmsg[$i]: ${pgsize_kmsg[$i]}, pgsize_expected[$i]: ${pgsize_expected[$i]}"
if ((pgsize_kmsg[$i] == pgsize_expected[$i])); then
printf "[ OK ] "
else
printf "[ NG ] "
let ng++
fi
echo "page-size of attachment at ${addr[$i]}: ${pgsize_kmsg[$i]}, expected: ${pgsize_expected[$i]}"
done
fi
done
done
sudo rmmod xpmem.ko
exit $ng