Skip to contentSkip to conversation

Torture-test changes for 3.18

PATCH In review Paul E. McKenney 2 participants 13 messages Aug 28, 2014 – Sep 7, 2014

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

cover Torture-test changes for 3.18

Hello!

This series contains torture-test updates:

1. Fix sparse warning by making boost_mutex static, courtesy of
Pranith Kumar.

2. Use bash shell for all torture test scripts, courtesy of Pranith
Kumar.

3. Set executable flags on scripts and invoke by name, courtesy
of Pranith Kumar.

4. Add "cd" step to initrd documentation.

5. Test partial nohz_full= configuration to increased test coverage.

6. Specify MAXSMP=y for TREE01 to increase test coverage.

7. Specify CONFIG_CPUMASK_OFFSTACK=y for TREE07 to increase test
coverage.

8. Use pr_alert/pr_cont when printing to avoid large buffers,
courtesy of Joe Perches.

9. Add a callback-flood test to increase test coverage.

10. Print PID in hung-kernel diagnostic message.

11. Check for nul bytes in console output.

Thanx, Paul

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

 b/Documentation/kernel-parameters.txt                        |   18 
 b/include/linux/torture.h                                    |    2 
 b/kernel/rcu/rcutorture.c                                    |  215 +++++++----
 b/kernel/torture.c                                           |   16 
 b/tools/testing/selftests/rcutorture/bin/config2frag.sh      |    6 
 b/tools/testing/selftests/rcutorture/bin/configcheck.sh      |    6 
 b/tools/testing/selftests/rcutorture/bin/configinit.sh       |    6 
 b/tools/testing/selftests/rcutorture/bin/functions.sh        |   20 +
 b/tools/testing/selftests/rcutorture/bin/kvm-build.sh        |    4 
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck-lock.sh |    4 
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh  |    4 
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh      |    4 
 b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh   |    7 
 b/tools/testing/selftests/rcutorture/bin/kvm.sh              |    8 
 b/tools/testing/selftests/rcutorture/bin/parse-build.sh      |    7 
 b/tools/testing/selftests/rcutorture/bin/parse-console.sh    |   11 
 b/tools/testing/selftests/rcutorture/bin/parse-torture.sh    |    7 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE01      |    4 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE07      |    3 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE07.boot |    1 
 b/tools/testing/selftests/rcutorture/doc/initrd.txt          |    1 
 22 files changed, 233 insertions(+), 123 deletions(-)
#1 lore raw

PATCH 1/11 rcutorture: Fix a sparse warning by marking boost_mutex static

From: Pranith Kumar <[email protected]>

This commit fixes the following sparse warning by marking boost_mutex static:

kernel/rcu/rcutorture.c:185:1: warning: symbol 'boost_mutex' was not declared. Should it be static?

---
 kernel/rcu/rcutorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/rcutorture.c +1 -1
index 948a7693748e..7e67711cbae8 100644
@@ -182,7 +182,7 @@ static u64 notrace rcu_trace_clock_local(void)
 #endif /* #else #ifdef CONFIG_RCU_TRACE */
 
 static unsigned long boost_starttime;	/* jiffies of next boost test start. */
-DEFINE_MUTEX(boost_mutex);		/* protect setting boost_starttime */
+static DEFINE_MUTEX(boost_mutex);	/* protect setting boost_starttime */
 					/*  and boost task create/destroy. */
 static atomic_t barrier_cbs_count;	/* Barrier callbacks registered. */
 static bool barrier_phase;		/* Test phase. */
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 2/11 rcutorture: Use bash shell for all the test scripts

From: Pranith Kumar <[email protected]>

Some of the scripts encode a default /bin/sh shell. On systems which use dash as default shell, these scripts fail as they are bash scripts. I encountered this while testing the sprintf() changes on a Debian system where dash is the default shell.

This commit changes all such uses to use bash explicitly.

---
 tools/testing/selftests/rcutorture/bin/config2frag.sh      | 4 ++--
 tools/testing/selftests/rcutorture/bin/configcheck.sh      | 4 ++--
 tools/testing/selftests/rcutorture/bin/configinit.sh       | 4 ++--
 tools/testing/selftests/rcutorture/bin/kvm-build.sh        | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-recheck-lock.sh | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh  | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-recheck.sh      | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh   | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm.sh              | 2 +-
 tools/testing/selftests/rcutorture/bin/parse-build.sh      | 4 ++--
 tools/testing/selftests/rcutorture/bin/parse-console.sh    | 4 ++--
 tools/testing/selftests/rcutorture/bin/parse-torture.sh    | 4 ++--
 12 files changed, 18 insertions(+), 18 deletions(-)
tools/testing/selftests/rcutorture/bin/config2frag.sh +2 -2
index 9f9ffcd427d3..4e394efe3c92 100644
@@ -1,5 +1,5 @@
-#!/bin/sh
-# Usage: sh config2frag.sh < .config > configfrag
+#!/bin/bash
+# Usage: bash config2frag.sh < .config > configfrag
 #
 # Converts the "# CONFIG_XXX is not set" to "CONFIG_XXX=n" so that the
 # resulting file becomes a legitimate Kconfig fragment.
tools/testing/selftests/rcutorture/bin/configcheck.sh +2 -2
index d686537dd55c..6173ed5ec684 100755
@@ -1,5 +1,5 @@
-#!/bin/sh
-# Usage: sh configcheck.sh .config .config-template
+#!/bin/bash
+# Usage: bash configcheck.sh .config .config-template
 #
 # 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
tools/testing/selftests/rcutorture/bin/configinit.sh +2 -2
index 9c3f3d39b934..d8f74185be02 100755
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
 #
-# sh configinit.sh config-spec-file [ build output dir ]
+# bash configinit.sh config-spec-file [ build output 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
tools/testing/selftests/rcutorture/bin/kvm-build.sh +1 -1
index 7c1e56b46de4..e4bfb91abee5 100755
@@ -2,7 +2,7 @@
 #
 # Build a kvm-ready Linux kernel from the tree in the current directory.
 #
-# Usage: sh kvm-build.sh config-template build-dir more-configs
+# Usage: bash kvm-build.sh config-template build-dir more-configs
 #
 # 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
tools/testing/selftests/rcutorture/bin/kvm-recheck-lock.sh +1 -1
index 7f1ff1a8fc4b..30cbb63e2c3f 100755
@@ -2,7 +2,7 @@
 #
 # Analyze a given results directory for locktorture progress.
 #
-# Usage: sh kvm-recheck-lock.sh resdir
+# Usage: bash kvm-recheck-lock.sh 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
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh +1 -1
index 307c4b95f325..6e94a5e4605d 100755
@@ -2,7 +2,7 @@
 #
 # Analyze a given results directory for rcutorture progress.
 #
-# Usage: sh kvm-recheck-rcu.sh resdir
+# Usage: bash kvm-recheck-rcu.sh 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
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +1 -1
index 3f6c9b78d177..3482b3fc34e9 100755
@@ -4,7 +4,7 @@
 # check the build and console output for errors.  Given a directory
 # containing results directories, this recursively checks them all.
 #
-# Usage: sh kvm-recheck.sh resdir ...
+# Usage: bash kvm-recheck.sh 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
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1 -1
index 0f69dcbf9def..5c265da529f6 100755
@@ -6,7 +6,7 @@
 # Execute this in the source tree.  Do not run it as a background task
 # because qemu does not seem to like that much.
 #
-# Usage: sh kvm-test-1-run.sh config builddir resdir minutes qemu-args boot_args
+# Usage: bash kvm-test-1-run.sh config builddir resdir minutes qemu-args boot_args
 #
 # qemu-args defaults to "-nographic", along with arguments specifying the
 #			number of CPUs and other options generated from
tools/testing/selftests/rcutorture/bin/kvm.sh +1 -1
index 589e9c38413b..ff147ade194f 100644
@@ -7,7 +7,7 @@
 # Edit the definitions below to set the locations of the various directories,
 # as well as the test duration.
 #
-# Usage: sh kvm.sh [ options ]
+# Usage: bash kvm.sh [ options ]
 #
 # 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
tools/testing/selftests/rcutorture/bin/parse-build.sh +2 -2
index 543230951c38..41eeeefd8a5c 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Check the build output from an rcutorture run for goodness.
 # The "file" is a pathname on the local system, and "title" is
@@ -7,7 +7,7 @@
 # The file must contain kernel build output.
 #
 # Usage:
-#	sh parse-build.sh file title
+#	bash parse-build.sh file title
 #
 # 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
tools/testing/selftests/rcutorture/bin/parse-console.sh +2 -2
index 4185d4cab32e..2517eaed8991 100755
@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Check the console output from an rcutorture run for oopses.
 # The "file" is a pathname on the local system, and "title" is
 # a text string for error-message purposes.
 #
 # Usage:
-#	sh parse-console.sh file title
+#	bash parse-console.sh file title
 #
 # 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
tools/testing/selftests/rcutorture/bin/parse-torture.sh +2 -2
index 3455560ab4e4..bbec40b487e9 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Check the console output from a torture run for goodness.
 # The "file" is a pathname on the local system, and "title" is
@@ -8,7 +8,7 @@
 # with other dmesg text, as in console-log output.
 #
 # Usage:
-#	sh parse-torture.sh file title
+#	bash parse-torture.sh file title
 #
 # 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
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 3/11 rcutorture: Set executable bit and drop bash from Usage

In reply to Paul E. McKenney

From: Pranith Kumar <[email protected]>

This commit sets the executable bit on test scripts config2frag.sh and kvm.sh. Since #!/bin/bash is set in all the scripts, this commit also drops it from all usage lines because the scripts can now all be invoked directly.

---
 tools/testing/selftests/rcutorture/bin/config2frag.sh      | 2 +-
 tools/testing/selftests/rcutorture/bin/configcheck.sh      | 2 +-
 tools/testing/selftests/rcutorture/bin/configinit.sh       | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-build.sh        | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-recheck-lock.sh | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh  | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-recheck.sh      | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh   | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm.sh              | 2 +-
 tools/testing/selftests/rcutorture/bin/parse-build.sh      | 3 +--
 tools/testing/selftests/rcutorture/bin/parse-console.sh    | 3 +--
 tools/testing/selftests/rcutorture/bin/parse-torture.sh    | 3 +--
 12 files changed, 12 insertions(+), 15 deletions(-)
 mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/config2frag.sh
 mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/kvm.sh
tools/testing/selftests/rcutorture/bin/config2frag.sh +1 -1
old mode 100644
new mode 100755
index 4e394efe3c92..56f51ae13d73
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Usage: bash config2frag.sh < .config > configfrag
+# Usage: config2frag.sh < .config > configfrag
 #
 # Converts the "# CONFIG_XXX is not set" to "CONFIG_XXX=n" so that the
 # resulting file becomes a legitimate Kconfig fragment.
tools/testing/selftests/rcutorture/bin/configcheck.sh +1 -1
index 6173ed5ec684..eee31e261bf7 100755
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Usage: bash configcheck.sh .config .config-template
+# Usage: configcheck.sh .config .config-template
 #
 # 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
tools/testing/selftests/rcutorture/bin/configinit.sh +1 -1
index d8f74185be02..15f1a17ca96e 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# bash configinit.sh config-spec-file [ build output dir ]
+# Usage: configinit.sh config-spec-file [ build output 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
tools/testing/selftests/rcutorture/bin/kvm-build.sh +1 -1
index e4bfb91abee5..00cb0db2643d 100755
@@ -2,7 +2,7 @@
 #
 # Build a kvm-ready Linux kernel from the tree in the current directory.
 #
-# Usage: bash kvm-build.sh config-template build-dir more-configs
+# Usage: kvm-build.sh config-template build-dir more-configs
 #
 # 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
tools/testing/selftests/rcutorture/bin/kvm-recheck-lock.sh +1 -1
index 30cbb63e2c3f..43f764098e50 100755
@@ -2,7 +2,7 @@
 #
 # Analyze a given results directory for locktorture progress.
 #
-# Usage: bash kvm-recheck-lock.sh resdir
+# Usage: kvm-recheck-lock.sh 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
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh +1 -1
index 6e94a5e4605d..d6cc07fc137f 100755
@@ -2,7 +2,7 @@
 #
 # Analyze a given results directory for rcutorture progress.
 #
-# Usage: bash kvm-recheck-rcu.sh resdir
+# Usage: kvm-recheck-rcu.sh 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
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +1 -1
index 3482b3fc34e9..4f5b20f367a9 100755
@@ -4,7 +4,7 @@
 # check the build and console output for errors.  Given a directory
 # containing results directories, this recursively checks them all.
 #
-# Usage: bash kvm-recheck.sh resdir ...
+# Usage: kvm-recheck.sh 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
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1 -1
index 5c265da529f6..6d2f5fa48484 100755
@@ -6,7 +6,7 @@
 # Execute this in the source tree.  Do not run it as a background task
 # because qemu does not seem to like that much.
 #
-# Usage: bash kvm-test-1-run.sh config builddir resdir minutes qemu-args boot_args
+# Usage: kvm-test-1-run.sh config builddir resdir minutes qemu-args boot_args
 #
 # qemu-args defaults to "-nographic", along with arguments specifying the
 #			number of CPUs and other options generated from
tools/testing/selftests/rcutorture/bin/kvm.sh +1 -1
old mode 100644
new mode 100755
index ff147ade194f..36534f9938ca
@@ -7,7 +7,7 @@
 # Edit the definitions below to set the locations of the various directories,
 # as well as the test duration.
 #
-# Usage: bash kvm.sh [ options ]
+# Usage: kvm.sh [ options ]
 #
 # 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
tools/testing/selftests/rcutorture/bin/parse-build.sh +1 -2
index 41eeeefd8a5c..499d1e598e42 100755
@@ -6,8 +6,7 @@
 #
 # The file must contain kernel build output.
 #
-# Usage:
-#	bash parse-build.sh file title
+# Usage: parse-build.sh file title
 #
 # 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
tools/testing/selftests/rcutorture/bin/parse-console.sh +1 -2
index 2517eaed8991..a0bde6c79456 100755
@@ -4,8 +4,7 @@
 # The "file" is a pathname on the local system, and "title" is
 # a text string for error-message purposes.
 #
-# Usage:
-#	bash parse-console.sh file title
+# Usage: parse-console.sh file title
 #
 # 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
tools/testing/selftests/rcutorture/bin/parse-torture.sh +1 -2
index bbec40b487e9..e3c5f0705696 100755
@@ -7,8 +7,7 @@
 # The file must contain torture output, but can be interspersed
 # with other dmesg text, as in console-log output.
 #
-# Usage:
-#	bash parse-torture.sh file title
+# Usage: parse-torture.sh file title
 #
 # 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
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 4/11 rcu: Add step to initrd documentation

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit tries to get people into the correct directory before creating the initrd directory.

---
 tools/testing/selftests/rcutorture/doc/initrd.txt | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/rcutorture/doc/initrd.txt +1 -0
index 49d134c25c04..4170e714f044 100644
@@ -6,6 +6,7 @@ this case.  There are probably much better ways of doing this.
 That said, here are the commands:
 
 ------------------------------------------------------------------------
+cd tools/testing/selftests/rcutorture
 zcat /initrd.img > /tmp/initrd.img.zcat
 mkdir initrd
 cd initrd
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH 5/11 rcutorture: Test partial nohz_full= configuration

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

The current set of tests covers only cases where either all possible CPUs are nohz_full= CPUs or none of them are. Because there have been some recent bug escapes in cases where only some of the CPUs are nohz_full= CPUs, this commit add a configuration where only half of the CPUs are nohz_full= CPUs.

---
 tools/testing/selftests/rcutorture/configs/rcu/TREE07      | 2 +-
 tools/testing/selftests/rcutorture/configs/rcu/TREE07.boot | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE07.boot
tools/testing/selftests/rcutorture/configs/rcu/TREE07 +1 -1
index ab6225506909..715ee5e0d59d 100644
@@ -7,7 +7,7 @@ CONFIG_PREEMPT=n
 CONFIG_HZ_PERIODIC=n
 CONFIG_NO_HZ_IDLE=n
 CONFIG_NO_HZ_FULL=y
-CONFIG_NO_HZ_FULL_ALL=y
+CONFIG_NO_HZ_FULL_ALL=n
 CONFIG_NO_HZ_FULL_SYSIDLE=y
 CONFIG_RCU_FAST_NO_HZ=n
 CONFIG_RCU_TRACE=y
tools/testing/selftests/rcutorture/configs/rcu/TREE07.boot new file +1 -0
new file mode 100644
index 000000000000..d44609937503
@@ -0,0 +1 @@
+nohz_full=2-9
Signature · 1 line
1.8.1.5
#6 lore raw

PATCH 6/11 rcutorture: Specify MAXSMP=y for TREE01

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

Setting CONFIG_MAXSMP=y causes cpumasks to be moved offstack, which introduces the possibility of NULL cpumask_var_t pointers. This commit therefore enables CONFIG_MAXSMP=y in TREE01 to increase test coverage. However, because CONFIG_MAXSMP=y implies 8192 CPUs, we need to use the maxcpus= boot parameter to limit the number of CPUs to something reasonable, which in turn requires updating the scripts to handle this.

---
 tools/testing/selftests/rcutorture/bin/functions.sh  | 20 ++++++++++++++++++++
 .../selftests/rcutorture/bin/kvm-test-1-run.sh       |  1 +
 tools/testing/selftests/rcutorture/bin/kvm.sh        |  4 +++-
 .../testing/selftests/rcutorture/configs/rcu/TREE01  |  4 +---
 .../selftests/rcutorture/configs/rcu/TREE01.boot     |  2 +-
 5 files changed, 26 insertions(+), 5 deletions(-)
tools/testing/selftests/rcutorture/bin/functions.sh +20 -0
index d01b865bb100..b325470c01b3 100644
@@ -64,6 +64,26 @@ configfrag_boot_params () {
 	fi
 }
 
+# configfrag_boot_cpus bootparam-string config-fragment-file config-cpus
+#
+# Decreases number of CPUs based on any maxcpus= boot parameters specified.
+configfrag_boot_cpus () {
+	local bootargs="`configfrag_boot_params "$1" "$2"`"
+	local maxcpus
+	if echo "${bootargs}" | grep -q 'maxcpus=[0-9]'
+	then
+		maxcpus="`echo "${bootargs}" | sed -e 's/^.*maxcpus=\([0-9]*\).*$/\1/'`"
+		if test "$3" -gt "$maxcpus"
+		then
+			echo $maxcpus
+		else
+			echo $3
+		fi
+	else
+		echo $3
+	fi
+}
+
 # configfrag_hotplug_cpu config-fragment-file
 #
 # Returns 1 if the config fragment specifies hotplug CPU.
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1 -0
index 6d2f5fa48484..487308fabf76 100755
@@ -140,6 +140,7 @@ fi
 # Generate -smp qemu argument.
 qemu_args="-nographic $qemu_args"
 cpu_count=`configNR_CPUS.sh $config_template`
+cpu_count=`configfrag_boot_cpus "$boot_args" "$config_template" "$cpu_count"`
 vcpus=`identify_qemu_vcpus`
 if test $cpu_count -gt $vcpus
 then
tools/testing/selftests/rcutorture/bin/kvm.sh +3 -1
index 36534f9938ca..e527dc952eb0 100755
@@ -188,7 +188,9 @@ for CF in $configs
 do
 	if test -f "$CONFIGFRAG/$kversion/$CF"
 	then
-		echo $CF `configNR_CPUS.sh $CONFIGFRAG/$kversion/$CF` >> $T/cfgcpu
+		cpu_count=`configNR_CPUS.sh $CONFIGFRAG/$kversion/$CF`
+		cpu_count=`configfrag_boot_cpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$kversion/$CF" "$cpu_count"`
+		echo $CF $cpu_count >> $T/cfgcpu
 	else
 		echo "The --configs file $CF does not exist, terminating."
 		exit 1
tools/testing/selftests/rcutorture/configs/rcu/TREE01 +1 -3
index 063b7079c621..38e3895759dd 100644
@@ -1,5 +1,4 @@
 CONFIG_SMP=y
-CONFIG_NR_CPUS=8
 CONFIG_PREEMPT_NONE=n
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=y
@@ -10,8 +9,7 @@ CONFIG_NO_HZ_FULL=n
 CONFIG_RCU_FAST_NO_HZ=y
 CONFIG_RCU_TRACE=y
 CONFIG_HOTPLUG_CPU=y
-CONFIG_RCU_FANOUT=8
-CONFIG_RCU_FANOUT_EXACT=n
+CONFIG_MAXSMP=y
 CONFIG_RCU_NOCB_CPU=y
 CONFIG_RCU_NOCB_CPU_ZERO=y
 CONFIG_DEBUG_LOCK_ALLOC=n
tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot +1 -1
index 0fc8a3428938..adc3abc82fb8 100644
@@ -1 +1 @@
-rcutorture.torture_type=rcu_bh
+rcutorture.torture_type=rcu_bh maxcpus=8
Signature · 1 line
1.8.1.5
#7 lore raw

PATCH 7/11 rcutorture: Specify CONFIG_CPUMASK_OFFSTACK=y for TREE07

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit specifies offstack cpumasks in TREE07 in order to catch references to unallocated cpumask_var_t variables.

---
 tools/testing/selftests/rcutorture/configs/rcu/TREE07 | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/rcutorture/configs/rcu/TREE07 +1 -0
index 715ee5e0d59d..8f1017666aa7 100644
@@ -1,5 +1,6 @@
 CONFIG_SMP=y
 CONFIG_NR_CPUS=16
+CONFIG_CPUMASK_OFFSTACK=y
 CONFIG_PREEMPT_NONE=y
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=n
Signature · 1 line
1.8.1.5
#8 lore raw

PATCH 8/11 rcu: Use pr_alert/pr_cont for printing logs

In reply to Paul E. McKenney

From: Joe Perches <[email protected]>

User pr_alert/pr_cont for printing the logs from rcutorture module directly instead of writing it to a buffer and then printing it. This allows us from not having to allocate such buffers. Also remove a resulting empty function.

I tested this using the parse-torture.sh script as follows:

$ dmesg | grep torture > log.txt
$ bash parse-torture.sh log.txt test
$

There were no warnings which means that parsing went fine.

---
 include/linux/torture.h |   2 +-
 kernel/rcu/rcutorture.c | 127 +++++++++++++++++++++---------------------------
 kernel/torture.c        |  16 +++---
 3 files changed, 64 insertions(+), 81 deletions(-)
include/linux/torture.h +1 -1
index 5ca58fcbaf1b..fec46f8c08eb 100644
@@ -51,7 +51,7 @@
 
 /* Definitions for online/offline exerciser. */
 int torture_onoff_init(long ooholdoff, long oointerval);
-char *torture_onoff_stats(char *page);
+void torture_onoff_stats(void);
 bool torture_onoff_failures(void);
 
 /* Low-rider random number generator. */
kernel/rcu/rcutorture.c +56 -71

189 lines not on this page · raw message

kernel/torture.c +7 -9
index d600af21f022..ede8b25ec1ae 100644
@@ -211,18 +211,16 @@ EXPORT_SYMBOL_GPL(torture_onoff_cleanup);
 /*
  * Print online/offline testing statistics.
  */
-char *torture_onoff_stats(char *page)
+void torture_onoff_stats(void)
 {
 #ifdef CONFIG_HOTPLUG_CPU
-	page += sprintf(page,
-		       "onoff: %ld/%ld:%ld/%ld %d,%d:%d,%d %lu:%lu (HZ=%d) ",
-		       n_online_successes, n_online_attempts,
-		       n_offline_successes, n_offline_attempts,
-		       min_online, max_online,
-		       min_offline, max_offline,
-		       sum_online, sum_offline, HZ);
+	pr_cont("onoff: %ld/%ld:%ld/%ld %d,%d:%d,%d %lu:%lu (HZ=%d) ",
+		n_online_successes, n_online_attempts,
+		n_offline_successes, n_offline_attempts,
+		min_online, max_online,
+		min_offline, max_offline,
+		sum_online, sum_offline, HZ);
 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
-	return page;
 }
 EXPORT_SYMBOL_GPL(torture_onoff_stats);
 
Signature · 1 line
1.8.1.5
#9 lore raw

PATCH 9/11 rcutorture: Add callback-flood test

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

Although RCU is designed to handle arbitrary floods of callbacks, this
capability is not routinely tested. This commit therefore adds a
cbflood capability in which kthreads repeatedly registers large numbers of callbacks. One such kthread is created for each four CPUs (rounding up), and the test may be controlled by several cbflood_* kernel boot parameters, which control the number of bursts per flood, the number of callbacks per burst, the time between bursts, and the time between floods. The default values are large enough to exercise RCU's emergency responses to callback flooding.

---
 Documentation/kernel-parameters.txt | 18 ++++++++
 kernel/rcu/rcutorture.c             | 86 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 103 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +18 -0
index 5ae8608ca9f5..0a104be4ad86 100644
@@ -2881,6 +2881,24 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			Lazy RCU callbacks are those which RCU can
 			prove do nothing more than free memory.
 
+	rcutorture.cbflood_inter_holdoff= [KNL]
+			Set holdoff time (jiffies) between successive
+			callback-flood tests.
+
+	rcutorture.cbflood_intra_holdoff= [KNL]
+			Set holdoff time (jiffies) between successive
+			bursts of callbacks within a given callback-flood
+			test.
+
+	rcutorture.cbflood_n_burst= [KNL]
+			Set the number of bursts making up a given
+			callback-flood test.  Set this to zero to
+			disable callback-flood testing.
+
+	rcutorture.cbflood_n_per_burst= [KNL]
+			Set the number of callbacks to be registered
+			in a given burst of a callback-flood test.
+
 	rcutorture.fqs_duration= [KNL]
 			Set duration of force_quiescent_state bursts.
 
kernel/rcu/rcutorture.c +85 -1

140 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#10 lore raw

PATCH 10/11 torture: Print PID in hung-kernel diagnostic message

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

---
 tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1 -1
index 487308fabf76..f6b2b4771b78 100755
@@ -215,7 +215,7 @@ then
 		fi
 		if test $kruntime -ge $((seconds + grace))
 		then
-			echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1
+			echo "!!! PID $qemu_pid hung at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1
 			kill -KILL $qemu_pid
 			break
 		fi
Signature · 1 line
1.8.1.5
#11 lore raw

PATCH 11/11 torture: Check for nul bytes in console output

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

When starting a new torture run while an old one is still running, both qemu processes can be outputting to the same console.out file. This can cause quite a bit of confusion, so this commit checks for this situation, which is normally indicated by nul bytes in the console output. Yes, if your new run uses up an exact number of blocks of the file, this check will be ineffective, but the odds are not bad.

---
 tools/testing/selftests/rcutorture/bin/parse-console.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/rcutorture/bin/parse-console.sh +4 -0
index a0bde6c79456..f962ba4cf68b 100755
@@ -32,6 +32,10 @@ title="$2"
 
 . functions.sh
 
+if grep -Pq '\x00' < $file
+then
+	print_warning Console output contains nul bytes, old qemu still running?
+fi
 egrep 'Badness|WARNING:|Warn|BUG|===========|Call Trace:|Oops:' < $file | grep -v 'ODEBUG: ' | grep -v 'Warning: unable to open an initial console' > $T
 if test -s $T
 then
Signature · 1 line
1.8.1.5
Reviewed-by on the v1 series
#12 lore raw
In reply to Paul E. McKenney
Quoted 25 lines · Paul E. McKenney

Hello!

This series contains torture-test updates:

1. Fix sparse warning by making boost_mutex static, courtesy of
Pranith Kumar.

2. Use bash shell for all torture test scripts, courtesy of Pranith
Kumar.

3. Set executable flags on scripts and invoke by name, courtesy
of Pranith Kumar.

4. Add "cd" step to initrd documentation.

5. Test partial nohz_full= configuration to increased test coverage.

6. Specify MAXSMP=y for TREE01 to increase test coverage.

7. Specify CONFIG_CPUMASK_OFFSTACK=y for TREE07 to increase test
coverage.

8. Use pr_alert/pr_cont when printing to avoid large buffers,
courtesy of Joe Perches.

Quoted 7 lines

9. Add a callback-flood test to increase test coverage.

10. Print PID in hung-kernel diagnostic message.

11. Check for nul bytes in console output.

Thanx, Paul

Quoted 27 lines

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

 b/Documentation/kernel-parameters.txt                        |   18
 b/include/linux/torture.h                                    |    2
 b/kernel/rcu/rcutorture.c                                    |  215 +++++++----
 b/kernel/torture.c                                           |   16
 b/tools/testing/selftests/rcutorture/bin/config2frag.sh      |    6
 b/tools/testing/selftests/rcutorture/bin/configcheck.sh      |    6
 b/tools/testing/selftests/rcutorture/bin/configinit.sh       |    6
 b/tools/testing/selftests/rcutorture/bin/functions.sh        |   20 +
 b/tools/testing/selftests/rcutorture/bin/kvm-build.sh        |    4
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck-lock.sh |    4
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh  |    4
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh      |    4
 b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh   |    7
 b/tools/testing/selftests/rcutorture/bin/kvm.sh              |    8
 b/tools/testing/selftests/rcutorture/bin/parse-build.sh      |    7
 b/tools/testing/selftests/rcutorture/bin/parse-console.sh    |   11
 b/tools/testing/selftests/rcutorture/bin/parse-torture.sh    |    7
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE01      |    4
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot |    2
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE07      |    3
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE07.boot |    1
 b/tools/testing/selftests/rcutorture/doc/initrd.txt          |    1
 22 files changed, 233 insertions(+), 123 deletions(-)
Signature · 1 line
Pranith