]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
torture: Add --no-affinity parameter to kvm.sh
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 9 Oct 2024 18:02:50 +0000 (11:02 -0700)
committerFrederic Weisbecker <frederic@kernel.org>
Tue, 12 Nov 2024 22:04:24 +0000 (23:04 +0100)
In performance tests, it can be counter-productive to spread torture-test
guest OSes across sockets.  Plus the experimenter might have ideas about
what CPUs individual guest OSes are to run on.  This commit therefore
adds a --no-affinity parameter to kvm.sh to prevent it from running
taskset on its guest OSes.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
tools/testing/selftests/rcutorture/bin/kvm-test-1-run-batch.sh
tools/testing/selftests/rcutorture/bin/kvm.sh

index c3808c490d92dd0b044c2fab06f61492424c2826..f87046b702d88e6819bf6b2368b7d5b2a09b1d66 100755 (executable)
@@ -56,27 +56,30 @@ do
        echo > $i/kvm-test-1-run-qemu.sh.out
        export TORTURE_AFFINITY=
        kvm-get-cpus-script.sh $T/cpuarray.awk $T/cpubatches.awk $T/cpustate
-       cat << '        ___EOF___' >> $T/cpubatches.awk
-       END {
-               affinitylist = "";
-               if (!gotcpus()) {
-                       print "echo No CPU-affinity information, so no taskset command.";
-               } else if (cpu_count !~ /^[0-9][0-9]*$/) {
-                       print "echo " scenario ": Bogus number of CPUs (old qemu-cmd?), so no taskset command.";
-               } else {
-                       affinitylist = nextcpus(cpu_count);
-                       if (!(affinitylist ~ /^[0-9,-][0-9,-]*$/))
-                               print "echo " scenario ": Bogus CPU-affinity information, so no taskset command.";
-                       else if (!dumpcpustate())
-                               print "echo " scenario ": Could not dump state, so no taskset command.";
-                       else
-                               print "export TORTURE_AFFINITY=" affinitylist;
+       if test -z "${TORTURE_NO_AFFINITY}"
+       then
+               cat << '                ___EOF___' >> $T/cpubatches.awk
+               END {
+                       affinitylist = "";
+                       if (!gotcpus()) {
+                               print "echo No CPU-affinity information, so no taskset command.";
+                       } else if (cpu_count !~ /^[0-9][0-9]*$/) {
+                               print "echo " scenario ": Bogus number of CPUs (old qemu-cmd?), so no taskset command.";
+                       } else {
+                               affinitylist = nextcpus(cpu_count);
+                               if (!(affinitylist ~ /^[0-9,-][0-9,-]*$/))
+                                       print "echo " scenario ": Bogus CPU-affinity information, so no taskset command.";
+                               else if (!dumpcpustate())
+                                       print "echo " scenario ": Could not dump state, so no taskset command.";
+                               else
+                                       print "export TORTURE_AFFINITY=" affinitylist;
+                       }
                }
-       }
-       ___EOF___
-       cpu_count="`grep '# TORTURE_CPU_COUNT=' $i/qemu-cmd | sed -e 's/^.*=//'`"
-       affinity_export="`awk -f $T/cpubatches.awk -v cpu_count="$cpu_count" -v scenario=$i < /dev/null`"
-       $affinity_export
+               ___EOF___
+               cpu_count="`grep '# TORTURE_CPU_COUNT=' $i/qemu-cmd | sed -e 's/^.*=//'`"
+               affinity_export="`awk -f $T/cpubatches.awk -v cpu_count="$cpu_count" -v scenario=$i < /dev/null`"
+               $affinity_export
+       fi
        kvm-test-1-run-qemu.sh $i >> $i/kvm-test-1-run-qemu.sh.out 2>&1 &
 done
 for i in $runfiles
index 7af73ddc148d1dfa95ac8e01d2f4ea087dfe7160..42e5e8597a1a6e1aca0a7c3b9c94a34155daf435 100755 (executable)
@@ -42,6 +42,7 @@ TORTURE_JITTER_STOP=""
 TORTURE_KCONFIG_KASAN_ARG=""
 TORTURE_KCONFIG_KCSAN_ARG=""
 TORTURE_KMAKE_ARG=""
+TORTURE_NO_AFFINITY=""
 TORTURE_QEMU_MEM=512
 torture_qemu_mem_default=1
 TORTURE_REMOTE=
@@ -82,6 +83,7 @@ usage () {
        echo "       --kmake-arg kernel-make-arguments"
        echo "       --mac nn:nn:nn:nn:nn:nn"
        echo "       --memory megabytes|nnnG"
+       echo "       --no-affinity"
        echo "       --no-initrd"
        echo "       --qemu-args qemu-arguments"
        echo "       --qemu-cmd qemu-system-..."
@@ -220,6 +222,9 @@ do
                torture_qemu_mem_default=
                shift
                ;;
+       --no-affinity)
+               TORTURE_NO_AFFINITY="no-affinity"
+               ;;
        --no-initrd)
                TORTURE_INITRD=""; export TORTURE_INITRD
                ;;
@@ -417,6 +422,7 @@ TORTURE_KCONFIG_KASAN_ARG="$TORTURE_KCONFIG_KASAN_ARG"; export TORTURE_KCONFIG_K
 TORTURE_KCONFIG_KCSAN_ARG="$TORTURE_KCONFIG_KCSAN_ARG"; export TORTURE_KCONFIG_KCSAN_ARG
 TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG
 TORTURE_MOD="$TORTURE_MOD"; export TORTURE_MOD
+TORTURE_NO_AFFINITY="$TORTURE_NO_AFFINITY"; export TORTURE_NO_AFFINITY
 TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD
 TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE
 TORTURE_QEMU_MAC="$TORTURE_QEMU_MAC"; export TORTURE_QEMU_MAC