Commit a5202e17 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

torture: Make kvm-test-1-run-batch.sh select per-scenario affinity masks



This commit causes kvm-test-1-run-batch.sh to use the new
kvm-assign-cpus.sh and kvm-get-cpus-script.sh scripts to create a
TORTURE_AFFINITY environment variable containing either an empty string
(for no affinity) or a list of CPUs to pin the scenario's vCPUs to.
The additional change to kvm-test-1-run.sh places the per-scenario
number-of-CPUs information where it can easily be found.

If there is some reason why affinity cannot be supplied, this commit
prints and logs the reason via changes to kvm-again.sh.

Finally, this commit updates the kvm-remote.sh script to copy the
qemu-affinity output files back to the host system.

Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 9e528a84
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -179,6 +179,6 @@ if test -n "$dryrun"
then
	echo ---- Dryrun complete, directory: $rundir | tee -a "$rundir/log"
else
	( cd "$rundir"; sh $T/runbatches.sh )
	( cd "$rundir"; sh $T/runbatches.sh ) | tee -a "$rundir/log"
	kvm-end-run-stats.sh "$rundir" "$starttime"
fi
+1 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ do
		sleep 30
	done
	echo " ---" Collecting results from $i `date`
	( cd "$oldrun"; ssh $i "cd $rundir; tar -czf - kvm-remote-*.sh.out */console.log */kvm-test-1-run*.sh.out */qemu[_-]pid */qemu-retval; rm -rf $T > /dev/null 2>&1" | tar -xzf - )
	( cd "$oldrun"; ssh $i "cd $rundir; tar -czf - kvm-remote-*.sh.out */console.log */kvm-test-1-run*.sh.out */qemu[_-]pid */qemu-retval */qemu-affinity; rm -rf $T > /dev/null 2>&1" | tar -xzf - )
done

( kvm-end-run-stats.sh "$oldrun" "$starttime"; echo $? > $T/exitcode ) | tee -a "$oldrun/remote-log"
+23 −0
Original line number Diff line number Diff line
@@ -50,11 +50,34 @@ grep '^#' $1/qemu-cmd | sed -e 's/^# //' > $T/qemu-cmd-settings
echo ---- System running test: `uname -a`
echo ---- Starting kernels. `date` | tee -a log
$TORTURE_JITTER_START
kvm-assign-cpus.sh /sys/devices/system/node > $T/cpuarray.awk
for i in "$@"
do
	echo ---- System running test: `uname -a` > $i/kvm-test-1-run-qemu.sh.out
	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;
		}
	}
	___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
	kvm-test-1-run-qemu.sh $i >> $i/kvm-test-1-run-qemu.sh.out 2>&1 &
done
for i in $runfiles
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ echo "# TORTURE_KCONFIG_GDB_ARG=\"$TORTURE_KCONFIG_GDB_ARG\"" >> $resdir/qemu-cm
echo "# TORTURE_JITTER_START=\"$TORTURE_JITTER_START\"" >> $resdir/qemu-cmd
echo "# TORTURE_JITTER_STOP=\"$TORTURE_JITTER_STOP\"" >> $resdir/qemu-cmd
echo "# TORTURE_TRUST_MAKE=\"$TORTURE_TRUST_MAKE\"; export TORTURE_TRUST_MAKE" >> $resdir/qemu-cmd
echo "# TORTURE_CPU_COUNT=$cpu_count" >> $resdir/qemu-cmd

if test -n "$TORTURE_BUILDONLY"
then