diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2008-06-18 12:26:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-19 05:22:15 -0400 |
commit | 31a72bce0bd6f3e0114009288bccbc96376eeeca (patch) | |
tree | 14a817fbe0b47511d3119360c47959d48f851140 | |
parent | d120f65f3aaf306c957bc4c82e510f5b0f1e9b27 (diff) |
rcu: make rcutorture more vicious: reinstate boot-time testing
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.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | Documentation/RCU/torture.txt | 21 | ||||
-rw-r--r-- | kernel/rcutorture.c | 9 | ||||
-rw-r--r-- | kernel/sysctl.c | 13 | ||||
-rw-r--r-- | lib/Kconfig.debug | 21 |
4 files changed, 54 insertions, 10 deletions
diff --git a/Documentation/RCU/torture.txt b/Documentation/RCU/torture.txt index 02b3d14c0209..516527d4bc55 100644 --- a/Documentation/RCU/torture.txt +++ b/Documentation/RCU/torture.txt | |||
@@ -10,13 +10,20 @@ status messages via printk(), which can be examined via the dmesg | |||
10 | command (perhaps grepping for "torture"). The test is started | 10 | command (perhaps grepping for "torture"). The test is started |
11 | when the module is loaded, and stops when the module is unloaded. | 11 | when the module is loaded, and stops when the module is unloaded. |
12 | 12 | ||
13 | However, actually setting this config option to "y" results in the system | 13 | CONFIG_RCU_TORTURE_TEST_RUNNABLE |
14 | running the test immediately upon boot, and ending only when the system | 14 | |
15 | is taken down. Normally, one will instead want to build the system | 15 | It is also possible to specify CONFIG_RCU_TORTURE_TEST=y, which will |
16 | with CONFIG_RCU_TORTURE_TEST=m and to use modprobe and rmmod to control | 16 | result in the tests being loaded into the base kernel. In this case, |
17 | the test, perhaps using a script similar to the one shown at the end of | 17 | the CONFIG_RCU_TORTURE_TEST_RUNNABLE config option is used to specify |
18 | this document. Note that you will need CONFIG_MODULE_UNLOAD in order | 18 | whether the RCU torture tests are to be started immediately during |
19 | to be able to end the test. | 19 | boot or whether the /proc/sys/kernel/rcutorture_runnable file is used |
20 | to enable them. This /proc file can be used to repeatedly pause and | ||
21 | restart the tests, regardless of the initial state specified by the | ||
22 | CONFIG_RCU_TORTURE_TEST_RUNNABLE config option. | ||
23 | |||
24 | You will normally -not- want to start the RCU torture tests during boot | ||
25 | (and thus the default is CONFIG_RCU_TORTURE_TEST_RUNNABLE=n), but doing | ||
26 | this can sometimes be useful in finding boot-time bugs. | ||
20 | 27 | ||
21 | 28 | ||
22 | MODULE PARAMETERS | 29 | MODULE PARAMETERS |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 98ae7d168225..27003e2421c7 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -125,6 +125,13 @@ static struct list_head rcu_torture_removed; | |||
125 | 125 | ||
126 | static int stutter_pause_test = 0; | 126 | static int stutter_pause_test = 0; |
127 | 127 | ||
128 | #if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE) | ||
129 | #define RCUTORTURE_RUNNABLE_INIT 1 | ||
130 | #else | ||
131 | #define RCUTORTURE_RUNNABLE_INIT 0 | ||
132 | #endif | ||
133 | int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT; | ||
134 | |||
128 | /* | 135 | /* |
129 | * Allocate an element from the rcu_tortures pool. | 136 | * Allocate an element from the rcu_tortures pool. |
130 | */ | 137 | */ |
@@ -188,7 +195,7 @@ rcu_random(struct rcu_random_state *rrsp) | |||
188 | static void | 195 | static void |
189 | rcu_stutter_wait(void) | 196 | rcu_stutter_wait(void) |
190 | { | 197 | { |
191 | while (stutter_pause_test) | 198 | while (stutter_pause_test || !rcutorture_runnable) |
192 | schedule_timeout_interruptible(1); | 199 | schedule_timeout_interruptible(1); |
193 | } | 200 | } |
194 | 201 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 29116652dca8..c6887cf135c8 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -82,6 +82,9 @@ extern int maps_protect; | |||
82 | extern int sysctl_stat_interval; | 82 | extern int sysctl_stat_interval; |
83 | extern int latencytop_enabled; | 83 | extern int latencytop_enabled; |
84 | extern int sysctl_nr_open_min, sysctl_nr_open_max; | 84 | extern int sysctl_nr_open_min, sysctl_nr_open_max; |
85 | #ifdef CONFIG_RCU_TORTURE_TEST | ||
86 | extern int rcutorture_runnable; | ||
87 | #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ | ||
85 | 88 | ||
86 | /* Constants used for minimum and maximum */ | 89 | /* Constants used for minimum and maximum */ |
87 | #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM) | 90 | #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM) |
@@ -813,6 +816,16 @@ static struct ctl_table kern_table[] = { | |||
813 | .child = key_sysctls, | 816 | .child = key_sysctls, |
814 | }, | 817 | }, |
815 | #endif | 818 | #endif |
819 | #ifdef CONFIG_RCU_TORTURE_TEST | ||
820 | { | ||
821 | .ctl_name = CTL_UNNUMBERED, | ||
822 | .procname = "rcutorture_runnable", | ||
823 | .data = &rcutorture_runnable, | ||
824 | .maxlen = sizeof(int), | ||
825 | .mode = 0644, | ||
826 | .proc_handler = &proc_dointvec, | ||
827 | }, | ||
828 | #endif | ||
816 | /* | 829 | /* |
817 | * NOTE: do not add new entries to this table unless you have read | 830 | * NOTE: do not add new entries to this table unless you have read |
818 | * Documentation/sysctl/ctl_unnumbered.txt | 831 | * Documentation/sysctl/ctl_unnumbered.txt |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f51ba2fa2662..c35a86a516a0 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -537,11 +537,28 @@ config RCU_TORTURE_TEST | |||
537 | on the RCU infrastructure. The kernel module may be built | 537 | on the RCU infrastructure. The kernel module may be built |
538 | after the fact on the running kernel to be tested, if desired. | 538 | after the fact on the running kernel to be tested, if desired. |
539 | 539 | ||
540 | Say Y here if you want RCU torture tests to start automatically | 540 | Say Y here if you want RCU torture tests to be built into |
541 | at boot time (you probably don't). | 541 | the kernel. |
542 | Say M if you want the RCU torture tests to build as a module. | 542 | Say M if you want the RCU torture tests to build as a module. |
543 | Say N if you are unsure. | 543 | Say N if you are unsure. |
544 | 544 | ||
545 | config RCU_TORTURE_TEST_RUNNABLE | ||
546 | bool "torture tests for RCU runnable by default" | ||
547 | depends on RCU_TORTURE_TEST = y | ||
548 | default n | ||
549 | help | ||
550 | This option provides a way to build the RCU torture tests | ||
551 | directly into the kernel without them starting up at boot | ||
552 | time. You can use /proc/sys/kernel/rcutorture_runnable | ||
553 | to manually override this setting. This /proc file is | ||
554 | available only when the RCU torture tests have been built | ||
555 | into the kernel. | ||
556 | |||
557 | Say Y here if you want the RCU torture tests to start during | ||
558 | boot (you probably don't). | ||
559 | Say N here if you want the RCU torture tests to start only | ||
560 | after being manually enabled via /proc. | ||
561 | |||
545 | config KPROBES_SANITY_TEST | 562 | config KPROBES_SANITY_TEST |
546 | bool "Kprobes sanity tests" | 563 | bool "Kprobes sanity tests" |
547 | depends on DEBUG_KERNEL | 564 | depends on DEBUG_KERNEL |