Skip to contentSkip to conversation

Pre-gp_seq torture-test changes for v4.19

PATCH New Paul E. McKenney 1 participant 6 messages Jun 25, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Pre-gp_seq torture-test changes for v4.19

Hello!

The following changes to torture-testing come before the infamous ->gp_seq conversion:

1. Use a single build directory for torture scenarios (currently
there is one directory for each build within a given batch, which makes no sense given that all of these builds are serialized).

2. Remove obsolete TREE08-T.boot file. Use of the shiny new
"--bootargs rcutree.rcu_fanout_exact=1" makes use of a separate file unnecesary.

3. Make kvm-find-errors.sh find close calls as well as the usual
hard errors.

4. Make online/offline messages appear only for verbose=2. This
change is necessitated by the ability to make CPU-hotplug operations happen much more frequently than in the past.

5. Keep old-school dmesg format while Joe Perches is changing the
default format. Later, rcutorture can move to the new format and at the same time update the analysis scripts. (As opposed to having the analysis scripts just suddenly break when Joe's changes hit mainline.)

Thanx, Paul

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

 b/include/linux/torture.h                                    |    2 
 b/kernel/locking/locktorture.c                               |    5 +-
 b/kernel/rcu/rcuperf.c                                       |    5 +-
 b/kernel/rcu/rcutorture.c                                    |    5 +-
 b/kernel/torture.c                                           |   15 +++---
 b/tools/testing/selftests/rcutorture/bin/configinit.sh       |   26 +++++------
 b/tools/testing/selftests/rcutorture/bin/kvm-build.sh        |   11 ++--
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh  |    1 
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh      |    1 
 b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh   |    5 +-
 b/tools/testing/selftests/rcutorture/bin/kvm.sh              |    2 
 b/tools/testing/selftests/rcutorture/bin/parse-console.sh    |    7 ++
 tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot |    1 
 13 files changed, 53 insertions(+), 33 deletions(-)
#1 lore raw

PATCH 1/5 torture: Use a single build directory for torture scenarios

The torture scripting currently builds each kernel from a set of parallel runs in its own build directory. This can waste quite a bit of space when running large numbers of concurrent scenarios, and pointlessly given that the builds are run sequentially (albeit with a largish -j number passed to "make"). This commit therefore places all build-command output in the results directory, then does all builds in a single "b1" build directory.

---
 .../selftests/rcutorture/bin/configinit.sh    | 26 +++++++++----------
 .../selftests/rcutorture/bin/kvm-build.sh     | 11 ++++----
 .../rcutorture/bin/kvm-test-1-run.sh          |  5 ++--
 tools/testing/selftests/rcutorture/bin/kvm.sh |  2 +-
 4 files changed, 22 insertions(+), 22 deletions(-)
tools/testing/selftests/rcutorture/bin/configinit.sh +12 -14
index c15f270e121d..65541c21a544 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Usage: configinit.sh config-spec-file [ build output dir ]
+# Usage: configinit.sh config-spec-file build-output-dir results-dir
 #
 # Create a .config file from the spec file.  Run from the kernel source tree.
 # Exits with 0 if all went well, with 1 if all went well but the config
@@ -40,20 +40,18 @@ mkdir $T
 
 c=$1
 buildloc=$2
+resdir=$3
 builddir=
-if test -n $buildloc
+if echo $buildloc | grep -q '^O='
 then
-	if echo $buildloc | grep -q '^O='
+	builddir=`echo $buildloc | sed -e 's/^O=//'`
+	if test ! -d $builddir
 	then
-		builddir=`echo $buildloc | sed -e 's/^O=//'`
-		if test ! -d $builddir
-		then
-			mkdir $builddir
-		fi
-	else
-		echo Bad build directory: \"$buildloc\"
-		exit 2
+		mkdir $builddir
 	fi
+else
+	echo Bad build directory: \"$buildloc\"
+	exit 2
 fi
 
 sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh
@@ -61,12 +59,12 @@ sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh
 grep '^grep' < $T/u.sh > $T/upd.sh
 echo "cat - $c" >> $T/upd.sh
 make mrproper
-make $buildloc distclean > $builddir/Make.distclean 2>&1
-make $buildloc $TORTURE_DEFCONFIG > $builddir/Make.defconfig.out 2>&1
+make $buildloc distclean > $resdir/Make.distclean 2>&1
+make $buildloc $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1
 mv $builddir/.config $builddir/.config.sav
 sh $T/upd.sh < $builddir/.config.sav > $builddir/.config
 cp $builddir/.config $builddir/.config.new
-yes '' | make $buildloc oldconfig > $builddir/Make.oldconfig.out 2> $builddir/Make.oldconfig.err
+yes '' | make $buildloc oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err
 
 # verify new config matches specification.
 configcheck.sh $builddir/.config $c
tools/testing/selftests/rcutorture/bin/kvm-build.sh +6 -5
index 34d126734cde..9115fcdb5617 100755
@@ -2,7 +2,7 @@
 #
 # Build a kvm-ready Linux kernel from the tree in the current directory.
 #
-# Usage: kvm-build.sh config-template build-dir
+# Usage: kvm-build.sh config-template build-dir resdir
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ then
 	exit 1
 fi
 builddir=${2}
+resdir=${3}
 
 T=${TMPDIR-/tmp}/test-linux.sh.$$
 trap 'rm -rf $T' 0
@@ -41,19 +42,19 @@ CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_CONSOLE=y
 ___EOF___
 
-configinit.sh $T/config O=$builddir
+configinit.sh $T/config O=$builddir $resdir
 retval=$?
 if test $retval -gt 1
 then
 	exit 2
 fi
 ncpus=`cpus2use.sh`
-make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $builddir/Make.out 2>&1
+make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1
 retval=$?
-if test $retval -ne 0 || grep "rcu[^/]*": < $builddir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $builddir/Make.out
+if test $retval -ne 0 || grep "rcu[^/]*": < $resdir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $resdir/Make.out
 then
 	echo Kernel build error
-	egrep "Stop|Error|error:|warning:" < $builddir/Make.out
+	egrep "Stop|Error|error:|warning:" < $resdir/Make.out
 	echo Run aborted.
 	exit 3
 fi
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +3 -2
index c5b0f94341d9..f7247ee00514 100755
@@ -98,14 +98,15 @@ then
 	ln -s $base_resdir/.config $resdir  # for kvm-recheck.sh
 	# Arch-independent indicator
 	touch $resdir/builtkernel
-elif kvm-build.sh $T/Kc2 $builddir
+elif kvm-build.sh $T/Kc2 $builddir $resdir
 then
 	# Had to build a kernel for this test.
 	QEMU="`identify_qemu $builddir/vmlinux`"
 	BOOT_IMAGE="`identify_boot_image $QEMU`"
-	cp $builddir/Make*.out $resdir
 	cp $builddir/vmlinux $resdir
 	cp $builddir/.config $resdir
+	cp $builddir/Module.symvers $resdir > /dev/null || :
+	cp $builddir/System.map $resdir > /dev/null || :
 	if test -n "$BOOT_IMAGE"
 	then
 		cp $builddir/$BOOT_IMAGE $resdir
tools/testing/selftests/rcutorture/bin/kvm.sh +1 -1
index 56610dbbdf73..5a7a62d76a50 100755
@@ -347,7 +347,7 @@ function dump(first, pastlast, batchnum)
 	print "needqemurun="
 	jn=1
 	for (j = first; j < pastlast; j++) {
-		builddir=KVM "/b" jn
+		builddir=KVM "/b1"
 		cpusr[jn] = cpus[j];
 		if (cfrep[cf[j]] == "") {
 			cfr[jn] = cf[j];
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 rcutorture: Remove obsolete TREE08-T.boot file

In reply to Paul E. McKenney

The TREE08-T.boot file was used to provide alternative options for debugging, but things have changed, it has not kept up, and it has not been used or missed. This commit therefore removes it.

---
 tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot | 1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot
tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot deleted +0 -1
deleted file mode 100644
index 883149b5f2d1..000000000000
@@ -1 +0,0 @@
-rcutree.rcu_fanout_exact=1
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/5 rcutorture: Make kvm-find-errors.sh find close calls

In reply to Paul E. McKenney

Although warnings about close calls are printed by kvm-recheck.sh, kvm-find-errors.sh currently ignores them. This could easily result in someone failing to investigate close calls, so this commit makes them visible to kvm-find-errors.sh.

---
 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh | 1 +
 tools/testing/selftests/rcutorture/bin/kvm-recheck.sh     | 1 +
 tools/testing/selftests/rcutorture/bin/parse-console.sh   | 7 +++++++
 3 files changed, 9 insertions(+)
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh +1 -0
index 477ecb1293ab..0fa8a61ccb7b 100755
@@ -70,4 +70,5 @@ else
 	else
 		print_warning $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i
 	fi
+	echo $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i > $i/console.log.rcu.diags
 fi
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +1 -0
index c27e97824163..c9bab57a77eb 100755
@@ -39,6 +39,7 @@ do
 			head -1 $resdir/log
 		fi
 		TORTURE_SUITE="`cat $i/../TORTURE_SUITE`"
+		rm -f $i/console.log.*.diags
 		kvm-recheck-${TORTURE_SUITE}.sh $i
 		if test -f "$i/console.log"
 		then
tools/testing/selftests/rcutorture/bin/parse-console.sh +7 -0
index 17293436f551..84933f6aed77 100755
@@ -163,6 +163,13 @@ then
 	print_warning Summary: $summary
 	cat $T.diags >> $file.diags
 fi
+for i in $file.*.diags
+do
+	if test -f "$i"
+	then
+		cat $i >> $file.diags
+	fi
+done
 if ! test -s $file.diags
 then
 	rm -f $file.diags
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/5 torture: Make online/offline messages appear only for verbose=2

In reply to Paul E. McKenney

Some bugs reproduce quickly only at high CPU-hotplug rates, so the rcutorture TREE03 scenario now has only 200 milliseconds spacing between CPU-hotplug operations. At this rate, the torture-test pair of console messages per operation becomes a bit voluminous. This commit therefore converts the torture-test set of "verbose" kernel-boot arguments from bool to int, and prints the extra console messages only when verbose=2. The default is still verbose=1.

---
 include/linux/torture.h      |  2 +-
 kernel/locking/locktorture.c |  2 +-
 kernel/rcu/rcuperf.c         |  2 +-
 kernel/rcu/rcutorture.c      |  2 +-
 kernel/torture.c             | 12 ++++++------
 5 files changed, 10 insertions(+), 10 deletions(-)
include/linux/torture.h +1 -1
index 66272862070b..a55e80817dae 100644
@@ -79,7 +79,7 @@ void stutter_wait(const char *title);
 int torture_stutter_init(int s);
 
 /* Initialization and cleanup. */
-bool torture_init_begin(char *ttype, bool v);
+bool torture_init_begin(char *ttype, int v);
 void torture_init_end(void);
 bool torture_cleanup_begin(void);
 void torture_cleanup_end(void);
kernel/locking/locktorture.c +1 -1
index 8402b3349dca..4a2e13870a9b 100644
@@ -57,7 +57,7 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (j), <= zero to disable.");
 torture_param(int, stat_interval, 60,
 	     "Number of seconds between stats printk()s");
 torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable");
-torture_param(bool, verbose, true,
+torture_param(int, verbose, 1,
 	     "Enable verbose debugging printk()s");
 
 static char *torture_type = "spin_lock";
kernel/rcu/rcuperf.c +1 -1
index e232846516b3..fb8094848906 100644
@@ -88,7 +88,7 @@ torture_param(int, nreaders, -1, "Number of RCU reader threads");
 torture_param(int, nwriters, -1, "Number of RCU updater threads");
 torture_param(bool, shutdown, !IS_ENABLED(MODULE),
 	      "Shutdown at end of performance tests.");
-torture_param(bool, verbose, true, "Enable verbose debugging printk()s");
+torture_param(int, verbose, 1, "Enable verbose debugging printk()s");
 torture_param(int, writer_holdoff, 0, "Holdoff (us) between GPs, zero to disable");
 
 static char *perf_type = "rcu";
kernel/rcu/rcutorture.c +1 -1
index 42fcb7f05fac..a5540bd831c4 100644
@@ -101,7 +101,7 @@ torture_param(int, test_boost_interval, 7,
 	     "Interval between boost tests, seconds.");
 torture_param(bool, test_no_idle_hz, true,
 	     "Test support for tickless idle CPUs");
-torture_param(bool, verbose, true,
+torture_param(int, verbose, 1,
 	     "Enable verbose debugging printk()s");
 
 static char *torture_type = "rcu";
kernel/torture.c +6 -6
index 3de1efbecd6a..840fd33c1cda 100644
@@ -53,7 +53,7 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Paul E. McKenney <[email protected]>");
 
 static char *torture_type;
-static bool verbose;
+static int verbose;
 
 /* Mediate rmmod and system shutdown.  Concurrent rmmod & shutdown illegal! */
 #define FULLSTOP_DONTSTOP 0	/* Normal operation. */
@@ -98,7 +98,7 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,
 	if (!cpu_online(cpu) || !cpu_is_hotpluggable(cpu))
 		return false;
 
-	if (verbose)
+	if (verbose > 1)
 		pr_alert("%s" TORTURE_FLAG
 			 "torture_onoff task: offlining %d\n",
 			 torture_type, cpu);
@@ -111,7 +111,7 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,
 				 "torture_onoff task: offline %d failed: errno %d\n",
 				 torture_type, cpu, ret);
 	} else {
-		if (verbose)
+		if (verbose > 1)
 			pr_alert("%s" TORTURE_FLAG
 				 "torture_onoff task: offlined %d\n",
 				 torture_type, cpu);
@@ -147,7 +147,7 @@ bool torture_online(int cpu, long *n_onl_attempts, long *n_onl_successes,
 	if (cpu_online(cpu) || !cpu_is_hotpluggable(cpu))
 		return false;
 
-	if (verbose)
+	if (verbose > 1)
 		pr_alert("%s" TORTURE_FLAG
 			 "torture_onoff task: onlining %d\n",
 			 torture_type, cpu);
@@ -160,7 +160,7 @@ bool torture_online(int cpu, long *n_onl_attempts, long *n_onl_successes,
 				 "torture_onoff task: online %d failed: errno %d\n",
 				 torture_type, cpu, ret);
 	} else {
-		if (verbose)
+		if (verbose > 1)
 			pr_alert("%s" TORTURE_FLAG
 				 "torture_onoff task: onlined %d\n",
 				 torture_type, cpu);
@@ -647,7 +647,7 @@ static void torture_stutter_cleanup(void)
  * The runnable parameter points to a flag that controls whether or not
  * the test is currently runnable.  If there is no such flag, pass in NULL.
  */
-bool torture_init_begin(char *ttype, bool v)
+bool torture_init_begin(char *ttype, int v)
 {
 	mutex_lock(&fullstop_mutex);
 	if (torture_type != NULL) {
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/5 torture: Keep old-school dmesg format

In reply to Paul E. McKenney

This commit adds "#define pr_fmt(fmt) fmt" to the torture-test files in order to keep the current dmesg format. Once Joe's commits have hit mainline, these definitions will be changed in order to automatically generate the dmesg line prefix that the scripts expect. This will have the beneficial side-effect of allowing printk() formats to be used more widely and of shortening some pr_*() lines.

---
 kernel/locking/locktorture.c | 3 +++
 kernel/rcu/rcuperf.c         | 3 +++
 kernel/rcu/rcutorture.c      | 3 +++
 kernel/torture.c             | 3 +++
 4 files changed, 12 insertions(+)
kernel/locking/locktorture.c +3 -0
index 4a2e13870a9b..57bef4fbfb31 100644
@@ -21,6 +21,9 @@
  *          Davidlohr Bueso <[email protected]>
  *	Based on kernel/rcu/torture.c.
  */
+
+#define pr_fmt(fmt) fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
kernel/rcu/rcuperf.c +3 -0
index fb8094848906..df29119b2013 100644
@@ -19,6 +19,9 @@
  *
  * Authors: Paul E. McKenney <[email protected]>
  */
+
+#define pr_fmt(fmt) fmt
+
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
kernel/rcu/rcutorture.c +3 -0
index a5540bd831c4..5604bfac8df4 100644
@@ -22,6 +22,9 @@
  *
  * See also:  Documentation/RCU/torture.txt
  */
+
+#define pr_fmt(fmt) fmt
+
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
kernel/torture.c +3 -0
index 840fd33c1cda..1ac24a826589 100644
@@ -20,6 +20,9 @@
  * Author: Paul E. McKenney <[email protected]>
  *	Based on kernel/rcu/torture.c.
  */
+
+#define pr_fmt(fmt) fmt
+
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
Signature · 1 line
2.17.1