summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2008-09-30 16:12:11 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2008-09-30 16:12:11 -0300
commit26311c48a8a2d544472c8a2ff97373935b1768a5 (patch)
tree1d07776416c62df7d7bb53f594bc1f75f9473398
parentf75c8d50e0a4d0e1ca5e1f679c118c76358fe996 (diff)
downloadtuna-26311c48a8a2d544472c8a2ff97373935b1768a5.tar.gz
testuna: Add per CPU socket tests
Include & isolate CPU sockets and move a thread to a socket Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-xtestuna25
1 files changed, 25 insertions, 0 deletions
diff --git a/testuna b/testuna
index 774911c..6b97e6c 100755
--- a/testuna
+++ b/testuna
@@ -28,6 +28,10 @@ get_nr_processors() {
echo $(grep -i "^processor.*: " /proc/cpuinfo | tail -1 | cut -d ':' -f 2)
}
+get_nr_cpu_sockets() {
+ echo $(grep "^physical id" /proc/cpuinfo | cut -d: -f2 | sort -u | wc -l)
+}
+
die() {
[ -z "$VERBOSE" ] && echo -n "$2: "
echo $1
@@ -174,6 +178,27 @@ AFFINITY=0x$(get_affinity 1)
die_if_not_equal $((AFFINITY & NEW_AFFINITY)) $NEW_AFFINITY "Moving init to just first and last processor"
+NR_CPU_SOCKETS=$(get_nr_cpu_sockets)
+if [ $NR_CPU_SOCKETS -ge 2 ]; then
+ CPU1_SIBLINGS=$(printf "%d" 0x$(cat /sys/devices/system/cpu/cpu1/topology/core_siblings | cut -d',' -f2))
+ CPU1_SOCKET=$(cat /sys/devices/system/cpu/cpu1/topology/physical_package_id)
+
+ tuna --sockets=$CPU1_SOCKET --isolate
+ AFFINITY=0x$(get_affinity 1)
+ die_if_not_zero $((AFFINITY & CPU1_SIBLINGS)) \
+ "Verifying isolation of socket $CPU1_SOCKET"
+
+ tuna --sockets=$CPU1_SOCKET --include
+ AFFINITY=0x$(get_affinity 1)
+ die_if_not_equal $((AFFINITY & CPU1_SIBLINGS)) $CPU1_SIBLINGS \
+ "Verifying inclusion of socket $CPU1_SOCKET"
+
+ tuna --sockets=$CPU1_SOCKET --isolate
+ tuna --sockets=$CPU1_SOCKET --thread 1 --move
+ AFFINITY=0x$(get_affinity 1)
+ die_if_not_equal $((AFFINITY & CPU1_SIBLINGS)) $CPU1_SIBLINGS "Moving init to CPU socket $CPU1_SOCKET"
+fi
+
taskset -p $INITIAL_INIT_AFFINITY 1 > /dev/null
rtctl --file $INITIAL reset