Skip to contentSkip to conversation

Make rcutorture more vicious: add stutter feature

PATCH In review Paul E. McKenney 7 participants 24 messages Jun 18, 2008 – Jun 26, 2008

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

PATCH 1/1 Make rcutorture more vicious: add stutter feature

Hello!

This patch takes a step towards making rcutorture more brutal by allowing the test to be automatically periodically paused, with the default being to run the test for five seconds then pause for five seconds and repeat. This behavior can be controlled using a new "stutter" module parameter, so that "stutter=0" gives the old default behavior of running continuously.

Starting and stopping rcutorture more heavily stresses RCU's interaction with the scheduler, as well as exercising more paths through the grace-period detection code.

Note that the default to "shuffle_interval" has also been adjusted from 5 seconds to 3 seconds to provide varying overlap with the "stutter" interval.

I am still unable to provoke the failures that Alexey has been seeing, even with this patch, but will be doing a few additional things to beef up rcutorture.

---

 Documentation/RCU/torture.txt |    8 ++++-
 kernel/rcutorture.c           |   59 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 63 insertions(+), 4 deletions(-)
Documentation/RCU/torture.txt +7 -1
diff -urpNa -X dontdiff linux-2.6.26-rc4/Documentation/RCU/torture.txt linux-2.6.26-rc4-rcut1-stutter/Documentation/RCU/torture.txt
@@ -46,9 +46,15 @@ stat_interval	The number of seconds betw
 
 shuffle_interval
 		The number of seconds to keep the test threads affinitied
-		to a particular subset of the CPUs, defaults to 5 seconds.
+		to a particular subset of the CPUs, defaults to 3 seconds.
 		Used in conjunction with test_no_idle_hz.
 
+stutter		The length of time to run the test before pausing for this
+		same period of time.  Defaults to "stutter=5", so as
+		to run and pause for (roughly) five-second intervals.
+		Specifying "stutter=0" causes the test to run continuously
+		without pausing, which is the old default behavior.
+
 test_no_idle_hz	Whether or not to test the ability of RCU to operate in
 		a kernel that disables the scheduling-clock interrupt to
 		idle CPUs.  Boolean parameter, "1" to test, "0" otherwise.
kernel/rcutorture.c +56 -3

132 lines not on this page · raw message

#1 lore raw
Quoted 9 lines · Paul E. McKenney

Hello!

This patch takes a step towards making rcutorture more brutal by allowing the test to be automatically periodically paused, with the default being to run the test for five seconds then pause for five seconds and repeat. This behavior can be controlled using a new "stutter" module parameter, so that "stutter=0" gives the old default behavior of running continuously.

Quoted 3 lines

Starting and stopping rcutorture more heavily stresses RCU's interaction with the scheduler, as well as exercising more paths through the grace-period detection code.

cool! Applied to tip/core/rcu.

Quoted 7 lines

Note that the default to "shuffle_interval" has also been adjusted from 5 seconds to 3 seconds to provide varying overlap with the "stutter" interval.

I am still unable to provoke the failures that Alexey has been seeing, even with this patch, but will be doing a few additional things to beef up rcutorture.

neither am i able to see any rcu-preempt+rcu-torture failures in my testing, despite having added the patch below to tip/core/rcu as well to make any failures more apparent.

Ingo

------------------>
commit 5af970a48f3ba0dd96a036b196c79dc923f28231

Author: Ingo Molnar <[email protected]>
Date:   Wed Jun 18 10:09:48 2008 +0200

rcutorture: WARN_ON_ONCE(1) when detecting an error

this makes it easier for automated tests to pick up such failures.

kernel/rcutorture.c +1 -0
index 0334b6a..0ca7e9b 100644
@@ -687,6 +687,7 @@ rcu_torture_printk(char *page)
 	if (i > 1) {
 		cnt += sprintf(&page[cnt], "!!! ");
 		atomic_inc(&n_rcu_torture_error);
+		WARN_ON_ONCE(1);
 	}
 	cnt += sprintf(&page[cnt], "Reader Pipe: ");
 	for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)
#2 lore raw

PATCH 1/1 Make rcutorture more vicious: reinstate boot-time testing

In reply to Paul E. McKenney

Hello again!

This patch re-institutes the ability to build rcutorture directly into the Linux kernel. The reason that this capability was removed was that this could result in your kernel being pretty much useless, as rcutorture would be running starting from early boot. This problem has been avoided by (1) making rcutorture run only three seconds of every six by default,
(2) adding a CONFIG_RCU_TORTURE_TEST_RUNNABLE that permits rcutorture to be quiesced at boot time, and (3) adding a sysctl in /proc named /proc/sys/kernel/rcutorture_runnable that permits rcutorture to be quiesced and unquiesced when built into the kernel.

Please note that this /proc file is -not- available when rcutorture is built as a module. Please also note that to get the earlier take-no-prisoners behavior, you must use the boot command line to set rcutorture's "stutter" parameter to zero.

The rcutorture quiescing mechanism is currently quite crude: loops in each rcutorture process that poll a global variable once per tick. Suggestions for improvement are welcome. The default action will be to reduce the polling rate to a few times per second.

---

 Documentation/RCU/torture.txt |   21 ++++++++++++++-------
 kernel/rcutorture.c           |    9 ++++++++-
 kernel/sysctl.c               |   13 +++++++++++++
 lib/Kconfig.debug             |   20 +++++++++++++++++++-
 4 files changed, 54 insertions(+), 9 deletions(-)
Documentation/RCU/torture.txt +14 -7
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/Documentation/RCU/torture.txt linux-2.6.26-rc4-rcut2-proc/Documentation/RCU/torture.txt
@@ -10,13 +10,20 @@ status messages via printk(), which can 
 command (perhaps grepping for "torture").  The test is started
 when the module is loaded, and stops when the module is unloaded.
 
-However, actually setting this config option to "y" results in the system
-running the test immediately upon boot, and ending only when the system
-is taken down.  Normally, one will instead want to build the system
-with CONFIG_RCU_TORTURE_TEST=m and to use modprobe and rmmod to control
-the test, perhaps using a script similar to the one shown at the end of
-this document.  Note that you will need CONFIG_MODULE_UNLOAD in order
-to be able to end the test.
+CONFIG_RCU_TORTURE_TEST_RUNNABLE
+
+It is also possible to specify CONFIG_RCU_TORTURE_TEST=y, which will
+result in the tests being loaded into the base kernel.  In this case,
+the CONFIG_RCU_TORTURE_TEST_RUNNABLE config option is used to specify
+whether the RCU torture tests are to be started immediately during
+boot or whether the /proc/sys/kernel/rcutorture_runnable file is used
+to enable them.  This /proc file can be used to repeatedly pause and
+restart the tests, regardless of the initial state specified by the
+CONFIG_RCU_TORTURE_TEST_RUNNABLE config option.
+
+You will normally -not- want to start the RCU torture tests during boot
+(and thus the default is CONFIG_RCU_TORTURE_TEST_RUNNABLE=n), but doing
+this can sometimes be useful in finding boot-time bugs.
 
 
 MODULE PARAMETERS
kernel/rcutorture.c +8 -1
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/kernel/rcutorture.c linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c
@@ -125,6 +125,13 @@ static struct list_head rcu_torture_remo
 
 static int stutter_pause_test = 0;
 
+#if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE)
+#define RCUTORTURE_RUNNABLE_INIT 1
+#else
+#define RCUTORTURE_RUNNABLE_INIT 0
+#endif
+int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT;
+
 /*
  * Allocate an element from the rcu_tortures pool.
  */
@@ -188,7 +195,7 @@ rcu_random(struct rcu_random_state *rrsp
 static void
 rcu_stutter_wait(void)
 {
-	while (stutter_pause_test)
+	while (stutter_pause_test || !rcutorture_runnable)
 		schedule_timeout_interruptible(1);
 }
 
kernel/sysctl.c +13 -0
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/kernel/sysctl.c linux-2.6.26-rc4-rcut2-proc/kernel/sysctl.c
@@ -82,6 +82,9 @@ extern int maps_protect;
 extern int sysctl_stat_interval;
 extern int latencytop_enabled;
 extern int sysctl_nr_open_min, sysctl_nr_open_max;
+#ifdef CONFIG_RCU_TORTURE_TEST
+extern int rcutorture_runnable;
+#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
 
 /* Constants used for minimum and  maximum */
 #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
@@ -813,6 +816,16 @@ static struct ctl_table kern_table[] = {
 		.child		= key_sysctls,
 	},
 #endif
+#ifdef CONFIG_RCU_TORTURE_TEST
+	{
+		.ctl_name       = CTL_UNNUMBERED,
+		.procname       = "rcutorture_runnable",
+		.data           = &rcutorture_runnable,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = &proc_dointvec,
+	},
+#endif
 /*
  * NOTE: do not add new entries to this table unless you have read
  * Documentation/sysctl/ctl_unnumbered.txt
lib/Kconfig.debug +19 -1
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/lib/Kconfig.debug linux-2.6.26-rc4-rcut2-proc/lib/Kconfig.debug
@@ -531,16 +531,34 @@ config BOOT_PRINTK_DELAY
 config RCU_TORTURE_TEST
 	tristate "torture tests for RCU"
 	depends on DEBUG_KERNEL
-	depends on m
 	default n
 	help
 	  This option provides a kernel module that runs torture tests
 	  on the RCU infrastructure.  The kernel module may be built
 	  after the fact on the running kernel to be tested, if desired.
 
+	  Say Y here if you want RCU torture tests to be built into
+	  the kernel.
 	  Say M if you want the RCU torture tests to build as a module.
 	  Say N if you are unsure.
 
+config RCU_TORTURE_TEST_RUNNABLE
+	bool "torture tests for RCU runnable by default"
+	depends on RCU_TORTURE_TEST = y
+	default n
+	help
+	  This option provides a way to build the RCU torture tests
+	  directly into the kernel without them starting up at boot
+	  time.  You can use /proc/sys/kernel/rcutorture_runnable
+	  to manually override this setting.  This /proc file is
+	  available only when the RCU torture tests have been built
+	  into the kernel.
+
+	  Say Y here if you want the RCU torture tests to start during
+	  boot (you probably don't).
+	  Say N here if you want the RCU torture tests to start only
+	  after being manually enabled via /proc.
+
 config KPROBES_SANITY_TEST
 	bool "Kprobes sanity tests"
 	depends on DEBUG_KERNEL
#3 lore raw

Re: [PATCH] Make rcutorture more vicious: reinstate boot-time testing

Quoted 17 lines · Paul E. McKenney

Hello again!

This patch re-institutes the ability to build rcutorture directly into the Linux kernel. The reason that this capability was removed was that this could result in your kernel being pretty much useless, as rcutorture would be running starting from early boot. This problem has been avoided by (1) making rcutorture run only three seconds of every six by default,
(2) adding a CONFIG_RCU_TORTURE_TEST_RUNNABLE that permits rcutorture to be quiesced at boot time, and (3) adding a sysctl in /proc named /proc/sys/kernel/rcutorture_runnable that permits rcutorture to be quiesced and unquiesced when built into the kernel.

Please note that this /proc file is -not- available when rcutorture is built as a module. Please also note that to get the earlier take-no-prisoners behavior, you must use the boot command line to set rcutorture's "stutter" parameter to zero.

Quoted 7 lines

The rcutorture quiescing mechanism is currently quite crude: loops in each rcutorture process that poll a global variable once per tick. Suggestions for improvement are welcome. The default action will be to reduce the polling rate to a few times per second.

This patch looks quite reasonable to me.

- Josh Triplett

Applied
#4 lore raw

Re: [PATCH] Make rcutorture more vicious: reinstate boot-time testing

In reply to Paul E. McKenney
Quoted 18 lines · Paul E. McKenney

Hello again!

This patch re-institutes the ability to build rcutorture directly into the Linux kernel. The reason that this capability was removed was that this could result in your kernel being pretty much useless, as rcutorture would be running starting from early boot. This problem has been avoided by (1) making rcutorture run only three seconds of every six by default, (2) adding a CONFIG_RCU_TORTURE_TEST_RUNNABLE that permits rcutorture to be quiesced at boot time, and (3) adding a sysctl in /proc named /proc/sys/kernel/rcutorture_runnable that permits rcutorture to be quiesced and unquiesced when built into the kernel.

Please note that this /proc file is -not- available when rcutorture is built as a module. Please also note that to get the earlier take-no-prisoners behavior, you must use the boot command line to set rcutorture's "stutter" parameter to zero.

Quoted 4 lines

The rcutorture quiescing mechanism is currently quite crude: loops in each rcutorture process that poll a global variable once per tick. Suggestions for improvement are welcome. The default action will be to reduce the polling rate to a few times per second.

applied to tip/core/rcu - thanks Paul!

FYI, yesterday's rcutorture-stutter feature survived a few hundred random bootup tests in -tip testing already.

a possible area for enhancement would be the following code:

static void
rcu_stutter_wait(void)

{
        while (stutter_pause_test || !rcutorture_runnable)
                schedule_timeout_interruptible(1);
}

will cause HZ number of IRQs on nohz systems, even if rcutorture is disabled. While it's fine to poll if rcutorture_runnable==1, the sleep should be at least 1 second when !rcutorture_runnable.

[ Or it might even make sense to completely stop the threads from a
sysctl handler - to make it event-driven and to cause no extra IRQs at all when rcutorture is disabled via /proc. ]

Ingo

#5 lore raw

Re: [PATCH] Make rcutorture more vicious: reinstate boot-time testing

Quoted 40 lines · Ingo Molnar
Quoted 18 lines · Paul E. McKenney

Hello again!

This patch re-institutes the ability to build rcutorture directly into the Linux kernel. The reason that this capability was removed was that this could result in your kernel being pretty much useless, as rcutorture would be running starting from early boot. This problem has been avoided by (1) making rcutorture run only three seconds of every six by default, (2) adding a CONFIG_RCU_TORTURE_TEST_RUNNABLE that permits rcutorture to be quiesced at boot time, and (3) adding a sysctl in /proc named /proc/sys/kernel/rcutorture_runnable that permits rcutorture to be quiesced and unquiesced when built into the kernel.

Please note that this /proc file is -not- available when rcutorture is built as a module. Please also note that to get the earlier take-no-prisoners behavior, you must use the boot command line to set rcutorture's "stutter" parameter to zero.

Quoted 4 lines

The rcutorture quiescing mechanism is currently quite crude: loops in each rcutorture process that poll a global variable once per tick. Suggestions for improvement are welcome. The default action will be to reduce the polling rate to a few times per second.

applied to tip/core/rcu - thanks Paul!

FYI, yesterday's rcutorture-stutter feature survived a few hundred random bootup tests in -tip testing already.

a possible area for enhancement would be the following code:

static void
rcu_stutter_wait(void)

{
        while (stutter_pause_test || !rcutorture_runnable)
                schedule_timeout_interruptible(1);
}
Quoted 7 lines

will cause HZ number of IRQs on nohz systems, even if rcutorture is disabled. While it's fine to poll if rcutorture_runnable==1, the sleep should be at least 1 second when !rcutorture_runnable.

[ Or it might even make sense to completely stop the threads from a
sysctl handler - to make it event-driven and to cause no extra IRQs at all when rcutorture is disabled via /proc. ]

Here is a crude first cut (incorporated into an updated patch).

Thoughts?

---

 Documentation/RCU/torture.txt      |   21 
 Documentation/RCU/torture.txt.orig |    8 
 kernel/rcutorture.c                |   14 
 kernel/rcutorture.c.orig           |   59 
 kernel/sysctl.c                    |   13 
 kernel/sysctl.c.orig               | 2851 +++++++++++++++++++++++++++++++++++++
 lib/Kconfig.debug                  |   20 
 lib/Kconfig.debug.orig             |  679 ++++++++
 8 files changed, 3651 insertions(+), 14 deletions(-)
Documentation/RCU/torture.txt +14 -7
diff -urpNa linux-2.6.26-rc4-rcut1-stutter/Documentation/RCU/torture.txt linux-2.6.26-rc4-rcut2-proc/Documentation/RCU/torture.txt
@@ -10,13 +10,20 @@ status messages via printk(), which can 
 command (perhaps grepping for "torture").  The test is started
 when the module is loaded, and stops when the module is unloaded.
 
-However, actually setting this config option to "y" results in the system
-running the test immediately upon boot, and ending only when the system
-is taken down.  Normally, one will instead want to build the system
-with CONFIG_RCU_TORTURE_TEST=m and to use modprobe and rmmod to control
-the test, perhaps using a script similar to the one shown at the end of
-this document.  Note that you will need CONFIG_MODULE_UNLOAD in order
-to be able to end the test.
+CONFIG_RCU_TORTURE_TEST_RUNNABLE
+
+It is also possible to specify CONFIG_RCU_TORTURE_TEST=y, which will
+result in the tests being loaded into the base kernel.  In this case,
+the CONFIG_RCU_TORTURE_TEST_RUNNABLE config option is used to specify
+whether the RCU torture tests are to be started immediately during
+boot or whether the /proc/sys/kernel/rcutorture_runnable file is used
+to enable them.  This /proc file can be used to repeatedly pause and
+restart the tests, regardless of the initial state specified by the
+CONFIG_RCU_TORTURE_TEST_RUNNABLE config option.
+
+You will normally -not- want to start the RCU torture tests during boot
+(and thus the default is CONFIG_RCU_TORTURE_TEST_RUNNABLE=n), but doing
+this can sometimes be useful in finding boot-time bugs.
 
 
 MODULE PARAMETERS
Documentation/RCU/torture.txt.orig +7 -1
diff -urpNa linux-2.6.26-rc4-rcut1-stutter/Documentation/RCU/torture.txt.orig linux-2.6.26-rc4-rcut2-proc/Documentation/RCU/torture.txt.orig
@@ -46,9 +46,15 @@ stat_interval	The number of seconds betw
 
 shuffle_interval
 		The number of seconds to keep the test threads affinitied
-		to a particular subset of the CPUs, defaults to 5 seconds.
+		to a particular subset of the CPUs, defaults to 3 seconds.
 		Used in conjunction with test_no_idle_hz.
 
+stutter		The length of time to run the test before pausing for this
+		same period of time.  Defaults to "stutter=5", so as
+		to run and pause for (roughly) five-second intervals.
+		Specifying "stutter=0" causes the test to run continuously
+		without pausing, which is the old default behavior.
+
 test_no_idle_hz	Whether or not to test the ability of RCU to operate in
 		a kernel that disables the scheduling-clock interrupt to
 		idle CPUs.  Boolean parameter, "1" to test, "0" otherwise.
kernel/rcutorture.c +12 -2
diff -urpNa linux-2.6.26-rc4-rcut1-stutter/kernel/rcutorture.c linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c
@@ -125,6 +125,13 @@ static struct list_head rcu_torture_remo
 
 static int stutter_pause_test = 0;
 
+#if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE)
+#define RCUTORTURE_RUNNABLE_INIT 1
+#else
+#define RCUTORTURE_RUNNABLE_INIT 0
+#endif
+int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT;
+
 /*
  * Allocate an element from the rcu_tortures pool.
  */
@@ -188,8 +195,11 @@ rcu_random(struct rcu_random_state *rrsp
 static void
 rcu_stutter_wait(void)
 {
-	while (stutter_pause_test)
-		schedule_timeout_interruptible(1);
+	while (stutter_pause_test || !rcutorture_runnable)
+		if (rcutorture_runnable)
+			schedule_timeout_interruptible(1);
+		else
+			schedule_timeout_interruptible(HZ);
 }
 
 /*
kernel/rcutorture.c.orig +56 -3

132 lines not on this page · raw message

kernel/sysctl.c +13 -0
diff -urpNa linux-2.6.26-rc4-rcut1-stutter/kernel/sysctl.c linux-2.6.26-rc4-rcut2-proc/kernel/sysctl.c
@@ -82,6 +82,9 @@ extern int maps_protect;
 extern int sysctl_stat_interval;
 extern int latencytop_enabled;
 extern int sysctl_nr_open_min, sysctl_nr_open_max;
+#ifdef CONFIG_RCU_TORTURE_TEST
+extern int rcutorture_runnable;
+#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
 
 /* Constants used for minimum and  maximum */
 #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
@@ -813,6 +816,16 @@ static struct ctl_table kern_table[] = {
 		.child		= key_sysctls,
 	},
 #endif
+#ifdef CONFIG_RCU_TORTURE_TEST
+	{
+		.ctl_name       = CTL_UNNUMBERED,
+		.procname       = "rcutorture_runnable",
+		.data           = &rcutorture_runnable,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = &proc_dointvec,
+	},
+#endif
 /*
  * NOTE: do not add new entries to this table unless you have read
  * Documentation/sysctl/ctl_unnumbered.txt
kernel/sysctl.c.orig +2851 -0

2,774 lines not on this page · raw message

lib/Kconfig.debug +19 -1
diff -urpNa linux-2.6.26-rc4-rcut1-stutter/lib/Kconfig.debug linux-2.6.26-rc4-rcut2-proc/lib/Kconfig.debug

Lines of this file are not shown. View the raw message.

lib/Kconfig.debug.orig +679 -0

679 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#6 lore raw

Re: [PATCH] Make rcutorture more vicious: reinstate boot-time testing

Quoted 9 lines · On Thu, 19 Jun 2008 08:58:54 -0700 Paul E. McKenney wrote:
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Paul E. McKenney

Hello again!

 Documentation/RCU/torture.txt      |   21 
 Documentation/RCU/torture.txt.orig |    8 
                                ~~~~~
Quoted 2 lines
 kernel/rcutorture.c                |   14 
 kernel/rcutorture.c.orig           |   59 
                       !!!!
Quoted 2 lines
 kernel/sysctl.c                    |   13 
 kernel/sysctl.c.orig               | 2851 +++++++++++++++++++++++++++++++++++++
                   ~~~~
Quoted 2 lines
 lib/Kconfig.debug                  |   20 
 lib/Kconfig.debug.orig             |  679 ++++++++
                     ~~~~

What's with all of these .orig files, eh??

Quoted 1 line
 8 files changed, 3651 insertions(+), 14 deletions(-)

---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/

#7 lore raw

Re: [PATCH] Make rcutorture more vicious: reinstate boot-time testing

Quoted 19 lines · Randy Dunlap
Quoted 9 lines · On Thu, 19 Jun 2008 08:58:54 -0700 Paul E. McKenney wrote:
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Paul E. McKenney

Hello again!

 Documentation/RCU/torture.txt      |   21 
 Documentation/RCU/torture.txt.orig |    8 
                                ~~~~~
Quoted 2 lines
 kernel/rcutorture.c                |   14 
 kernel/rcutorture.c.orig           |   59 
                       !!!!
Quoted 2 lines
 kernel/sysctl.c                    |   13 
 kernel/sysctl.c.orig               | 2851 +++++++++++++++++++++++++++++++++++++
Quoted 7 lines
                   ~~~~
Quoted 2 lines
 lib/Kconfig.debug                  |   20 
 lib/Kconfig.debug.orig             |  679 ++++++++
                     ~~~~

What's with all of these .orig files, eh??

Gah, typos generating the diffs. :-/

Quoted 1 line
Quoted 1 line
 8 files changed, 3651 insertions(+), 14 deletions(-)

How about the following instead? (I expect to be following up with a version that gets rid of the threads in response to writing a "0" to /proc/sys/kernel/rcutorture_runnable later on.)

---

 Documentation/RCU/torture.txt |   21 ++++++++++++++-------
 kernel/rcutorture.c           |   14 ++++++++++++--
 kernel/sysctl.c               |   13 +++++++++++++
 lib/Kconfig.debug             |   20 +++++++++++++++++++-
 4 files changed, 58 insertions(+), 10 deletions(-)
Documentation/RCU/torture.txt +14 -7
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/Documentation/RCU/torture.txt linux-2.6.26-rc4-rcut2-proc/Documentation/RCU/torture.txt
@@ -10,13 +10,20 @@ status messages via printk(), which can 
 command (perhaps grepping for "torture").  The test is started
 when the module is loaded, and stops when the module is unloaded.
 
-However, actually setting this config option to "y" results in the system
-running the test immediately upon boot, and ending only when the system
-is taken down.  Normally, one will instead want to build the system
-with CONFIG_RCU_TORTURE_TEST=m and to use modprobe and rmmod to control
-the test, perhaps using a script similar to the one shown at the end of
-this document.  Note that you will need CONFIG_MODULE_UNLOAD in order
-to be able to end the test.
+CONFIG_RCU_TORTURE_TEST_RUNNABLE
+
+It is also possible to specify CONFIG_RCU_TORTURE_TEST=y, which will
+result in the tests being loaded into the base kernel.  In this case,
+the CONFIG_RCU_TORTURE_TEST_RUNNABLE config option is used to specify
+whether the RCU torture tests are to be started immediately during
+boot or whether the /proc/sys/kernel/rcutorture_runnable file is used
+to enable them.  This /proc file can be used to repeatedly pause and
+restart the tests, regardless of the initial state specified by the
+CONFIG_RCU_TORTURE_TEST_RUNNABLE config option.
+
+You will normally -not- want to start the RCU torture tests during boot
+(and thus the default is CONFIG_RCU_TORTURE_TEST_RUNNABLE=n), but doing
+this can sometimes be useful in finding boot-time bugs.
 
 
 MODULE PARAMETERS
kernel/rcutorture.c +12 -2
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/kernel/rcutorture.c linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c
@@ -125,6 +125,13 @@ static struct list_head rcu_torture_remo
 
 static int stutter_pause_test = 0;
 
+#if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE)
+#define RCUTORTURE_RUNNABLE_INIT 1
+#else
+#define RCUTORTURE_RUNNABLE_INIT 0
+#endif
+int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT;
+
 /*
  * Allocate an element from the rcu_tortures pool.
  */
@@ -188,8 +195,11 @@ rcu_random(struct rcu_random_state *rrsp
 static void
 rcu_stutter_wait(void)
 {
-	while (stutter_pause_test)
-		schedule_timeout_interruptible(1);
+	while (stutter_pause_test || !rcutorture_runnable)
+		if (rcutorture_runnable)
+			schedule_timeout_interruptible(1);
+		else
+			schedule_timeout_interruptible(HZ);
 }
 
 /*
kernel/sysctl.c +13 -0
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/kernel/sysctl.c linux-2.6.26-rc4-rcut2-proc/kernel/sysctl.c
@@ -82,6 +82,9 @@ extern int maps_protect;
 extern int sysctl_stat_interval;
 extern int latencytop_enabled;
 extern int sysctl_nr_open_min, sysctl_nr_open_max;
+#ifdef CONFIG_RCU_TORTURE_TEST
+extern int rcutorture_runnable;
+#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
 
 /* Constants used for minimum and  maximum */
 #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
@@ -813,6 +816,16 @@ static struct ctl_table kern_table[] = {
 		.child		= key_sysctls,
 	},
 #endif
+#ifdef CONFIG_RCU_TORTURE_TEST
+	{
+		.ctl_name       = CTL_UNNUMBERED,
+		.procname       = "rcutorture_runnable",
+		.data           = &rcutorture_runnable,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = &proc_dointvec,
+	},
+#endif
 /*
  * NOTE: do not add new entries to this table unless you have read
  * Documentation/sysctl/ctl_unnumbered.txt
lib/Kconfig.debug +19 -1
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/lib/Kconfig.debug linux-2.6.26-rc4-rcut2-proc/lib/Kconfig.debug
@@ -531,16 +531,34 @@ config BOOT_PRINTK_DELAY
 config RCU_TORTURE_TEST
 	tristate "torture tests for RCU"
 	depends on DEBUG_KERNEL
-	depends on m
 	default n
 	help
 	  This option provides a kernel module that runs torture tests
 	  on the RCU infrastructure.  The kernel module may be built
 	  after the fact on the running kernel to be tested, if desired.
 
+	  Say Y here if you want RCU torture tests to be built into
+	  the kernel.
 	  Say M if you want the RCU torture tests to build as a module.
 	  Say N if you are unsure.
 
+config RCU_TORTURE_TEST_RUNNABLE
+	bool "torture tests for RCU runnable by default"
+	depends on RCU_TORTURE_TEST = y
+	default n
+	help
+	  This option provides a way to build the RCU torture tests
+	  directly into the kernel without them starting up at boot
+	  time.  You can use /proc/sys/kernel/rcutorture_runnable
+	  to manually override this setting.  This /proc file is
+	  available only when the RCU torture tests have been built
+	  into the kernel.
+
+	  Say Y here if you want the RCU torture tests to start during
+	  boot (you probably don't).
+	  Say N here if you want the RCU torture tests to start only
+	  after being manually enabled via /proc.
+
 config KPROBES_SANITY_TEST
 	bool "Kprobes sanity tests"
 	depends on DEBUG_KERNEL
#8 lore raw

Re: [PATCH] Make rcutorture more vicious: reinstate boot-time testing

Quoted 28 lines · On Thu, 19 Jun 2008 22:47:24 -0700 Paul E. McKenney wrote:
Quoted 19 lines · Randy Dunlap
Quoted 9 lines · On Thu, 19 Jun 2008 08:58:54 -0700 Paul E. McKenney wrote:
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Paul E. McKenney

Hello again!

 Documentation/RCU/torture.txt      |   21 
 Documentation/RCU/torture.txt.orig |    8 
                                ~~~~~
Quoted 2 lines
 kernel/rcutorture.c                |   14 
 kernel/rcutorture.c.orig           |   59 
                       !!!!
Quoted 2 lines
 kernel/sysctl.c                    |   13 
 kernel/sysctl.c.orig               | 2851 +++++++++++++++++++++++++++++++++++++
Quoted 7 lines
                   ~~~~
Quoted 2 lines
 lib/Kconfig.debug                  |   20 
 lib/Kconfig.debug.orig             |  679 ++++++++
                     ~~~~

What's with all of these .orig files, eh??

Quoted 7 lines

Gah, typos generating the diffs. :-/

Quoted 1 line
Quoted 1 line
 8 files changed, 3651 insertions(+), 14 deletions(-)

How about the following instead? (I expect to be following up with a version that gets rid of the threads in response to writing a "0" to /proc/sys/kernel/rcutorture_runnable later on.)

Yes, much better. Thanks.

Quoted 131 lines

---

 Documentation/RCU/torture.txt |   21 ++++++++++++++-------
 kernel/rcutorture.c           |   14 ++++++++++++--
 kernel/sysctl.c               |   13 +++++++++++++
 lib/Kconfig.debug             |   20 +++++++++++++++++++-
 4 files changed, 58 insertions(+), 10 deletions(-)

diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/Documentation/RCU/torture.txt linux-2.6.26-rc4-rcut2-proc/Documentation/RCU/torture.txt

Documentation/RCU/torture.txt +14 -7
@@ -10,13 +10,20 @@ status messages via printk(), which can 
 command (perhaps grepping for "torture").  The test is started
 when the module is loaded, and stops when the module is unloaded.
 
-However, actually setting this config option to "y" results in the system
-running the test immediately upon boot, and ending only when the system
-is taken down.  Normally, one will instead want to build the system
-with CONFIG_RCU_TORTURE_TEST=m and to use modprobe and rmmod to control
-the test, perhaps using a script similar to the one shown at the end of
-this document.  Note that you will need CONFIG_MODULE_UNLOAD in order
-to be able to end the test.
+CONFIG_RCU_TORTURE_TEST_RUNNABLE
+
+It is also possible to specify CONFIG_RCU_TORTURE_TEST=y, which will
+result in the tests being loaded into the base kernel.  In this case,
+the CONFIG_RCU_TORTURE_TEST_RUNNABLE config option is used to specify
+whether the RCU torture tests are to be started immediately during
+boot or whether the /proc/sys/kernel/rcutorture_runnable file is used
+to enable them.  This /proc file can be used to repeatedly pause and
+restart the tests, regardless of the initial state specified by the
+CONFIG_RCU_TORTURE_TEST_RUNNABLE config option.
+
+You will normally -not- want to start the RCU torture tests during boot
+(and thus the default is CONFIG_RCU_TORTURE_TEST_RUNNABLE=n), but doing
+this can sometimes be useful in finding boot-time bugs.
 
 
 MODULE PARAMETERS

diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/kernel/rcutorture.c linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c

kernel/rcutorture.c +12 -2
@@ -125,6 +125,13 @@ static struct list_head rcu_torture_remo
 
 static int stutter_pause_test = 0;
 
+#if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE)
+#define RCUTORTURE_RUNNABLE_INIT 1
+#else
+#define RCUTORTURE_RUNNABLE_INIT 0
+#endif
+int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT;
+
 /*
  * Allocate an element from the rcu_tortures pool.
  */
@@ -188,8 +195,11 @@ rcu_random(struct rcu_random_state *rrsp
 static void
 rcu_stutter_wait(void)
 {
-	while (stutter_pause_test)
-		schedule_timeout_interruptible(1);
+	while (stutter_pause_test || !rcutorture_runnable)
+		if (rcutorture_runnable)
+			schedule_timeout_interruptible(1);
+		else
+			schedule_timeout_interruptible(HZ);
 }
 
 /*

diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/kernel/sysctl.c linux-2.6.26-rc4-rcut2-proc/kernel/sysctl.c

kernel/sysctl.c +13 -0
@@ -82,6 +82,9 @@ extern int maps_protect;
 extern int sysctl_stat_interval;
 extern int latencytop_enabled;
 extern int sysctl_nr_open_min, sysctl_nr_open_max;
+#ifdef CONFIG_RCU_TORTURE_TEST
+extern int rcutorture_runnable;
+#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
 
 /* Constants used for minimum and  maximum */
 #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
@@ -813,6 +816,16 @@ static struct ctl_table kern_table[] = {
 		.child		= key_sysctls,
 	},
 #endif
+#ifdef CONFIG_RCU_TORTURE_TEST
+	{
+		.ctl_name       = CTL_UNNUMBERED,
+		.procname       = "rcutorture_runnable",
+		.data           = &rcutorture_runnable,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = &proc_dointvec,
+	},
+#endif
 /*
  * NOTE: do not add new entries to this table unless you have read
  * Documentation/sysctl/ctl_unnumbered.txt

diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut1-stutter/lib/Kconfig.debug linux-2.6.26-rc4-rcut2-proc/lib/Kconfig.debug

lib/Kconfig.debug +13 -1
@@ -531,16 +531,34 @@ config BOOT_PRINTK_DELAY
 config RCU_TORTURE_TEST
 	tristate "torture tests for RCU"
 	depends on DEBUG_KERNEL
-	depends on m
 	default n
 	help
 	  This option provides a kernel module that runs torture tests
 	  on the RCU infrastructure.  The kernel module may be built
 	  after the fact on the running kernel to be tested, if desired.
 
+	  Say Y here if you want RCU torture tests to be built into
+	  the kernel.
 	  Say M if you want the RCU torture tests to build as a module.
 	  Say N if you are unsure.
 
+config RCU_TORTURE_TEST_RUNNABLE
+	bool "torture tests for RCU runnable by default"
+	depends on RCU_TORTURE_TEST = y
+	default n
+	help
+	  This option provides a way to build the RCU torture tests
+	  directly into the kernel without them starting up at boot
+	  time.  You can use /proc/sys/kernel/rcutorture_runnable
+	  to manually override this setting.  This /proc file is
+	  available only when the RCU torture tests have been built
+	  into the kernel.

lib/Kconfig.debug config BOOT_PRINTK_DELAY

Quoted 10 lines
lib/Kconfig.debug +6 -1
+
+	  Say Y here if you want the RCU torture tests to start during
+	  boot (you probably don't).
+	  Say N here if you want the RCU torture tests to start only
+	  after being manually enabled via /proc.
+
 config KPROBES_SANITY_TEST
 	bool "Kprobes sanity tests"
 	depends on DEBUG_KERNEL
--

---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/

#9 lore raw

PATCH 1/1 Make rcutorture more vicious: make quiescent rcutorture less power-hungry

In reply to Paul E. McKenney

This patch makes the non-module rcutorture a bit more friendly to the power-conservation code. This is a rather simple-minded approach. More sophisticated approaches would get rid of the rcutorture tasks while rcutorture execution was suppressed, but attempts thus far to do this have not gone well -- calling rcu_torture_init() from a /proc callout results in oopses.

---

 rcutorture.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcutorture.c +4 -1
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c
@@ -196,7 +196,10 @@ static void
 rcu_stutter_wait(void)
 {
 	while (stutter_pause_test || !rcutorture_runnable)
-		schedule_timeout_interruptible(1);
+		if (rcutorture_runnable)
+			schedule_timeout_interruptible(1);
+		else
+			schedule_timeout_interruptible(HZ);
 }
 
 /*
#10 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 22 lines · On Sun, 22 Jun 2008 13:06:38 -0700 "Paul E. McKenney"…

This patch makes the non-module rcutorture a bit more friendly to the power-conservation code. This is a rather simple-minded approach. More sophisticated approaches would get rid of the rcutorture tasks while rcutorture execution was suppressed, but attempts thus far to do this have not gone well -- calling rcu_torture_init() from a /proc callout results in oopses.

---

 rcutorture.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c ---
linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c 2008-06-22
10:29:04.000000000 -0700 +++
linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c 2008-06-22
12:20:10.000000000 -0700 @@ -196,7 +196,10 @@ static void rcu_stutter_wait(void) { while (stutter_pause_test || !rcutorture_runnable)

kernel/rcutorture.c static void · line 203

Quoted 6 lines
kernel/rcutorture.c +4 -1
-		schedule_timeout_interruptible(1);
+		if (rcutorture_runnable)
+			schedule_timeout_interruptible(1);
+		else
+			schedule_timeout_interruptible(HZ);
 }

could you also make it use round_jiffies_relative() to make the power impact even less.....
(by coalescing various "once a second" timers like this)

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#11 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 27 lines · Arjan van de Ven
Quoted 24 lines · On Sun, 22 Jun 2008 13:06:38 -0700 "Paul E. McKenney"…

This patch makes the non-module rcutorture a bit more friendly to the power-conservation code. This is a rather simple-minded approach. More sophisticated approaches would get rid of the rcutorture tasks while rcutorture execution was suppressed, but attempts thus far to do this have not gone well -- calling rcu_torture_init() from a /proc callout results in oopses.

---

 rcutorture.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c ---
linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c 2008-06-22
10:29:04.000000000 -0700 +++
linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c 2008-06-22
12:20:10.000000000 -0700 @@ -196,7 +196,10 @@ static void rcu_stutter_wait(void) { while (stutter_pause_test || !rcutorture_runnable)

(quoted diff) +1 -1
-		schedule_timeout_interruptible(1);
+		if (rcutorture_runnable)
Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +3 -0
+			schedule_timeout_interruptible(1);
+		else
+			schedule_timeout_interruptible(HZ);
 }

could you also make it use round_jiffies_relative() to make the power impact even less.....
(by coalescing various "once a second" timers like this)

Good point!!! As follows, on top of the previous one.

This patch aligns the rcutorture wakeup times to align with all other multiple-of-a-second wakeups to further decrease power consumption.

---

 rcutorture.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/rcutorture.c +2 -1
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c linux-2.6.26-rc4-rcut4-procqp/kernel/rcutorture.c
@@ -1,3 +1,4 @@
+
 /*
  * Read-Copy Update module-based torture test facility
  *
@@ -199,7 +200,7 @@ rcu_stutter_wait(void)
 		if (rcutorture_runnable)
 			schedule_timeout_interruptible(1);
 		else
-			schedule_timeout_interruptible(HZ);
+			schedule_timeout_interruptible(round_jiffies_relative(HZ));
 }
 
 /*
Applied
#12 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 11 lines · Paul E. McKenney
Quoted 3 lines

could you also make it use round_jiffies_relative() to make the power impact even less..... (by coalescing various "once a second" timers like this)

Good point!!! As follows, on top of the previous one.

This patch aligns the rcutorture wakeup times to align with all other multiple-of-a-second wakeups to further decrease power consumption.

applied to tip/core/rcu - thanks Paul.

Ingo

#13 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

In reply to Arjan van de Ven
Quoted 27 lines · Arjan van de Ven
Quoted 24 lines · On Sun, 22 Jun 2008 13:06:38 -0700 "Paul E. McKenney"…

This patch makes the non-module rcutorture a bit more friendly to the power-conservation code. This is a rather simple-minded approach. More sophisticated approaches would get rid of the rcutorture tasks while rcutorture execution was suppressed, but attempts thus far to do this have not gone well -- calling rcu_torture_init() from a /proc callout results in oopses.

---

 rcutorture.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c ---
linux-2.6.26-rc4-rcut2-proc/kernel/rcutorture.c 2008-06-22
10:29:04.000000000 -0700 +++
linux-2.6.26-rc4-rcut3-procq/kernel/rcutorture.c 2008-06-22
12:20:10.000000000 -0700 @@ -196,7 +196,10 @@ static void rcu_stutter_wait(void) { while (stutter_pause_test || !rcutorture_runnable)

kernel/rcutorture.c +1 -1
-		schedule_timeout_interruptible(1);
+		if (rcutorture_runnable)
Quoted 8 lines

kernel/rcutorture.c static void · line 203

Quoted 4 lines
kernel/rcutorture.c +3 -0
+			schedule_timeout_interruptible(1);
+		else
+			schedule_timeout_interruptible(HZ);
 }

could you also make it use round_jiffies_relative() to make the power impact even less.....
(by coalescing various "once a second" timers like this)

I'm a little concerned about how this will affect real-time performance, as queueing up lots of timers all at once can lead to long running timer expiration handlers. If just a schedule_timeout, I suppose we are only looking at a process wakeup, as opposed to a softirq context callback function?

Thanks,

Signature · 3 lines
Darren Hart
Real-Time Linux Team Lead
IBM Linux Technology Center
#14 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 5 lines · On Mon, 23 Jun 2008 17:54:09 +0000 Darren Hart <[email protected]> wrote:

I'm a little concerned about how this will affect real-time performance, as queueing up lots of timers all at once can lead to long running timer expiration handlers. If just a schedule_timeout, I suppose we are only looking at a process wakeup, as opposed to a softirq context callback function?

in reality, the time it takes to deliver the interrupt (including waking the CPU up etc), is likely to be an order or two of magnitude higher than this kind of code loop....

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#15 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 9 lines · Arjan van de Ven
Quoted 5 lines · On Mon, 23 Jun 2008 17:54:09 +0000 Darren Hart <[email protected]> wrote:

I'm a little concerned about how this will affect real-time performance, as queueing up lots of timers all at once can lead to long running timer expiration handlers. If just a schedule_timeout, I suppose we are only looking at a process wakeup, as opposed to a softirq context callback function?

Quoted 3 lines

in reality, the time it takes to deliver the interrupt (including waking the CPU up etc), is likely to be an order or two of magnitude higher than this kind of code loop....

Sure, if we just look at one of them. Any idea how many such items we're looking at rounding up to fire at the same time? Is it dozens, hundreds, thousands?

Thanks,

Signature · 3 lines
Darren Hart
Real-Time Linux Team Lead
IBM Linux Technology Center
#16 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 10 lines · On Mon, 23 Jun 2008 20:02:54 +0000 Darren Hart <[email protected]> wrote:
Quoted 9 lines · Arjan van de Ven
Quoted 5 lines · On Mon, 23 Jun 2008 17:54:09 +0000 Darren Hart <[email protected]> wrote:

I'm a little concerned about how this will affect real-time performance, as queueing up lots of timers all at once can lead to long running timer expiration handlers. If just a schedule_timeout, I suppose we are only looking at a process wakeup, as opposed to a softirq context callback function?

Quoted 8 lines
Quoted 3 lines

in reality, the time it takes to deliver the interrupt (including waking the CPU up etc), is likely to be an order or two of magnitude higher than this kind of code loop....

Sure, if we just look at one of them. Any idea how many such items we're looking at rounding up to fire at the same time? Is it dozens, hundreds, thousands?

so far, in practice, it's still single-digit amounts.

There's not that many timers that run normally.
(based on powertop data from many systems)

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#17 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

In reply to Darren Hart
Quoted 10 lines · Darren Hart
Quoted 9 lines · Arjan van de Ven
Quoted 5 lines · On Mon, 23 Jun 2008 17:54:09 +0000 Darren Hart <[email protected]> wrote:

I'm a little concerned about how this will affect real-time performance, as queueing up lots of timers all at once can lead to long running timer expiration handlers. If just a schedule_timeout, I suppose we are only looking at a process wakeup, as opposed to a softirq context callback function?

Quoted 7 lines
Quoted 3 lines

in reality, the time it takes to deliver the interrupt (including waking the CPU up etc), is likely to be an order or two of magnitude higher than this kind of code loop....

Sure, if we just look at one of them. Any idea how many such items we're looking at rounding up to fire at the same time? Is it dozens, hundreds, thousands?

Hello, Darren,

Wouldn't these timers be running at low priority, so that high-priority realtime tasks would preempt them?

Thanx, Paul

#18 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 15 lines · Paul E. McKenney
Quoted 14 lines · Darren Hart
Quoted 12 lines · Arjan van de Ven
Quoted 5 lines · On Mon, 23 Jun 2008 17:54:09 +0000 Darren Hart <[email protected]> wrote:

I'm a little concerned about how this will affect real-time performance, as queueing up lots of timers all at once can lead to long running timer expiration handlers. If just a schedule_timeout, I suppose we are only looking at a process wakeup, as opposed to a softirq context callback function?

in reality, the time it takes to deliver the interrupt (including waking the CPU up etc), is likely to be an order or two of magnitude higher than this kind of code loop....

Quoted 8 lines
Quoted 3 lines

Sure, if we just look at one of them. Any idea how many such items we're looking at rounding up to fire at the same time? Is it dozens, hundreds, thousands?

Hello, Darren,

Wouldn't these timers be running at low priority, so that high-priority realtime tasks would preempt them?

The timers run from softirq context will run at the priority of the softirq, so it is configurable, and only tasks equal to or lower in priority to that should see direct effects.

Quoted 2 lines

Thanx, Paul

Signature · 3 lines
Darren Hart
Real-Time Linux Team Lead
IBM Linux Technology Center
#19 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

In reply to Paul E. McKenney
Quoted 6 lines · Paul E. McKenney

This patch makes the non-module rcutorture a bit more friendly to the power-conservation code. This is a rather simple-minded approach. More sophisticated approaches would get rid of the rcutorture tasks while rcutorture execution was suppressed, but attempts thus far to do this have not gone well -- calling rcu_torture_init() from a /proc callout results in oopses.

Hi Paul,

I applied your three patches

[PATCH] Make rcutorture more vicious: add stutter feature [PATCH] Make rcutorture more vicious: reinstate boot-time testing [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

to v2.6.26-rc7 and gave it a quick testing in qemu. But it seems to hang during gdb self-tests at boot:

rcu-torture:--- Start of test: nreaders=6 nfakewriters=4 stat_interval=0 verbose=0 test_no_idle_hz=0 shuffle_interval=3 stutter=5
Clocksource tsc unstable (delta = 617797275 ns)
Total HugeTLB memory allocated, 0
Installing knfsd (copyright (C) 1996 [email protected]).
NTFS driver 2.1.29 [Flags: R/O].
msgmni has been set to 228
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
pci 0000:00:00.0: Limiting direct PCI/PCI transfers
pci 0000:00:01.0: PIIX3: Enabling Passive Release
pci 0000:00:01.0: Activating ISA DMA hang workarounds
pci 0000:00:02.0: Boot video device
Real Time Clock Driver v1.12ac
Linux agpgart interface v0.103
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16450
FDC 0 is a S82078B
brd: module loaded
loop: module loaded
kgdb: Registered I/O driver kgdbts.
kgdbts:RUN plant and detach test

<--- full stop

gdb shows this:

kgdb_handle_exception (evector=0, signo=<value optimized out>,

    ecode=<value optimized out>, regs=0xc0769eec)
    at include/asm/processor.h:688
688             asm volatile("rep; nop" ::: "memory");
(gdb) bt
#0  kgdb_handle_exception (evector=0, signo=<value optimized out>,
    ecode=<value optimized out>, regs=0xc0769eec)
    at include/asm/processor.h:688
#1  0xc011ffa1 in kgdb_notify (self=<value optimized out>, cmd=9,
    ptr=0xc0769e30) at arch/x86/kernel/kgdb.c:478
#2  0xc014f527 in notifier_call_chain (nl=<value optimized out>, val=9,
    v=0xc0769e30, nr_to_call=-1, nr_calls=0x0) at kernel/notifier.c:85
#3  0xc014f925 in __atomic_notifier_call_chain (nh=<value optimized out>,
    val=9, v=0xc0769e30, nr_to_call=-1, nr_calls=0x0) at kernel/notifier.c:174
#4  0xc014f95a in atomic_notifier_call_chain (nh=0x2, val=0, v=0xffffffff)
    at kernel/notifier.c:183
#5  0xc014f98d in notify_die (val=0, str=<value optimized out>,
    regs=<value optimized out>, err=0, trap=0, sig=8) at kernel/notifier.c:564
#6  0xc010a8e8 in do_divide_error (regs=0xc0769eec, error_code=0)
    at arch/x86/kernel/traps_32.c:594
#7  0xc058cdba in page_fault ()
#8  0xc080f780 in per_cpu__init_tss ()
#9  0xc013c255 in do_softirq () at kernel/softirq.c:271
#10 0xc013c255 in do_softirq () at kernel/softirq.c:271
#11 0xc013c3f5 in irq_exit () at kernel/softirq.c:310
#12 0xc011db28 in smp_apic_timer_interrupt (regs=<value optimized out>)
    at arch/x86/kernel/apic_32.c:619

#13 0xc0108ed3 in apic_timer_interrupt () at include/asm/desc.h:309 #14 0xc0106ce0 in ?? () at arch/x86/kernel/process_32.c:466 #15 0xc0768000 in ?? ()
#16 0x00000000 in ?? ()

Without your patches, the kernel gets through here just fine.

These are my RCU-related options:

$ grep RCU .config
# CONFIG_CLASSIC_RCU is not set
CONFIG_PREEMPT_RCU=y
CONFIG_RCU_TRACE=y
CONFIG_RCU_TORTURE_TEST=y
CONFIG_RCU_TORTURE_TEST_RUNNABLE=y

As a convenience feature, it would be nice to have a boot option controlling the run-at-boot as well, simply because it saves a recompile for me :-) Actually, for some reason, the test still starts at boot even when CONFIG_RCU_TORTURE_TEST_RUNNABLE=n. Is a hunk missing from patch #2?

Vegard

Signature · 4 lines
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036
#20 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

Quoted 13 lines · Vegard Nossum
Quoted 6 lines · Paul E. McKenney

This patch makes the non-module rcutorture a bit more friendly to the power-conservation code. This is a rather simple-minded approach. More sophisticated approaches would get rid of the rcutorture tasks while rcutorture execution was suppressed, but attempts thus far to do this have not gone well -- calling rcu_torture_init() from a /proc callout results in oopses.

Hi Paul,

I applied your three patches

Quoted 7 lines

[PATCH] Make rcutorture more vicious: add stutter feature [PATCH] Make rcutorture more vicious: reinstate boot-time testing [PATCH -tip-rcu] Make rcutorture more vicious: make quiescent rcutorture less power-hungry

to v2.6.26-rc7 and gave it a quick testing in qemu. But it seems to hang during gdb self-tests at boot:

Okay, you might disregard that. I'm typing on the very same kernel running on a real machine now, so I assume that it's just qemu's fault. (Actually, setting the number of cpus to 2 instead of 3 would run the kgdb tests, but with a lot of warnings). But qemu is known to have been buggy with these things before. (Sorry for the noise.)

Vegard

Signature · 4 lines
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036
#21 lore raw

PATCH 1/1 Make rcutorture more vicious: invoke RCU readers from irq handlers (timers)

In reply to Paul E. McKenney

This patch allows torturing RCU from irq handlers (timers, in this case). A new module parameter irqreader enables such additional torturing, and is enabled by default. Variants of RCU that do not tolerate readers being called from irq handlers (e.g., SRCU) ignore irqreader.

(No failures observed, but only short tests thus far. And no failures observed thus far from about 10 hours of running stock rcutorture in parallel with 170 kernel builds on a two-CPU machine.)

---

 Documentation/RCU/torture.txt |   23 +++++++------
 kernel/rcutorture.c           |   74 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 84 insertions(+), 13 deletions(-)
Documentation/RCU/torture.txt +14 -9
diff -urpNa -X dontdiff linux-2.6.26-rc4-rcut4-procqp/Documentation/RCU/torture.txt linux-2.6.26-rc4-rcut5-timer/Documentation/RCU/torture.txt
@@ -30,10 +30,10 @@ MODULE PARAMETERS
 
 This module has the following parameters:
 
-nreaders	This is the number of RCU reading threads supported.
-		The default is twice the number of CPUs.  Why twice?
-		To properly exercise RCU implementations with preemptible
-		read-side critical sections.
+irqreaders	Says to invoke RCU readers from irq level.  This is currently
+		done via timers.  Defaults to "1" for variants of RCU that
+		permit this.  (Or, more accurately, variants of RCU that do
+		-not- permit this know to ignore this variable.)
 
 nfakewriters	This is the number of RCU fake writer threads to run.  Fake
 		writer threads repeatedly use the synchronous "wait for
@@ -44,6 +44,16 @@ nfakewriters	This is the number of RCU f
 		to trigger special cases caused by multiple writers, such as
 		the synchronize_srcu() early return optimization.
 
+nreaders	This is the number of RCU reading threads supported.
+		The default is twice the number of CPUs.  Why twice?
+		To properly exercise RCU implementations with preemptible
+		read-side critical sections.
+
+shuffle_interval
+		The number of seconds to keep the test threads affinitied
+		to a particular subset of the CPUs, defaults to 3 seconds.
+		Used in conjunction with test_no_idle_hz.
+
 stat_interval	The number of seconds between output of torture
 		statistics (via printk()).  Regardless of the interval,
 		statistics are printed when the module is unloaded.
@@ -51,11 +61,6 @@ stat_interval	The number of seconds betw
 		be printed -only- when the module is unloaded, and this
 		is the default.
 
-shuffle_interval
-		The number of seconds to keep the test threads affinitied
-		to a particular subset of the CPUs, defaults to 3 seconds.
-		Used in conjunction with test_no_idle_hz.
-
 stutter		The length of time to run the test before pausing for this
 		same period of time.  Defaults to "stutter=5", so as
 		to run and pause for (roughly) five-second intervals.
kernel/rcutorture.c +70 -4

171 lines not on this page · raw message

Applied
#22 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: invoke RCU readers from irq handlers (timers)

Quoted 9 lines · Paul E. McKenney

This patch allows torturing RCU from irq handlers (timers, in this case). A new module parameter irqreader enables such additional torturing, and is enabled by default. Variants of RCU that do not tolerate readers being called from irq handlers (e.g., SRCU) ignore irqreader.

(No failures observed, but only short tests thus far. And no failures observed thus far from about 10 hours of running stock rcutorture in parallel with 170 kernel builds on a two-CPU machine.)

applied to tip/core/rcu - thanks Paul.

Quoted 1 line

+static int irqreader = 1; /* RCU readers from irq (timers). */

Good - this means that in bzImage type of tests (built-in rcutorture, no modules) this new test variant will be activated by default, right?

Ingo

#23 lore raw

Re: [PATCH -tip-rcu] Make rcutorture more vicious: invoke RCU readers from irq handlers (timers)

Quoted 13 lines · Ingo Molnar
Quoted 9 lines · Paul E. McKenney

This patch allows torturing RCU from irq handlers (timers, in this case). A new module parameter irqreader enables such additional torturing, and is enabled by default. Variants of RCU that do not tolerate readers being called from irq handlers (e.g., SRCU) ignore irqreader.

(No failures observed, but only short tests thus far. And no failures observed thus far from about 10 hours of running stock rcutorture in parallel with 170 kernel builds on a two-CPU machine.)

Quoted 6 lines

applied to tip/core/rcu - thanks Paul.

Quoted 1 line

+static int irqreader = 1; /* RCU readers from irq (timers). */

Good - this means that in bzImage type of tests (built-in rcutorture, no modules) this new test variant will be activated by default, right?

Ah, I knew I was forgetting to test something...

OK, checked it out by booting with rcutorture.stat_interval=100 so that I can see the statistics. I enabled rcutorture after the machine booted with "echo 1 > /proc/sys/kernel/rcutorture_runnable". Then I saw the following in dmesg:

rcu-torture: rtc: ffffffff8098b9a0 ver: 16961 tfle: 0 rta: 16961 rtaf: 0 rtf: 16922 rtmbe: 0 nt: 121139
rcu-torture: Reader Pipe: 93315610 6300 0 0 0 0 0 0 0 0 0
rcu-torture: Reader Batch: 93315670 6240 0 0 0 0 0 0 0 0 0
rcu-torture: Free-Block Circulation: 16960 16960 16960 16960 16959 16951 16943 16936 16928 16922 0

The "nt: 121139" is the count of the number of times that an RCU read-side critical section has been invoked from an rcutorture timer handler.

So yes, it does work. ;-)

Thanx, Paul