Files
mckernel/test/issues/1473/xpmem_attach02.sh.in
Masamichi Takagi a5fcc91656 xpmem: fix mapping of attachment and segment
* Mapping attached part of segment is done at attach time instead of
  make time to work with runtimes (e.g. OpenMPI) xpmem_make-ing the
  entire user-space
* Mapping attached part of segment at attach time can be turned off by
  specifying xpmem_remote_on_demand in kernel argument
* Mapping attachment chooses appropriate page-sizes, i.e., largest
  allowed by memory range and segment page boundary

Fixes: a8696d8 "xpmem: Support large page attachment"
Change-Id: I44663865204036520e5f62fe22b9134ee4629f9b
2020-06-15 10:11:29 +09: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