RCU Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12
@ 2021-01-06 17:30 Paul E. McKenney
  2021-01-06 17:31 ` [PATCH tip/core/rcu 01/18] torture: Do Kconfig analysis only once per scenario paulmck
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: Paul E. McKenney @ 2021-01-06 17:30 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel

Hello!

This series adds a script to run a full set of tests.  My earlier practice
of testing just what changed proved inappropriate for the high-distraction
environment of a few months ago.

1.	Do Kconfig analysis only once per scenario.

2.	Add torture.sh torture-everything script.

3.	Make torture.sh use common time-duration bash functions.

4.	Remove use of "eval" in torture.sh.

5.	Add "make allmodconfig" to torture.sh.

6.	Auto-size SCF and scaling runs based on number of CPUs.

7.	Enable torture.sh argument checking.

8.	Make torture.sh rcuscale and refscale deal with allmodconfig.

9.	Make torture.sh refscale runs use verbose_batched module
	parameter.

10.	Create doyesno helper function for torture.sh.

11.	Make torture.sh allmodconfig retain and label output.

12.	Make torture.sh throttle VERBOSE_TOROUT_*() for refscale.

13.	Make torture.sh refuse to do zero-length runs.

14.	Drop log.long generation from torture.sh.

15.	Allow scenarios to be specified to torture.sh.

16.	Add command and results directory to torture.sh log.

17.	Add --kcsan-kmake-arg to torture.sh for KCSAN.

18.	Compress KASAN vmlinux files.

						Thanx, Paul

------------------------------------------------------------------------

 kvm.sh     |   22 +
 torture.sh |  698 +++++++++++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 585 insertions(+), 135 deletions(-)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 01/18] torture: Do Kconfig analysis only once per scenario
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 02/18] torture: Add torture.sh torture-everything script paulmck
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

Currently, if a scenario is repeated as in "--configs '4*TREE01'",
the Kconfig analysis is performed for each occurrance (four times in
this example) and each analysis places the exact same data into the
exact same files.  This is not really an issue in this repetition-four
example, but it can needlessly consume tens of seconds of wallclock time
for something like "--config '128*TINY01'".

This commit therefore does Kconfig analysis only once per set of
repeats of a given scenario, courtesy of the "sort -u" command and an
automatically generated awk script.

While in the area, this commit also wordsmiths a comment.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 6051868..8d3c99b 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -286,7 +286,8 @@ then
 		exit 1
 	fi
 fi
-for CF1 in $configs_derep
+echo 'BEGIN {' > $T/cfgcpu.awk
+for CF1 in `echo $configs_derep | tr -s ' ' '\012' | sort -u`
 do
 	if test -f "$CONFIGFRAG/$CF1"
 	then
@@ -299,12 +300,20 @@ do
 		fi
 		cpu_count=`configfrag_boot_cpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$CF1" "$cpu_count"`
 		cpu_count=`configfrag_boot_maxcpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$CF1" "$cpu_count"`
-		echo $CF1 $cpu_count >> $T/cfgcpu
+		echo 'scenariocpu["'"$CF1"'"] = '"$cpu_count"';' >> $T/cfgcpu.awk
 	else
 		echo "The --configs file $CF1 does not exist, terminating."
 		exit 1
 	fi
 done
+cat << '___EOF___' >> $T/cfgcpu.awk
+}
+{
+	for (i = 1; i <= NF; i++)
+		print $i, scenariocpu[$i];
+}
+___EOF___
+echo $configs_derep | awk -f $T/cfgcpu.awk > $T/cfgcpu
 sort -k2nr $T/cfgcpu -T="$T" > $T/cfgcpu.sort
 
 # Use a greedy bin-packing algorithm, sorting the list accordingly.
@@ -324,11 +333,10 @@ END {
 	batch = 0;
 	nc = -1;
 
-	# Each pass through the following loop creates on test batch
-	# that can be executed concurrently given ncpus.  Note that a
-	# given test that requires more than the available CPUs will run in
-	# their own batch.  Such tests just have to make do with what
-	# is available.
+	# Each pass through the following loop creates on test batch that
+	# can be executed concurrently given ncpus.  Note that a given test
+	# that requires more than the available CPUs will run in its own
+	# batch.  Such tests just have to make do with what is available.
 	while (nc != ncpus) {
 		batch++;
 		nc = ncpus;
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 02/18] torture: Add torture.sh torture-everything script
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
  2021-01-06 17:31 ` [PATCH tip/core/rcu 01/18] torture: Do Kconfig analysis only once per scenario paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 03/18] torture: Make torture.sh use common time-duration bash functions paulmck
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

Although tailoring a specific set of kvm.sh runs has served rcutorture
testing well over many years, it requires a relatively distraction-free
environment, which is not always available.  This commit therefore
adds a prototype torture.sh script that by default tortures pretty much
everything the rcutorture scripting is designed to torture, and which
can be given command-line arguments to take a more focused approach.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 301 ++++++++++++++++++++++
 1 file changed, 301 insertions(+)
 create mode 100644 tools/testing/selftests/rcutorture/bin/torture.sh

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
new file mode 100644
index 0000000..f556cc7
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -0,0 +1,301 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Run a series of torture tests, intended for overnight or
+# longer timeframes, and also for large systems.
+#
+# Usage: torture.sh [ options ]
+#
+# Copyright (C) 2020 Facebook, Inc.
+#
+# Authors: Paul E. McKenney <paulmck@kernel.org>
+
+scriptname=$0
+args="$*"
+
+# Default duration and apportionment.
+duration_base=10
+duration_rcutorture_frac=7
+duration_locktorture_frac=1
+duration_scftorture_frac=2
+
+# "yes" or "no" parameters
+do_rcutorture=yes
+do_locktorture=yes
+do_scftorture=yes
+do_rcuscale=yes
+do_refscale=yes
+do_kvfree=yes
+do_kasan=yes
+do_kcsan=no
+
+usage () {
+	echo "Usage: $scriptname optional arguments:"
+	echo "       --doall"
+	echo "       --do-kasan / --do-no-kasan"
+	echo "       --do-kcsan / --do-no-kcsan"
+	echo "       --do-kvfree / --do-no-kvfree"
+	echo "       --do-locktorture / --do-no-locktorture"
+	echo "       --do-none"
+	echo "       --do-rcuscale / --do-no-rcuscale"
+	echo "       --do-rcutorture / --do-no-rcutorture"
+	echo "       --do-refscale / --do-no-refscale"
+	echo "       --do-scftorture / --do-no-scftorture"
+	echo "       --duration [ <minutes> | <hours>h | <days>d ]"
+	exit 1
+}
+
+while test $# -gt 0
+do
+	case "$1" in
+	--doall)
+		do_rcutorture=yes
+		do_locktorture=yes
+		do_scftorture=yes
+		do_rcuscale=yes
+		do_refscale=yes
+		do_kvfree=yes
+		do_kasan=yes
+		do_kcsan=yes
+		;;
+	--do-kasan|--do-no-kasan)
+		if test "$1" = --do-kasan
+		then
+			do_kasan=yes
+		else
+			do_kasan=no
+		fi
+		;;
+	--do-kcsan|--do-no-kcsan)
+		if test "$1" = --do-kcsan
+		then
+			do_kcsan=yes
+		else
+			do_kcsan=no
+		fi
+		;;
+	--do-kvfree|--do-no-kvfree)
+		if test "$1" = --do-kvfree
+		then
+			do_kvfree=yes
+		else
+			do_kvfree=no
+		fi
+		;;
+	--do-locktorture|--do-no-locktorture)
+		if test "$1" = --do-locktorture
+		then
+			do_locktorture=yes
+		else
+			do_locktorture=no
+		fi
+		;;
+	--do-none)
+		do_rcutorture=no
+		do_locktorture=no
+		do_scftorture=no
+		do_rcuscale=no
+		do_refscale=no
+		do_kvfree=no
+		do_kasan=no
+		do_kcsan=no
+		;;
+	--do-rcuscale|--do-no-rcuscale)
+		if test "$1" = --do-rcuscale
+		then
+			do_rcuscale=yes
+		else
+			do_rcuscale=no
+		fi
+		;;
+	--do-rcutorture|--do-no-rcutorture)
+		if test "$1" = --do-rcutorture
+		then
+			do_rcutorture=yes
+		else
+			do_rcutorture=no
+		fi
+		;;
+	--do-refscale|--do-no-refscale)
+		if test "$1" = --do-refscale
+		then
+			do_refscale=yes
+		else
+			do_refscale=no
+		fi
+		;;
+	--do-scftorture|--do-no-scftorture)
+		if test "$1" = --do-scftorture
+		then
+			do_scftorture=yes
+		else
+			do_scftorture=no
+		fi
+		;;
+	--duration)
+		# checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(s\|m\|h\|d\|\)$' '^error'
+		mult=60
+		if echo "$2" | grep -q 's$'
+		then
+			mult=1
+		elif echo "$2" | grep -q 'h$'
+		then
+			mult=3600
+		elif echo "$2" | grep -q 'd$'
+		then
+			mult=86400
+		fi
+		ts=`echo $2 | sed -e 's/[smhd]$//'`
+		duration_base=$(($ts*mult))
+		shift
+		;;
+	*)
+		echo Unknown argument $1
+		usage
+		;;
+	esac
+	shift
+done
+
+duration_rcutorture=$((duration_base*duration_rcutorture_frac/10))
+# Need to sum remaining weights, and if duration weights to zero,
+# set do_no_rcutorture. @@@
+duration_locktorture=$((duration_base*duration_locktorture_frac/10))
+duration_scftorture=$((duration_base*duration_scftorture_frac/10))
+
+T=/tmp/torture.sh.$$
+trap 'rm -rf $T' 0 2
+mkdir $T
+
+touch $T/failures
+touch $T/successes
+
+ds="`date +%Y.%m.%d-%H.%M.%S`-torture"
+startdate="`date`"
+starttime="`awk 'BEGIN { print systime() }' < /dev/null`"
+
+# tortureme flavor command
+# Note that "flavor" is an arbitrary string.  Supply --torture if needed.
+function torture_one {
+	echo " --- $curflavor:" Start `date` | tee -a $T/log
+	eval $* --datestamp "$ds/results-$curflavor" > $T/$curflavor.out 2>&1
+	retcode=$?
+	resdir="`grep '^Results directory: ' $T/$curflavor.out | tail -1 | sed -e 's/^Results directory: //'`"
+	if test -n "$resdir"
+	then
+		cp $T/$curflavor.out $resdir/log.long
+		echo retcode=$retcode >> $resdir/log.long
+	else
+		cat $T/$curflavor.out | tee -a $T/log
+		echo retcode=$retcode | tee -a $T/log
+	fi
+	if test "$retcode" == 0
+	then
+		echo "$curflavor($retcode)" $resdir >> $T/successes
+	else
+		echo "$curflavor($retcode)" $resdir >> $T/failures
+	fi
+}
+
+function torture_set {
+	local flavor=$1
+	shift
+	curflavor=$flavor
+	torture_one $*
+	if test "$do_kasan" = "yes"
+	then
+		curflavor=${flavor}-kasan
+		torture_one $* --kasan
+	fi
+	if test "$do_kcsan" = "yes"
+	then
+		curflavor=${flavor}-kcsan
+		torture_one $* --kconfig '"CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y"' --kmake-arg "CC=clang" --kcsan
+	fi
+}
+
+if test "$do_rcutorture" = "yes"
+then
+	torture_set "rcutorture" 'tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration '"$duration_rcutorture"' --configs "TREE10 4*CFLIST" --bootargs "rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000" --trust-make'
+fi
+
+if test "$do_locktorture" = "yes"
+then
+	torture_set "locktorture" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture lock --allcpus --duration '"$duration_locktorture"' --configs "14*CFLIST" --bootargs "torture.disable_onoff_at_boot" --trust-make'
+fi
+
+if test "$do_scftorture" = "yes"
+then
+	torture_set "scftorture" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration '"$duration_scftorture"' --kconfig "CONFIG_NR_CPUS=224" --bootargs "scftorture.nthreads=224 torture.disable_onoff_at_boot" --trust-make'
+fi
+
+if test "$do_refscale" = yes
+then
+	primlist="`grep '\.name[ 	]*=' kernel/rcu/refscale*.c | sed -e 's/^[^"]*"//' -e 's/".*$//'`"
+else
+	primlist=
+fi
+for prim in $primlist
+do
+	torture_set "refscale-$prim" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --bootargs "refscale.scale_type='"$prim"' refscale.nreaders=224 refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot" --trust-make'
+done
+
+if test "$do_rcuscale" = yes
+then
+	primlist="`grep '\.name[ 	]*=' kernel/rcu/rcuscale*.c | sed -e 's/^[^"]*"//' -e 's/".*$//'`"
+else
+	primlist=
+fi
+for prim in $primlist
+do
+	torture_set "rcuscale-$prim" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --bootargs "rcuscale.scale_type='"$prim"' rcuscale.nwriters=224 rcuscale.holdoff=20 torture.disable_onoff_at_boot" --trust-make'
+done
+
+if test "$do_kvfree" = "yes"
+then
+	torture_set "rcuscale-kvfree" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 10 --kconfig "CONFIG_NR_CPUS=224" --bootargs "rcuscale.kfree_rcu_test=1 rcuscale.kfree_nthreads=16 rcuscale.holdoff=20 rcuscale.kfree_loops=10000 torture.disable_onoff_at_boot" --trust-make'
+fi
+
+echo " --- " $scriptname $args
+echo " --- " Done `date` | tee -a $T/log
+ret=0
+nsuccesses=0
+echo SUCCESSES: | tee -a $T/log
+if test -s "$T/successes"
+then
+	cat "$T/successes" | tee -a $T/log
+	nsuccesses="`wc -l "$T/successes" | awk '{ print $1 }'`"
+fi
+nfailures=0
+echo FAILURES: | tee -a $T/log
+if test -s "$T/failures"
+then
+	cat "$T/failures" | tee -a $T/log
+	nfailures="`wc -l "$T/failures" | awk '{ print $1 }'`"
+	ret=2
+fi
+duration="`awk -v starttime=$starttime '
+BEGIN {
+	s = systime() - starttime; 
+	h = s / 3600;
+	d = h /24;
+	if (d < 1)
+		print h " hours";
+	else
+		print d " days (" h " hours)";
+}' < /dev/null`"
+echo Started at $startdate, ended at `date`, duration $duration. | tee -a $T/log
+echo Summary: Successes: $nsuccesses Failures: $nfailures. | tee -a $T/log
+tdir="`cat $T/successes $T/failures | head -1 | awk '{ print $NF }' | sed -e 's,/[^/]\+/*$,,'`"
+if test -n "$tdir"
+then
+	cp $T/log $tdir
+fi
+exit $ret
+
+# RCU CPU stall warnings?
+# scftorture warnings?
+# Need a way for the invoker to specify clang.
+# Work out --configs based on number of available CPUs?
+# Need a way to specify --configs.  --configs--rcutorture?
+# Need to sense CPUs to size scftorture run.  Ditto rcuscale and refscale.
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 03/18] torture: Make torture.sh use common time-duration bash functions
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
  2021-01-06 17:31 ` [PATCH tip/core/rcu 01/18] torture: Do Kconfig analysis only once per scenario paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 02/18] torture: Add torture.sh torture-everything script paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 04/18] torture: Remove use of "eval" in torture.sh paulmck
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit makes torture.sh use the new bash functions get_starttime()
and get_starttime_duration() created for kvm.sh.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
 mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/torture.sh

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
old mode 100644
new mode 100755
index f556cc7..1657404
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -13,6 +13,10 @@
 scriptname=$0
 args="$*"
 
+KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
+PATH=${KVM}/bin:$PATH; export PATH
+. functions.sh
+
 # Default duration and apportionment.
 duration_base=10
 duration_rcutorture_frac=7
@@ -172,7 +176,7 @@ touch $T/successes
 
 ds="`date +%Y.%m.%d-%H.%M.%S`-torture"
 startdate="`date`"
-starttime="`awk 'BEGIN { print systime() }' < /dev/null`"
+starttime="`get_starttime`"
 
 # tortureme flavor command
 # Note that "flavor" is an arbitrary string.  Supply --torture if needed.
@@ -274,17 +278,7 @@ then
 	nfailures="`wc -l "$T/failures" | awk '{ print $1 }'`"
 	ret=2
 fi
-duration="`awk -v starttime=$starttime '
-BEGIN {
-	s = systime() - starttime; 
-	h = s / 3600;
-	d = h /24;
-	if (d < 1)
-		print h " hours";
-	else
-		print d " days (" h " hours)";
-}' < /dev/null`"
-echo Started at $startdate, ended at `date`, duration $duration. | tee -a $T/log
+echo Started at $startdate, ended at `date`, duration `get_starttime_duration $starttime`. | tee -a $T/log
 echo Summary: Successes: $nsuccesses Failures: $nfailures. | tee -a $T/log
 tdir="`cat $T/successes $T/failures | head -1 | awk '{ print $NF }' | sed -e 's,/[^/]\+/*$,,'`"
 if test -n "$tdir"
@@ -293,9 +287,9 @@ then
 fi
 exit $ret
 
+# @@@
 # RCU CPU stall warnings?
 # scftorture warnings?
 # Need a way for the invoker to specify clang.
 # Work out --configs based on number of available CPUs?
-# Need a way to specify --configs.  --configs--rcutorture?
 # Need to sense CPUs to size scftorture run.  Ditto rcuscale and refscale.
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 04/18] torture: Remove use of "eval" in torture.sh
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (2 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 03/18] torture: Make torture.sh use common time-duration bash functions paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 05/18] torture: Add "make allmodconfig" to torture.sh paulmck
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

The bash "eval" command enables Bobby Tables attacks, which might not
be a concern in torture testing by themselves, but one could imagine
these combined with a cut-and-paste attack.  This commit therefore gets
rid of them.  This comes at a price in terms of bash quoting not working
nicely, so the "--bootargs" argument lists are now passed to torture_one
via a bash-variable side channel.  This might be a bit ugly, but it will
also allow torture.sh to grow its own --bootargs parameter.

While in the area, add proper header comments for the bash functions.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 55 ++++++++++++++++++-----
 1 file changed, 44 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 1657404..0bd8e84 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -178,11 +178,26 @@ ds="`date +%Y.%m.%d-%H.%M.%S`-torture"
 startdate="`date`"
 starttime="`get_starttime`"
 
-# tortureme flavor command
+# torture_one - Does a single kvm.sh run.
+#
+# Usage:
+#	torture_bootargs="[ kernel boot arguments ]"
+#	torture_one flavor [ kvm.sh arguments ]
+#
 # Note that "flavor" is an arbitrary string.  Supply --torture if needed.
+# Note that quoting is problematic.  So on the command line, pass multiple
+# values with multiple kvm.sh argument instances.
 function torture_one {
+	local cur_bootargs=
+	local boottag=
+
 	echo " --- $curflavor:" Start `date` | tee -a $T/log
-	eval $* --datestamp "$ds/results-$curflavor" > $T/$curflavor.out 2>&1
+	if test -n "$torture_bootargs"
+	then
+		boottag="--bootargs"
+		cur_bootargs="$torture_bootargs"
+	fi
+	"$@" $boottag "$cur_bootargs" --datestamp "$ds/results-$curflavor" > $T/$curflavor.out 2>&1
 	retcode=$?
 	resdir="`grep '^Results directory: ' $T/$curflavor.out | tail -1 | sed -e 's/^Results directory: //'`"
 	if test -n "$resdir"
@@ -201,36 +216,48 @@ function torture_one {
 	fi
 }
 
+# torture_set - Does a set of tortures with and without KASAN and KCSAN.
+#
+# Usage:
+#	torture_bootargs="[ kernel boot arguments ]"
+#	torture_set flavor [ kvm.sh arguments ]
+#
+# Note that "flavor" is an arbitrary string.  Supply --torture if needed.
+# Note that quoting is problematic.  So on the command line, pass multiple
+# values with multiple kvm.sh argument instances.
 function torture_set {
 	local flavor=$1
 	shift
 	curflavor=$flavor
-	torture_one $*
+	torture_one "$@"
 	if test "$do_kasan" = "yes"
 	then
 		curflavor=${flavor}-kasan
-		torture_one $* --kasan
+		torture_one "$@" --kasan
 	fi
 	if test "$do_kcsan" = "yes"
 	then
 		curflavor=${flavor}-kcsan
-		torture_one $* --kconfig '"CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y"' --kmake-arg "CC=clang" --kcsan
+		torture_one $* --kconfig "CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y" --kmake-arg "CC=clang" --kcsan
 	fi
 }
 
 if test "$do_rcutorture" = "yes"
 then
-	torture_set "rcutorture" 'tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration '"$duration_rcutorture"' --configs "TREE10 4*CFLIST" --bootargs "rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000" --trust-make'
+	torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000"
+	torture_set "rcutorture" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration "$duration_rcutorture" --configs "TREE10 4*CFLIST" --trust-make
 fi
 
 if test "$do_locktorture" = "yes"
 then
-	torture_set "locktorture" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture lock --allcpus --duration '"$duration_locktorture"' --configs "14*CFLIST" --bootargs "torture.disable_onoff_at_boot" --trust-make'
+	torture_bootargs="torture.disable_onoff_at_boot"
+	torture_set "locktorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture lock --allcpus --duration "$duration_locktorture" --configs "14*CFLIST" --trust-make
 fi
 
 if test "$do_scftorture" = "yes"
 then
-	torture_set "scftorture" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration '"$duration_scftorture"' --kconfig "CONFIG_NR_CPUS=224" --bootargs "scftorture.nthreads=224 torture.disable_onoff_at_boot" --trust-make'
+	torture_bootargs="scftorture.nthreads=224 torture.disable_onoff_at_boot"
+	torture_set "scftorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration "$duration_scftorture" --kconfig "CONFIG_NR_CPUS=224" --trust-make
 fi
 
 if test "$do_refscale" = yes
@@ -241,7 +268,8 @@ else
 fi
 for prim in $primlist
 do
-	torture_set "refscale-$prim" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --bootargs "refscale.scale_type='"$prim"' refscale.nreaders=224 refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot" --trust-make'
+	torture_bootargs="refscale.scale_type="$prim" refscale.nreaders=224 refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot"
+	torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --trust-make
 done
 
 if test "$do_rcuscale" = yes
@@ -252,12 +280,14 @@ else
 fi
 for prim in $primlist
 do
-	torture_set "rcuscale-$prim" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --bootargs "rcuscale.scale_type='"$prim"' rcuscale.nwriters=224 rcuscale.holdoff=20 torture.disable_onoff_at_boot" --trust-make'
+	torture_bootargs="rcuscale.scale_type="$prim" rcuscale.nwriters=224 rcuscale.holdoff=20 torture.disable_onoff_at_boot"
+	torture_set "rcuscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --trust-make
 done
 
 if test "$do_kvfree" = "yes"
 then
-	torture_set "rcuscale-kvfree" 'tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 10 --kconfig "CONFIG_NR_CPUS=224" --bootargs "rcuscale.kfree_rcu_test=1 rcuscale.kfree_nthreads=16 rcuscale.holdoff=20 rcuscale.kfree_loops=10000 torture.disable_onoff_at_boot" --trust-make'
+	torture_bootargs="rcuscale.kfree_rcu_test=1 rcuscale.kfree_nthreads=16 rcuscale.holdoff=20 rcuscale.kfree_loops=10000 torture.disable_onoff_at_boot"
+	torture_set "rcuscale-kvfree" tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 10 --kconfig "CONFIG_NR_CPUS=224" --trust-make
 fi
 
 echo " --- " $scriptname $args
@@ -293,3 +323,6 @@ exit $ret
 # Need a way for the invoker to specify clang.
 # Work out --configs based on number of available CPUs?
 # Need to sense CPUs to size scftorture run.  Ditto rcuscale and refscale.
+# --kconfig as with --bootargs (Both have overrides.)
+# Command line parameters for --bootargs, --config, --kconfig, --kmake-arg, and --qemu-arg
+# Ensure that build failures count as failures
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 05/18] torture: Add "make allmodconfig" to torture.sh
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (3 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 04/18] torture: Remove use of "eval" in torture.sh paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 06/18] torture: Auto-size SCF and scaling runs based on number of CPUs paulmck
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit adds the ability to do "make allmodconfig" to torture.sh,
given that normal rcutorture runs do not normally catch missing exports.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 37 ++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 0bd8e84..57f2f31 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -17,6 +17,9 @@ KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
 PATH=${KVM}/bin:$PATH; export PATH
 . functions.sh
 
+TORTURE_ALLOTED_CPUS="`identify_qemu_vcpus`"
+MAKE_ALLOTED_CPUS=$((TORTURE_ALLOTED_CPUS*2))
+
 # Default duration and apportionment.
 duration_base=10
 duration_rcutorture_frac=7
@@ -24,6 +27,7 @@ duration_locktorture_frac=1
 duration_scftorture_frac=2
 
 # "yes" or "no" parameters
+do_allmodconfig=yes
 do_rcutorture=yes
 do_locktorture=yes
 do_scftorture=yes
@@ -36,6 +40,7 @@ do_kcsan=no
 usage () {
 	echo "Usage: $scriptname optional arguments:"
 	echo "       --doall"
+	echo "       --doallmodconfig / --do-no-allmodconfig"
 	echo "       --do-kasan / --do-no-kasan"
 	echo "       --do-kcsan / --do-no-kcsan"
 	echo "       --do-kvfree / --do-no-kvfree"
@@ -53,6 +58,7 @@ while test $# -gt 0
 do
 	case "$1" in
 	--doall)
+		do_allmodconfig=yes
 		do_rcutorture=yes
 		do_locktorture=yes
 		do_scftorture=yes
@@ -62,6 +68,14 @@ do
 		do_kasan=yes
 		do_kcsan=yes
 		;;
+	--do-allmodconfig|--do-no-allmodconfig)
+		if test "$1" = --do-allmodconfig
+		then
+			do_allmodconfig=yes
+		else
+			do_allmodconfig=no
+		fi
+		;;
 	--do-kasan|--do-no-kasan)
 		if test "$1" = --do-kasan
 		then
@@ -95,6 +109,7 @@ do
 		fi
 		;;
 	--do-none)
+		do_allmodconfig=no
 		do_rcutorture=no
 		do_locktorture=no
 		do_scftorture=no
@@ -242,6 +257,26 @@ function torture_set {
 	fi
 }
 
+# make allmodconfig
+if test "$do_allmodconfig" = "yes"
+then
+	echo " --- allmodconfig:" Start `date` | tee -a $T/log
+	amcdir="tools/testing/selftests/rcutorture/res/$ds/allmodconfig"
+	mkdir -p "$amcdir"
+	make -j$MAKE_ALLOTED_CPUS clean > "$amcdir/Make.out" 2>&1
+	make -j$MAKE_ALLOTED_CPUS allmodconfig > "$amcdir/Make.out" 2>&1
+	make -j$MAKE_ALLOTED_CPUS > "$amcdir/Make.out" 2>&1
+	retcode="$?"
+	echo $retcode > "$amcdir/Make.exitcode"
+	if test "$retcode" == 0
+	then
+		echo "allmodconfig($retcode)" $amcdir >> $T/successes
+	else
+		echo "allmodconfig($retcode)" $amcdir >> $T/failures
+	fi
+fi
+
+# --torture rcu
 if test "$do_rcutorture" = "yes"
 then
 	torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000"
@@ -320,7 +355,7 @@ exit $ret
 # @@@
 # RCU CPU stall warnings?
 # scftorture warnings?
-# Need a way for the invoker to specify clang.
+# Need a way for the invoker to specify clang.  Maybe --kcsan-kmake or some such.
 # Work out --configs based on number of available CPUs?
 # Need to sense CPUs to size scftorture run.  Ditto rcuscale and refscale.
 # --kconfig as with --bootargs (Both have overrides.)
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 06/18] torture: Auto-size SCF and scaling runs based on number of CPUs
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (4 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 05/18] torture: Add "make allmodconfig" to torture.sh paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 07/18] torture: Enable torture.sh argument checking paulmck
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit improves torture.sh flexibility by autoscaling the number
of CPUs to be used in variable-CPUs torture tests, including scftorture,
refscale, rcuscale, and kvfree.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 57f2f31..e13dacf 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -19,6 +19,11 @@ PATH=${KVM}/bin:$PATH; export PATH
 
 TORTURE_ALLOTED_CPUS="`identify_qemu_vcpus`"
 MAKE_ALLOTED_CPUS=$((TORTURE_ALLOTED_CPUS*2))
+HALF_ALLOTED_CPUS=$((TORTURE_ALLOTED_CPUS/2))
+if test "$HALF_ALLOTED_CPUS" -lt 1
+then
+	HALF_ALLOTED_CPUS=1
+fi
 
 # Default duration and apportionment.
 duration_base=10
@@ -291,8 +296,8 @@ fi
 
 if test "$do_scftorture" = "yes"
 then
-	torture_bootargs="scftorture.nthreads=224 torture.disable_onoff_at_boot"
-	torture_set "scftorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration "$duration_scftorture" --kconfig "CONFIG_NR_CPUS=224" --trust-make
+	torture_bootargs="scftorture.nthreads=$HALF_ALLOTED_CPUS torture.disable_onoff_at_boot"
+	torture_set "scftorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration "$duration_scftorture" --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --trust-make
 fi
 
 if test "$do_refscale" = yes
@@ -303,8 +308,8 @@ else
 fi
 for prim in $primlist
 do
-	torture_bootargs="refscale.scale_type="$prim" refscale.nreaders=224 refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot"
-	torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --trust-make
+	torture_bootargs="refscale.scale_type="$prim" refscale.nreaders=$HALF_ALLOTED_CPUS refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot"
+	torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --trust-make
 done
 
 if test "$do_rcuscale" = yes
@@ -315,14 +320,14 @@ else
 fi
 for prim in $primlist
 do
-	torture_bootargs="rcuscale.scale_type="$prim" rcuscale.nwriters=224 rcuscale.holdoff=20 torture.disable_onoff_at_boot"
-	torture_set "rcuscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=224" --trust-make
+	torture_bootargs="rcuscale.scale_type="$prim" rcuscale.nwriters=$HALF_ALLOTED_CPUS rcuscale.holdoff=20 torture.disable_onoff_at_boot"
+	torture_set "rcuscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --trust-make
 done
 
 if test "$do_kvfree" = "yes"
 then
 	torture_bootargs="rcuscale.kfree_rcu_test=1 rcuscale.kfree_nthreads=16 rcuscale.holdoff=20 rcuscale.kfree_loops=10000 torture.disable_onoff_at_boot"
-	torture_set "rcuscale-kvfree" tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 10 --kconfig "CONFIG_NR_CPUS=224" --trust-make
+	torture_set "rcuscale-kvfree" tools/testing/selftests/rcutorture/bin/kvm.sh --torture rcuscale --allcpus --duration 10 --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --trust-make
 fi
 
 echo " --- " $scriptname $args
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 07/18] torture: Enable torture.sh argument checking
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (5 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 06/18] torture: Auto-size SCF and scaling runs based on number of CPUs paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 08/18] torture: Make torture.sh rcuscale and refscale deal with allmodconfig paulmck
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit uncomments the argument checking for the --duration argument
to torture.sh.  While in the area, it also corrects the duration units
from seconds to minutes.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index e13dacf..8e66797 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -157,17 +157,17 @@ do
 		fi
 		;;
 	--duration)
-		# checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(s\|m\|h\|d\|\)$' '^error'
-		mult=60
-		if echo "$2" | grep -q 's$'
+		checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(m\|h\|d\|\)$' '^error'
+		mult=1
+		if echo "$2" | grep -q 'm$'
 		then
 			mult=1
 		elif echo "$2" | grep -q 'h$'
 		then
-			mult=3600
+			mult=60
 		elif echo "$2" | grep -q 'd$'
 		then
-			mult=86400
+			mult=1440
 		fi
 		ts=`echo $2 | sed -e 's/[smhd]$//'`
 		duration_base=$(($ts*mult))
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 08/18] torture: Make torture.sh rcuscale and refscale deal with allmodconfig
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (6 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 07/18] torture: Enable torture.sh argument checking paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 09/18] torture: Make torture.sh refscale runs use verbose_batched module parameter paulmck
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

The .mod.c files created by allmodconfig builds interfers with the approach
torture.sh uses to enumerate types of rcuscale and refscale runs.  This
commit therefore tightens the pattern matching to avoid this interference.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 8e66797..a89b521 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -302,7 +302,7 @@ fi
 
 if test "$do_refscale" = yes
 then
-	primlist="`grep '\.name[ 	]*=' kernel/rcu/refscale*.c | sed -e 's/^[^"]*"//' -e 's/".*$//'`"
+	primlist="`grep '\.name[ 	]*=' kernel/rcu/refscale.c | sed -e 's/^[^"]*"//' -e 's/".*$//'`"
 else
 	primlist=
 fi
@@ -314,7 +314,7 @@ done
 
 if test "$do_rcuscale" = yes
 then
-	primlist="`grep '\.name[ 	]*=' kernel/rcu/rcuscale*.c | sed -e 's/^[^"]*"//' -e 's/".*$//'`"
+	primlist="`grep '\.name[ 	]*=' kernel/rcu/rcuscale.c | sed -e 's/^[^"]*"//' -e 's/".*$//'`"
 else
 	primlist=
 fi
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 09/18] torture: Make torture.sh refscale runs use verbose_batched module parameter
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (7 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 08/18] torture: Make torture.sh rcuscale and refscale deal with allmodconfig paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 10/18] torture: Create doyesno helper function for torture.sh paulmck
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

On large systems, the refscale printk() rate can overrun the file system's
ability to accept console log messages.  This commit therefore uses the
new verbose_batched module parameter to rate-limit some of the higher-rate
printk() calls.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index a89b521..a3c3c25 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -24,6 +24,11 @@ if test "$HALF_ALLOTED_CPUS" -lt 1
 then
 	HALF_ALLOTED_CPUS=1
 fi
+VERBOSE_BATCH_CPUS=$((TORTURE_ALLOTED_CPUS/16))
+if test "$VERBOSE_BATCH_CPUS" -lt 2
+then
+	VERBOSE_BATCH_CPUS=0
+fi
 
 # Default duration and apportionment.
 duration_base=10
@@ -309,7 +314,7 @@ fi
 for prim in $primlist
 do
 	torture_bootargs="refscale.scale_type="$prim" refscale.nreaders=$HALF_ALLOTED_CPUS refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot"
-	torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --trust-make
+	torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --bootargs "verbose_batched=$VERBOSE_BATCH_CPUS" --trust-make
 done
 
 if test "$do_rcuscale" = yes
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 10/18] torture: Create doyesno helper function for torture.sh
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (8 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 09/18] torture: Make torture.sh refscale runs use verbose_batched module parameter paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 11/18] torture: Make torture.sh allmodconfig retain and label output paulmck
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit saves a few lines of code by creating a doyesno helper bash
function for argument parsing.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 78 ++++++-----------------
 1 file changed, 19 insertions(+), 59 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index a3c3c25..a01079e 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -47,6 +47,16 @@ do_kvfree=yes
 do_kasan=yes
 do_kcsan=no
 
+# doyesno - Helper function for yes/no arguments
+function doyesno () {
+	if test "$1" = "$2"
+	then
+		echo yes
+	else
+		echo no
+	fi
+}
+
 usage () {
 	echo "Usage: $scriptname optional arguments:"
 	echo "       --doall"
@@ -79,44 +89,19 @@ do
 		do_kcsan=yes
 		;;
 	--do-allmodconfig|--do-no-allmodconfig)
-		if test "$1" = --do-allmodconfig
-		then
-			do_allmodconfig=yes
-		else
-			do_allmodconfig=no
-		fi
+		do_allmodconfig=`doyesno "$1" --do-allmodconfig`
 		;;
 	--do-kasan|--do-no-kasan)
-		if test "$1" = --do-kasan
-		then
-			do_kasan=yes
-		else
-			do_kasan=no
-		fi
+		do_kasan=`doyesno "$1" --do-kasan`
 		;;
 	--do-kcsan|--do-no-kcsan)
-		if test "$1" = --do-kcsan
-		then
-			do_kcsan=yes
-		else
-			do_kcsan=no
-		fi
+		do_kcsan=`doyesno "$1" --do-kcsan`
 		;;
 	--do-kvfree|--do-no-kvfree)
-		if test "$1" = --do-kvfree
-		then
-			do_kvfree=yes
-		else
-			do_kvfree=no
-		fi
+		do_kvfree=`doyesno "$1" --do-kvfree`
 		;;
 	--do-locktorture|--do-no-locktorture)
-		if test "$1" = --do-locktorture
-		then
-			do_locktorture=yes
-		else
-			do_locktorture=no
-		fi
+		do_locktorture=`doyesno "$1" --do-locktorture`
 		;;
 	--do-none)
 		do_allmodconfig=no
@@ -130,36 +115,16 @@ do
 		do_kcsan=no
 		;;
 	--do-rcuscale|--do-no-rcuscale)
-		if test "$1" = --do-rcuscale
-		then
-			do_rcuscale=yes
-		else
-			do_rcuscale=no
-		fi
+		do_rcuscale=`doyesno "$1" --do-rcuscale`
 		;;
 	--do-rcutorture|--do-no-rcutorture)
-		if test "$1" = --do-rcutorture
-		then
-			do_rcutorture=yes
-		else
-			do_rcutorture=no
-		fi
+		do_rcutorture=`doyesno "$1" --do-rcutorture`
 		;;
 	--do-refscale|--do-no-refscale)
-		if test "$1" = --do-refscale
-		then
-			do_refscale=yes
-		else
-			do_refscale=no
-		fi
+		do_refscale=`doyesno "$1" --do-refscale`
 		;;
 	--do-scftorture|--do-no-scftorture)
-		if test "$1" = --do-scftorture
-		then
-			do_scftorture=yes
-		else
-			do_scftorture=no
-		fi
+		do_scftorture=`doyesno "$1" --do-scftorture`
 		;;
 	--duration)
 		checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(m\|h\|d\|\)$' '^error'
@@ -363,11 +328,6 @@ fi
 exit $ret
 
 # @@@
-# RCU CPU stall warnings?
-# scftorture warnings?
 # Need a way for the invoker to specify clang.  Maybe --kcsan-kmake or some such.
-# Work out --configs based on number of available CPUs?
-# Need to sense CPUs to size scftorture run.  Ditto rcuscale and refscale.
 # --kconfig as with --bootargs (Both have overrides.)
 # Command line parameters for --bootargs, --config, --kconfig, --kmake-arg, and --qemu-arg
-# Ensure that build failures count as failures
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 11/18] torture: Make torture.sh allmodconfig retain and label output
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (9 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 10/18] torture: Create doyesno helper function for torture.sh paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 12/18] torture: Make torture.sh throttle VERBOSE_TOROUT_*() for refscale paulmck
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit places "---" markers in the torture.sh script's allmodconfig
output, and uses "<<" to avoid overwriting earlier output from this
build test.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index a01079e..e2c97f9 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -238,9 +238,12 @@ then
 	echo " --- allmodconfig:" Start `date` | tee -a $T/log
 	amcdir="tools/testing/selftests/rcutorture/res/$ds/allmodconfig"
 	mkdir -p "$amcdir"
-	make -j$MAKE_ALLOTED_CPUS clean > "$amcdir/Make.out" 2>&1
-	make -j$MAKE_ALLOTED_CPUS allmodconfig > "$amcdir/Make.out" 2>&1
-	make -j$MAKE_ALLOTED_CPUS > "$amcdir/Make.out" 2>&1
+	echo " --- make clean" > "$amcdir/Make.out" 2>&1
+	make -j$MAKE_ALLOTED_CPUS clean >> "$amcdir/Make.out" 2>&1
+	echo " --- make allmodconfig" >> "$amcdir/Make.out" 2>&1
+	make -j$MAKE_ALLOTED_CPUS allmodconfig >> "$amcdir/Make.out" 2>&1
+	echo " --- make " >> "$amcdir/Make.out" 2>&1
+	make -j$MAKE_ALLOTED_CPUS >> "$amcdir/Make.out" 2>&1
 	retcode="$?"
 	echo $retcode > "$amcdir/Make.exitcode"
 	if test "$retcode" == 0
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 12/18] torture: Make torture.sh throttle VERBOSE_TOROUT_*() for refscale
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (10 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 11/18] torture: Make torture.sh allmodconfig retain and label output paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 13/18] torture: Make torture.sh refuse to do zero-length runs paulmck
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit causes torture.sh to use the torture.verbose_sleep_frequency
kernel boot parameter to throttle verbose refscale output on large systems.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index e2c97f9..f2f9140 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -282,7 +282,7 @@ fi
 for prim in $primlist
 do
 	torture_bootargs="refscale.scale_type="$prim" refscale.nreaders=$HALF_ALLOTED_CPUS refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot"
-	torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --bootargs "verbose_batched=$VERBOSE_BATCH_CPUS" --trust-make
+	torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --bootargs "verbose_batched=$VERBOSE_BATCH_CPUS torture.verbose_sleep_frequency=8 torture.verbose_sleep_duration=$VERBOSE_BATCH_CPUS" --trust-make
 done
 
 if test "$do_rcuscale" = yes
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 13/18] torture: Make torture.sh refuse to do zero-length runs
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (11 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 12/18] torture: Make torture.sh throttle VERBOSE_TOROUT_*() for refscale paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 14/18] torture: Drop log.long generation from torture.sh paulmck
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit causes torture.sh to check for zero-length runs and to take
the cowardly option of refusing to run them, logging its cowardice for
later inspection.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 25 +++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index f2f9140..43ef2c0 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -151,16 +151,29 @@ do
 	shift
 done
 
-duration_rcutorture=$((duration_base*duration_rcutorture_frac/10))
-# Need to sum remaining weights, and if duration weights to zero,
-# set do_no_rcutorture. @@@
-duration_locktorture=$((duration_base*duration_locktorture_frac/10))
-duration_scftorture=$((duration_base*duration_scftorture_frac/10))
-
 T=/tmp/torture.sh.$$
 trap 'rm -rf $T' 0 2
 mkdir $T
 
+duration_rcutorture=$((duration_base*duration_rcutorture_frac/10))
+if test "$duration_rcutorture" -eq 0
+then
+	echo " --- Zero time for rcutorture, disabling" | tee -a $T/log
+	do_rcutorture=no
+fi
+duration_locktorture=$((duration_base*duration_locktorture_frac/10))
+if test "$duration_locktorture" -eq 0
+then
+	echo " --- Zero time for locktorture, disabling" | tee -a $T/log
+	do_locktorture=no
+fi
+duration_scftorture=$((duration_base*duration_scftorture_frac/10))
+if test "$duration_scftorture" -eq 0
+then
+	echo " --- Zero time for scftorture, disabling" | tee -a $T/log
+	do_scftorture=no
+fi
+
 touch $T/failures
 touch $T/successes
 
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 14/18] torture: Drop log.long generation from torture.sh
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (12 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 13/18] torture: Make torture.sh refuse to do zero-length runs paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 15/18] torture: Allow scenarios to be specified to torture.sh paulmck
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

Now that kvm.sh puts all the relevant details in the "log" file,
there is no need for torture.sh to generate a separate "log.long"
file.  This commit therefore drops this from torture.sh.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 43ef2c0..cf74123 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -203,11 +203,8 @@ function torture_one {
 	"$@" $boottag "$cur_bootargs" --datestamp "$ds/results-$curflavor" > $T/$curflavor.out 2>&1
 	retcode=$?
 	resdir="`grep '^Results directory: ' $T/$curflavor.out | tail -1 | sed -e 's/^Results directory: //'`"
-	if test -n "$resdir"
+	if test -z "$resdir"
 	then
-		cp $T/$curflavor.out $resdir/log.long
-		echo retcode=$retcode >> $resdir/log.long
-	else
 		cat $T/$curflavor.out | tee -a $T/log
 		echo retcode=$retcode | tee -a $T/log
 	fi
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 15/18] torture: Allow scenarios to be specified to torture.sh
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (13 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 14/18] torture: Drop log.long generation from torture.sh paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 16/18] torture: Add command and results directory to torture.sh log paulmck
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit adds --configs-rcutorture, --configs-locktorture, and
--configs-scftorture arguments to torture.sh, allowing the desired
set of scenarios to be passed to each.  The default for each has been
changed from a large-system-appropriate set to just CFLIST for each.
Users are encouraged to create scripts that provide appropriate settings
for their specific systems.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 46 +++++++++++++++++++++--
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index cf74123..f614011 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -30,6 +30,11 @@ then
 	VERBOSE_BATCH_CPUS=0
 fi
 
+# Configurations/scenarios.
+configs_rcutorture=
+configs_locktorture=
+configs_scftorture=
+
 # Default duration and apportionment.
 duration_base=10
 duration_rcutorture_frac=7
@@ -59,6 +64,9 @@ function doyesno () {
 
 usage () {
 	echo "Usage: $scriptname optional arguments:"
+	echo "       --configs-rcutorture \"config-file list w/ repeat factor (3*TINY01)\""
+	echo "       --configs-locktorture \"config-file list w/ repeat factor (10*LOCK01)\""
+	echo "       --configs-scftorture \"config-file list w/ repeat factor (2*CFLIST)\""
 	echo "       --doall"
 	echo "       --doallmodconfig / --do-no-allmodconfig"
 	echo "       --do-kasan / --do-no-kasan"
@@ -77,6 +85,21 @@ usage () {
 while test $# -gt 0
 do
 	case "$1" in
+	--config-rcutorture|--configs-rcutorture)
+		checkarg --configs-rcutorture "(list of config files)" "$#" "$2" '^[^/]\+$' '^--'
+		configs_rcutorture="$configs_rcutorture $2"
+		shift
+		;;
+	--config-locktorture|--configs-locktorture)
+		checkarg --configs-locktorture "(list of config files)" "$#" "$2" '^[^/]\+$' '^--'
+		configs_locktorture="$configs_locktorture $2"
+		shift
+		;;
+	--config-scftorture|--configs-scftorture)
+		checkarg --configs-scftorture "(list of config files)" "$#" "$2" '^[^/]\+$' '^--'
+		configs_scftorture="$configs_scftorture $2"
+		shift
+		;;
 	--doall)
 		do_allmodconfig=yes
 		do_rcutorture=yes
@@ -155,18 +178,35 @@ T=/tmp/torture.sh.$$
 trap 'rm -rf $T' 0 2
 mkdir $T
 
+# Calculate rcutorture defaults and apportion time
+if test -z "$configs_rcutorture"
+then
+	configs_rcutorture=CFLIST
+fi
 duration_rcutorture=$((duration_base*duration_rcutorture_frac/10))
 if test "$duration_rcutorture" -eq 0
 then
 	echo " --- Zero time for rcutorture, disabling" | tee -a $T/log
 	do_rcutorture=no
 fi
+
+# Calculate locktorture defaults and apportion time
+if test -z "$configs_locktorture"
+then
+	configs_locktorture=CFLIST
+fi
 duration_locktorture=$((duration_base*duration_locktorture_frac/10))
 if test "$duration_locktorture" -eq 0
 then
 	echo " --- Zero time for locktorture, disabling" | tee -a $T/log
 	do_locktorture=no
 fi
+
+# Calculate scftorture defaults and apportion time
+if test -z "$configs_scftorture"
+then
+	configs_scftorture=CFLIST
+fi
 duration_scftorture=$((duration_base*duration_scftorture_frac/10))
 if test "$duration_scftorture" -eq 0
 then
@@ -268,19 +308,19 @@ fi
 if test "$do_rcutorture" = "yes"
 then
 	torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000"
-	torture_set "rcutorture" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration "$duration_rcutorture" --configs "TREE10 4*CFLIST" --trust-make
+	torture_set "rcutorture" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration "$duration_rcutorture" --configs "$configs_rcutorture" --trust-make
 fi
 
 if test "$do_locktorture" = "yes"
 then
 	torture_bootargs="torture.disable_onoff_at_boot"
-	torture_set "locktorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture lock --allcpus --duration "$duration_locktorture" --configs "14*CFLIST" --trust-make
+	torture_set "locktorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture lock --allcpus --duration "$duration_locktorture" --configs "$configs_locktorture" --trust-make
 fi
 
 if test "$do_scftorture" = "yes"
 then
 	torture_bootargs="scftorture.nthreads=$HALF_ALLOTED_CPUS torture.disable_onoff_at_boot"
-	torture_set "scftorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration "$duration_scftorture" --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --trust-make
+	torture_set "scftorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration "$duration_scftorture" --configs "$configs_scftorture" --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --trust-make
 fi
 
 if test "$do_refscale" = yes
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 16/18] torture: Add command and results directory to torture.sh log
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (14 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 15/18] torture: Allow scenarios to be specified to torture.sh paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 17/18] torture: Add --kcsan-kmake-arg to torture.sh for KCSAN paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 18/18] torture: Compress KASAN vmlinux files paulmck
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit adds the command and arguments to the torture.sh log file, and
also outputs the results directory.  This latter allows impatient users
to quickly find the results that are being generated by the current run.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index f614011..90ca736 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -174,10 +174,17 @@ do
 	shift
 done
 
+ds="`date +%Y.%m.%d-%H.%M.%S`-torture"
+startdate="`date`"
+starttime="`get_starttime`"
+
 T=/tmp/torture.sh.$$
 trap 'rm -rf $T' 0 2
 mkdir $T
 
+echo " --- " $scriptname $args | tee -a $T/log
+echo " --- Results directory: " $ds | tee -a $T/log
+
 # Calculate rcutorture defaults and apportion time
 if test -z "$configs_rcutorture"
 then
@@ -217,10 +224,6 @@ fi
 touch $T/failures
 touch $T/successes
 
-ds="`date +%Y.%m.%d-%H.%M.%S`-torture"
-startdate="`date`"
-starttime="`get_starttime`"
-
 # torture_one - Does a single kvm.sh run.
 #
 # Usage:
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 17/18] torture: Add --kcsan-kmake-arg to torture.sh for KCSAN
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (15 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 16/18] torture: Add command and results directory to torture.sh log paulmck
@ 2021-01-06 17:31 ` paulmck
  2021-01-06 17:31 ` [PATCH tip/core/rcu 18/18] torture: Compress KASAN vmlinux files paulmck
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

In 2020, running KCSAN often requires careful choice of compiler.
This commit therefore adds a --kcsan-kmake-arg parameter to torture.sh
to allow specifying (for example) "CC=clang" to the kernel build process
to correctly build a KCSAN-enabled kernel.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 90ca736..0867f30 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -34,6 +34,7 @@ fi
 configs_rcutorture=
 configs_locktorture=
 configs_scftorture=
+kcsan_kmake_args=
 
 # Default duration and apportionment.
 duration_base=10
@@ -79,6 +80,7 @@ usage () {
 	echo "       --do-refscale / --do-no-refscale"
 	echo "       --do-scftorture / --do-no-scftorture"
 	echo "       --duration [ <minutes> | <hours>h | <days>d ]"
+	echo "       --kcsan-kmake-arg kernel-make-arguments"
 	exit 1
 }
 
@@ -166,6 +168,11 @@ do
 		duration_base=$(($ts*mult))
 		shift
 		;;
+	--kcsan-kmake-arg|--kcsan-kmake-args)
+		checkarg --kcsan-kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
+		kcsan_kmake_args="`echo "$kcsan_kmake_args $2" | sed -e 's/^ *//' -e 's/ *$//'`"
+		shift
+		;;
 	*)
 		echo Unknown argument $1
 		usage
@@ -269,6 +276,8 @@ function torture_one {
 # Note that quoting is problematic.  So on the command line, pass multiple
 # values with multiple kvm.sh argument instances.
 function torture_set {
+	local cur_kcsan_kmake_args=
+	local kcsan_kmake_tag=
 	local flavor=$1
 	shift
 	curflavor=$flavor
@@ -281,7 +290,12 @@ function torture_set {
 	if test "$do_kcsan" = "yes"
 	then
 		curflavor=${flavor}-kcsan
-		torture_one $* --kconfig "CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y" --kmake-arg "CC=clang" --kcsan
+		if test -n "$kcsan_kmake_args"
+		then
+			kcsan_kmake_tag="--kmake-args"
+			cur_kcsan_kmake_args="$kcsan_kmake_args"
+		fi
+		torture_one $* --kconfig "CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y" $kcsan_kmake_tag $cur_kcsan_kmake_args --kcsan
 	fi
 }
 
@@ -382,8 +396,3 @@ then
 	cp $T/log $tdir
 fi
 exit $ret
-
-# @@@
-# Need a way for the invoker to specify clang.  Maybe --kcsan-kmake or some such.
-# --kconfig as with --bootargs (Both have overrides.)
-# Command line parameters for --bootargs, --config, --kconfig, --kmake-arg, and --qemu-arg
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH tip/core/rcu 18/18] torture: Compress KASAN vmlinux files
  2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
                   ` (16 preceding siblings ...)
  2021-01-06 17:31 ` [PATCH tip/core/rcu 17/18] torture: Add --kcsan-kmake-arg to torture.sh for KCSAN paulmck
@ 2021-01-06 17:31 ` paulmck
  17 siblings, 0 replies; 19+ messages in thread
From: paulmck @ 2021-01-06 17:31 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, mingo, jiangshanlai, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

The sizes of vmlinux files built with KASAN enabled can approach a full
gigabyte, which can result in disk overflow sooner rather than later.
Fortunately, the xz command compresses them by almost an order of
magnitude.  This commit therefore uses xz to compress vmlinux file built
by torture.sh with KASAN enabled.

However, xz is not the fastest thing in the world.  In fact, it is way
slower than rotating-rust mass storage.  This commit therefore also adds a
--compress-kasan-vmlinux argument to specify the degree of xz concurrency,
which defaults to using all available CPUs if there are that many files in
need of compression.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 48 ++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 0867f30..ad7525b 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -36,7 +36,8 @@ configs_locktorture=
 configs_scftorture=
 kcsan_kmake_args=
 
-# Default duration and apportionment.
+# Default compression, duration, and apportionment.
+compress_kasan_vmlinux="`identify_qemu_vcpus`"
 duration_base=10
 duration_rcutorture_frac=7
 duration_locktorture_frac=1
@@ -65,6 +66,7 @@ function doyesno () {
 
 usage () {
 	echo "Usage: $scriptname optional arguments:"
+	echo "       --compress-kasan-vmlinux concurrency"
 	echo "       --configs-rcutorture \"config-file list w/ repeat factor (3*TINY01)\""
 	echo "       --configs-locktorture \"config-file list w/ repeat factor (10*LOCK01)\""
 	echo "       --configs-scftorture \"config-file list w/ repeat factor (2*CFLIST)\""
@@ -87,6 +89,11 @@ usage () {
 while test $# -gt 0
 do
 	case "$1" in
+	--compress-kasan-vmlinux)
+		checkarg --compress-kasan-vmlinux "(concurrency level)" $# "$2" '^[0-9][0-9]*$' '^error'
+		compress_kasan_vmlinux=$2
+		shift
+		;;
 	--config-rcutorture|--configs-rcutorture)
 		checkarg --configs-rcutorture "(list of config files)" "$#" "$2" '^[^/]\+$' '^--'
 		configs_rcutorture="$configs_rcutorture $2"
@@ -391,8 +398,45 @@ fi
 echo Started at $startdate, ended at `date`, duration `get_starttime_duration $starttime`. | tee -a $T/log
 echo Summary: Successes: $nsuccesses Failures: $nfailures. | tee -a $T/log
 tdir="`cat $T/successes $T/failures | head -1 | awk '{ print $NF }' | sed -e 's,/[^/]\+/*$,,'`"
+if test -n "$tdir" && test $compress_kasan_vmlinux -gt 0
+then
+	# KASAN vmlinux files can approach 1GB in size, so compress them.
+	echo Looking for KASAN files to compress: `date` > "$tdir/log-xz" 2>&1
+	find "$tdir" -type d -name '*-kasan' -print > $T/xz-todo
+	ncompresses=0
+	batchno=1
+	if test -s $T/xz-todo
+	then
+		echo Size before compressing: `du -sh $tdir | awk '{ print $1 }'` `date` 2>&1 | tee -a "$tdir/log-xz" | tee -a $T/log
+		for i in `cat $T/xz-todo`
+		do
+			echo Compressing vmlinux files in ${i}: `date` >> "$tdir/log-xz" 2>&1
+			for j in $i/*/vmlinux
+			do
+				xz "$j" >> "$tdir/log-xz" 2>&1 &
+				ncompresses=$((ncompresses+1))
+				if test $ncompresses -ge $compress_kasan_vmlinux
+				then
+					echo Waiting for batch $batchno of $ncompresses compressions `date` | tee -a "$tdir/log-xz" | tee -a $T/log
+					wait
+					ncompresses=0
+					batchno=$((batchno+1))
+				fi
+			done
+		done
+		if test $ncompresses -gt 0
+		then
+			echo Waiting for final batch $batchno of $ncompresses compressions `date` | tee -a "$tdir/log-xz" | tee -a $T/log
+		fi
+		wait
+		echo Size after compressing: `du -sh $tdir | awk '{ print $1 }'` `date` 2>&1 | tee -a "$tdir/log-xz" | tee -a $T/log
+		echo Total duration `get_starttime_duration $starttime`. | tee -a $T/log
+	else
+		echo No compression needed: `date` >> "$tdir/log-xz" 2>&1
+	fi
+fi
 if test -n "$tdir"
 then
-	cp $T/log $tdir
+	cp $T/log "$tdir"
 fi
 exit $ret
-- 
2.9.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, back to index

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 17:30 [PATCH tip/core/rcu 0/18] Add a torture-all acceptance-test script for v5.12 Paul E. McKenney
2021-01-06 17:31 ` [PATCH tip/core/rcu 01/18] torture: Do Kconfig analysis only once per scenario paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 02/18] torture: Add torture.sh torture-everything script paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 03/18] torture: Make torture.sh use common time-duration bash functions paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 04/18] torture: Remove use of "eval" in torture.sh paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 05/18] torture: Add "make allmodconfig" to torture.sh paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 06/18] torture: Auto-size SCF and scaling runs based on number of CPUs paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 07/18] torture: Enable torture.sh argument checking paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 08/18] torture: Make torture.sh rcuscale and refscale deal with allmodconfig paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 09/18] torture: Make torture.sh refscale runs use verbose_batched module parameter paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 10/18] torture: Create doyesno helper function for torture.sh paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 11/18] torture: Make torture.sh allmodconfig retain and label output paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 12/18] torture: Make torture.sh throttle VERBOSE_TOROUT_*() for refscale paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 13/18] torture: Make torture.sh refuse to do zero-length runs paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 14/18] torture: Drop log.long generation from torture.sh paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 15/18] torture: Allow scenarios to be specified to torture.sh paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 16/18] torture: Add command and results directory to torture.sh log paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 17/18] torture: Add --kcsan-kmake-arg to torture.sh for KCSAN paulmck
2021-01-06 17:31 ` [PATCH tip/core/rcu 18/18] torture: Compress KASAN vmlinux files paulmck

RCU Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/rcu/0 rcu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 rcu rcu/ https://lore.kernel.org/rcu \
		rcu@vger.kernel.org
	public-inbox-index rcu

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.rcu


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git