RCU torture-testing kernel module
Subsystems (5)
PATCH 1/1 RCU torture-testing kernel module
Hello!
This patch is a rewrite of the one submitted on October 1st, using modules (http://marc.theaimsgroup.com/?l=linux-kernel&m=112819093522998&w=2).
This rewrite adds a tristate CONFIG_RCU_TORTURE_TEST, which enables an intense torture test of the RCU infratructure. This is needed due to the continued changes to the RCU infrastructure to accommodate dynamic ticks, CPU hotplug, realtime, and so on. Most of the code is in a separate file that is compiled only if the CONFIG variable is set. Documentation on how to run the test and interpret the output is also included.
This code has been tested on i386 and ppc64, and an earlier version of the code has received extensive testing on a number of architectures as part of the PREEMPT_RT patchset.
---
Documentation/RCU/torture.txt | 122 ++++++++++ include/linux/rcupdate.h | 1 kernel/Kconfig.preempt | 12 + kernel/Makefile | 1 kernel/rcupdate.c | 10 kernel/rcutorture.c | 489 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 635 insertions(+)
Documentation/RCU/torture.txt +122 -0
@@ -0,0 +1,122 @@ +RCU Torture Test Operation + + +CONFIG_RCU_TORTURE_TEST + +The CONFIG_RCU_TORTURE_TEST config option is available for all RCU +implementations. It creates an rcutorture kernel module that can +be loaded to run a torture test. The test periodically outputs +status messages via printk(), which can be examined via the dmesg +command (perhaps grepping for "rcutorture"). 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. + + +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. + +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. + Setting the interval to zero causes the statistics to + be printed -only- when the module is unloaded, and this + is the default. + +verbose Enable debug printk()s. Default is disabled. + + +OUTPUT + +The statistics output is as follows: + + rcutorture: --- Start of test: nreaders=16 stat_interval=0 verbose=0 + rcutorture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915 + rcutorture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0 + rcutorture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0 + rcutorture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0 + rcutorture: --- End of test + +The command "dmesg | grep rcutorture:" will extract this information on +most systems. On more esoteric configurations, it may be necessary to +use other commands to access the output of the printk()s used by +the RCU torture test. The printk()s use KERN_ALERT, so they should +be evident. ;-) + +The entries are as follows: + +o "ggp": The number of counter flips (or batches) since boot. + +o "rtc": The hexadecimal address of the structure currently visible + to readers. + +o "ver": The number of times since boot that the rcutw writer task + has changed the structure visible to readers. + +o "tfle": If non-zero, indicates that the "torture freelist" + containing structure to be placed into the "rtc" area is empty. + This condition is important, since it can fool you into thinking + that RCU is working when it is not. :-/ + +o "rta": Number of structures allocated from the torture freelist. + +o "rtaf": Number of allocations from the torture freelist that have + failed due to the list being empty. + +o "rtf": Number of frees into the torture freelist. + +o "Reader Pipe": Histogram of "ages" of structures seen by readers. + If any entries past the first two are non-zero, RCU is broken. + And rcutorture prints the error flag string "!!!" to make sure + you notice. The age of a newly allocated structure is zero, + it becomes one when removed from reader visibility, and is + incremented once per grace period subsequently -- and is freed + after passing through (RCU_TORTURE_PIPE_LEN-2) grace periods. + + The output displayed above was taken from a correctly working + RCU. If you want to see what it looks like when broken, break + it yourself. ;-) + +o "Reader Batch": Another histogram of "ages" of structures seen + by readers, but in terms of counter flips (or batches) rather + than in terms of grace periods. The legal number of non-zero + entries is again two. The reason for this separate view is + that it is easier to get the third entry to show up in the + "Reader Batch" list than in the "Reader Pipe" list. + +o "Free-Block Circulation": Shows the number of torture structures + that have reached a given point in the pipeline. The first element + should closely correspond to the number of structures allocated, + the second to the number that have been removed from reader view, + and all but the last remaining to the corresponding number of + passes through a grace period. The last entry should be zero, + as it is only incremented if a torture structure's counter + somehow gets incremented farther than it should. + + +USAGE + +The following script may be used to torture RCU: + + #!/bin/sh + + modprobe rcutorture + sleep 100 + rmmod rcutorture + dmesg | grep rcutorture: + +The output can be manually inspected for the error flag of "!!!". +One could of course create a more elaborate script that automatically +checked for such errors.
include/linux/rcupdate.h +1 -0
@@ -274,6 +274,7 @@ static inline int rcu_pending(int cpu)extern void rcu_init (void );extern void rcu_check_callbacks (int cpu,int user);extern void rcu_restart_cpu (int cpu); +extern long rcu_batches_completed (void );/* Exported interfaces */ extern void FASTCALL(call_rcu(struct rcu_head *head,
kernel/Kconfig.preempt +12 -0
@@ -63,3 +63,15 @@ config PREEMPT_BKL Say Y here if you are building a kernel for a desktop system. Say N if you are unsure. +config RCU_TORTURE_TEST + tristate "torture tests for RCU" + 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 start automatically + at boot time (you probably don't). + Say M if you want the RCU torture tests to build as a module. + Say N if you are unsure.
kernel/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_DETECT_SOFTLOCKUP) += softl obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_SECCOMP) += seccomp.o +obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/rcupdate.c +10 -0
@@ -144,6 +144,15 @@ void fastcall call_rcu_bh(struct rcu_hea }/* +* Return the number of RCU batches processed thus far. Useful +* for debug and statistics. +*/ +long rcu_batches_completed (void ) +{ +return rcu_ctrlblk.completed; +} + +/* * Invoke the completed RCU callbacks. They are expected to be in * a per-cpu list. */
@@ -490,6 +499,7 @@ void synchronize_kernel(void) }module_param (maxbatch, int,0 ); +EXPORT_SYMBOL_GPL (rcu_batches_completed);EXPORT_SYMBOL (call_rcu);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL (call_rcu_bh);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL_GPL (synchronize_rcu);
kernel/rcutorture.c +489 -0
489 lines not on this page · raw message
Hi Paul,
kernel/Kconfig.preempt config PREEMPT_BKL · line 68
Quoted 9 lines · Paul E. McKenney
kernel/Kconfig.preempt +3
-0@@ -63,3 +63,15 @@ config PREEMPT_BKL Say Y here if you are building a kernel for a desktop system. Say N if you are unsure. +config RCU_TORTURE_TEST + tristate "torture tests for RCU" + default n
Please put this into lib/Kconfig.debug and make it dependent on DEBUG_KERNEL there, which illustrates its actual purpose much better.
Regards
Ingo Oeser
Quoted 9 lines · Ingo Oeser
Hi Paul,
Quoted 6 lines · Paul E. McKenney
kernel/Kconfig.preempt +0
-0@@ -63,3 +63,15 @@ config PREEMPT_BKL Say Y here if you are building a kernel for a desktop system. Say N if you are unsure.
Quoted 6 lines
kernel/Kconfig.preempt config PREEMPT_BKL · line 68
Quoted 3 lines
kernel/Kconfig.preempt +3
-0+config RCU_TORTURE_TEST + tristate "torture tests for RCU" + default nPlease put this into
lib/Kconfig.debugand make it dependent onDEBUG_KERNELthere, which illustrates its actual purpose much better.
If I make it depend on DEBUG_KERNEL, I get other extraneous debug code as well, for example, in verify_mm_writelocked(). That said, I agree that lib/Kconfig.debug seems a better place for this config variable than does kernel/Kconfig.preempt. Perhaps if at some future time there are more such tests, there should be a TEST_KERNEL and a Kconfig.test.
I left the source file in kernel, since it is convenient for it to be near the code that it is testing.
So, how about the following?
Thanx, Paul
---
Documentation/RCU/torture.txt | 122 ++++++++++ include/linux/rcupdate.h | 1 kernel/Kconfig.preempt | 1 kernel/Makefile | 1 kernel/rcupdate.c | 10 kernel/rcutorture.c | 489 ++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 12 + 7 files changed, 635 insertions(+), 1 deletion(-)
Documentation/RCU/torture.txt +122 -0
@@ -0,0 +1,122 @@ +RCU Torture Test Operation + + +CONFIG_RCU_TORTURE_TEST + +The CONFIG_RCU_TORTURE_TEST config option is available for all RCU +implementations. It creates an rcutorture kernel module that can +be loaded to run a torture test. The test periodically outputs +status messages via printk(), which can be examined via the dmesg +command (perhaps grepping for "rcutorture"). 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. + + +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. + +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. + Setting the interval to zero causes the statistics to + be printed -only- when the module is unloaded, and this + is the default. + +verbose Enable debug printk()s. Default is disabled. + + +OUTPUT + +The statistics output is as follows: + + rcutorture: --- Start of test: nreaders=16 stat_interval=0 verbose=0 + rcutorture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915 + rcutorture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0 + rcutorture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0 + rcutorture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0 + rcutorture: --- End of test + +The command "dmesg | grep rcutorture:" will extract this information on +most systems. On more esoteric configurations, it may be necessary to +use other commands to access the output of the printk()s used by +the RCU torture test. The printk()s use KERN_ALERT, so they should +be evident. ;-) + +The entries are as follows: + +o "ggp": The number of counter flips (or batches) since boot. + +o "rtc": The hexadecimal address of the structure currently visible + to readers. + +o "ver": The number of times since boot that the rcutw writer task + has changed the structure visible to readers. + +o "tfle": If non-zero, indicates that the "torture freelist" + containing structure to be placed into the "rtc" area is empty. + This condition is important, since it can fool you into thinking + that RCU is working when it is not. :-/ + +o "rta": Number of structures allocated from the torture freelist. + +o "rtaf": Number of allocations from the torture freelist that have + failed due to the list being empty. + +o "rtf": Number of frees into the torture freelist. + +o "Reader Pipe": Histogram of "ages" of structures seen by readers. + If any entries past the first two are non-zero, RCU is broken. + And rcutorture prints the error flag string "!!!" to make sure + you notice. The age of a newly allocated structure is zero, + it becomes one when removed from reader visibility, and is + incremented once per grace period subsequently -- and is freed + after passing through (RCU_TORTURE_PIPE_LEN-2) grace periods. + + The output displayed above was taken from a correctly working + RCU. If you want to see what it looks like when broken, break + it yourself. ;-) + +o "Reader Batch": Another histogram of "ages" of structures seen + by readers, but in terms of counter flips (or batches) rather + than in terms of grace periods. The legal number of non-zero + entries is again two. The reason for this separate view is + that it is easier to get the third entry to show up in the + "Reader Batch" list than in the "Reader Pipe" list. + +o "Free-Block Circulation": Shows the number of torture structures + that have reached a given point in the pipeline. The first element + should closely correspond to the number of structures allocated, + the second to the number that have been removed from reader view, + and all but the last remaining to the corresponding number of + passes through a grace period. The last entry should be zero, + as it is only incremented if a torture structure's counter + somehow gets incremented farther than it should. + + +USAGE + +The following script may be used to torture RCU: + + #!/bin/sh + + modprobe rcutorture + sleep 100 + rmmod rcutorture + dmesg | grep rcutorture: + +The output can be manually inspected for the error flag of "!!!". +One could of course create a more elaborate script that automatically +checked for such errors.
include/linux/rcupdate.h +1 -0
@@ -274,6 +274,7 @@ static inline int rcu_pending(int cpu)extern void rcu_init (void );extern void rcu_check_callbacks (int cpu,int user);extern void rcu_restart_cpu (int cpu); +extern long rcu_batches_completed (void );/* Exported interfaces */ extern void FASTCALL(call_rcu(struct rcu_head *head,
kernel/Kconfig.preempt +0 -1
@@ -62,4 +62,3 @@ config PREEMPT_BKL Say Y here if you are building a kernel for a desktop system. Say N if you are unsure. -
kernel/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_DETECT_SOFTLOCKUP) += softl obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_SECCOMP) += seccomp.o +obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/rcupdate.c +10 -0
@@ -144,6 +144,15 @@ void fastcall call_rcu_bh(struct rcu_hea }/* +* Return the number of RCU batches processed thus far. Useful +* for debug and statistics. +*/ +long rcu_batches_completed (void ) +{ +return rcu_ctrlblk.completed; +} + +/* * Invoke the completed RCU callbacks. They are expected to be in * a per-cpu list. */
@@ -490,6 +499,7 @@ void synchronize_kernel(void) }module_param (maxbatch, int,0 ); +EXPORT_SYMBOL_GPL (rcu_batches_completed);EXPORT_SYMBOL (call_rcu);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL (call_rcu_bh);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL_GPL (synchronize_rcu);
kernel/rcutorture.c +489 -0
489 lines not on this page · raw message
lib/Kconfig.debug +12 -0
@@ -178,3 +178,15 @@ config FRAME_POINTER on some architectures or you use external debuggers. If you don't debug the kernel, you can say N. +config RCU_TORTURE_TEST + tristate "torture tests for RCU" + 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 start automatically + at boot time (you probably don't). + Say M if you want the RCU torture tests to build as a module. + Say N if you are unsure.
Hi Paul,
Quoted 11 lines · Paul E. McKenney
Quoted 7 lines · Ingo Oeser
lib/Kconfig.debug config FRAME_POINTER · line 183
Quoted 3 lines · Paul E. McKenney
lib/Kconfig.debug +3
-0+config RCU_TORTURE_TEST + tristate "torture tests for RCU" + default nPlease put this into
lib/Kconfig.debugand make it dependent onDEBUG_KERNELthere, which illustrates its actual purpose much better.If I make it depend on
DEBUG_KERNEL, I get other extraneous debug code as well, for example, inverify_mm_writelocked().
Oh, this seems to be either not intended or misguided.
DEBUG_KERNEL should do nothing more than showing the debugging options.
E.g. I don't expect to enable any additional code in an unrelated file, if I enable Magic-SysRQ on an embedded, unattended device to be able to analyze potential problems via serial console.
@Andrew: Would you accept a patch to fix that?
My idea to put the option into lib/Kconfig.debug was just to ease maintainence, once it is dependend on DEBUG_KERNEL.
On the other hand it makes sense to add another option TEST_KERNEL and put some existing kernel internal test suites under that.
@Andrew: Would you accept a patch for this?
Regards
Ingo Oeser
Quoted 3 lines · Ingo Oeser
DEBUG_KERNELshould do nothing more than showing the debugging
options.
yup.
Quoted 5 lines
E.g. I don't expect to enable any additional code in an unrelated file, if I enable Magic-SysRQ on an embedded, unattended device to be able to analyze potential problems via serial console.
@Andrew: Would you accept a patch to fix that?
more yup.
Quoted 7 lines · Andrew Morton
Quoted 3 lines · Ingo Oeser
DEBUG_KERNELshould do nothing more than showing the debugging
options.yup.
Quoted 7 lines
Quoted 5 lines
E.g. I don't expect to enable any additional code in an unrelated file, if I enable Magic-SysRQ on an embedded, unattended device to be able to analyze potential problems via serial console.
@Andrew: Would you accept a patch to fix that?
more yup.
OK, the attached patch covers this and also fixes the redundant #include that Greg KH spotted.
Thoughts?
Thanx, Paul
This patch is a rewrite of the one submitted on October 1st, using modules (http://marc.theaimsgroup.com/?l=linux-kernel&m=112819093522998&w=2).
This rewrite adds a tristate CONFIG_RCU_TORTURE_TEST, which enables an intense torture test of the RCU infratructure. This is needed due to the continued changes to the RCU infrastructure to accommodate dynamic ticks, CPU hotplug, realtime, and so on. Most of the code is in a separate file that is compiled only if the CONFIG variable is set. Documentation on how to run the test and interpret the output is also included.
This code has been tested on i386 and ppc64, and an earlier version of the code has received extensive testing on a number of architectures as part of the PREEMPT_RT patchset.
---
Documentation/RCU/torture.txt | 122 ++++++++++ include/linux/rcupdate.h | 1 kernel/Makefile | 1 kernel/rcupdate.c | 10 kernel/rcutorture.c | 487 ++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 21 + mm/mmap.c | 2 7 files changed, 643 insertions(+), 1 deletion(-)
Documentation/RCU/torture.txt +122 -0
@@ -0,0 +1,122 @@ +RCU Torture Test Operation + + +CONFIG_RCU_TORTURE_TEST + +The CONFIG_RCU_TORTURE_TEST config option is available for all RCU +implementations. It creates an rcutorture kernel module that can +be loaded to run a torture test. The test periodically outputs +status messages via printk(), which can be examined via the dmesg +command (perhaps grepping for "rcutorture"). 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. + + +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. + +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. + Setting the interval to zero causes the statistics to + be printed -only- when the module is unloaded, and this + is the default. + +verbose Enable debug printk()s. Default is disabled. + + +OUTPUT + +The statistics output is as follows: + + rcutorture: --- Start of test: nreaders=16 stat_interval=0 verbose=0 + rcutorture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915 + rcutorture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0 + rcutorture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0 + rcutorture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0 + rcutorture: --- End of test + +The command "dmesg | grep rcutorture:" will extract this information on +most systems. On more esoteric configurations, it may be necessary to +use other commands to access the output of the printk()s used by +the RCU torture test. The printk()s use KERN_ALERT, so they should +be evident. ;-) + +The entries are as follows: + +o "ggp": The number of counter flips (or batches) since boot. + +o "rtc": The hexadecimal address of the structure currently visible + to readers. + +o "ver": The number of times since boot that the rcutw writer task + has changed the structure visible to readers. + +o "tfle": If non-zero, indicates that the "torture freelist" + containing structure to be placed into the "rtc" area is empty. + This condition is important, since it can fool you into thinking + that RCU is working when it is not. :-/ + +o "rta": Number of structures allocated from the torture freelist. + +o "rtaf": Number of allocations from the torture freelist that have + failed due to the list being empty. + +o "rtf": Number of frees into the torture freelist. + +o "Reader Pipe": Histogram of "ages" of structures seen by readers. + If any entries past the first two are non-zero, RCU is broken. + And rcutorture prints the error flag string "!!!" to make sure + you notice. The age of a newly allocated structure is zero, + it becomes one when removed from reader visibility, and is + incremented once per grace period subsequently -- and is freed + after passing through (RCU_TORTURE_PIPE_LEN-2) grace periods. + + The output displayed above was taken from a correctly working + RCU. If you want to see what it looks like when broken, break + it yourself. ;-) + +o "Reader Batch": Another histogram of "ages" of structures seen + by readers, but in terms of counter flips (or batches) rather + than in terms of grace periods. The legal number of non-zero + entries is again two. The reason for this separate view is + that it is easier to get the third entry to show up in the + "Reader Batch" list than in the "Reader Pipe" list. + +o "Free-Block Circulation": Shows the number of torture structures + that have reached a given point in the pipeline. The first element + should closely correspond to the number of structures allocated, + the second to the number that have been removed from reader view, + and all but the last remaining to the corresponding number of + passes through a grace period. The last entry should be zero, + as it is only incremented if a torture structure's counter + somehow gets incremented farther than it should. + + +USAGE + +The following script may be used to torture RCU: + + #!/bin/sh + + modprobe rcutorture + sleep 100 + rmmod rcutorture + dmesg | grep rcutorture: + +The output can be manually inspected for the error flag of "!!!". +One could of course create a more elaborate script that automatically +checked for such errors.
include/linux/rcupdate.h +1 -0
@@ -274,6 +274,7 @@ static inline int rcu_pending(int cpu)extern void rcu_init (void );extern void rcu_check_callbacks (int cpu,int user);extern void rcu_restart_cpu (int cpu); +extern long rcu_batches_completed (void );/* Exported interfaces */ extern void FASTCALL(call_rcu(struct rcu_head *head,
kernel/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_DETECT_SOFTLOCKUP) += softl obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_SECCOMP) += seccomp.o +obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/rcupdate.c +10 -0
@@ -144,6 +144,15 @@ void fastcall call_rcu_bh(struct rcu_hea }/* +* Return the number of RCU batches processed thus far. Useful +* for debug and statistics. +*/ +long rcu_batches_completed (void ) +{ +return rcu_ctrlblk.completed; +} + +/* * Invoke the completed RCU callbacks. They are expected to be in * a per-cpu list. */
@@ -490,6 +499,7 @@ void synchronize_kernel(void) }module_param (maxbatch, int,0 ); +EXPORT_SYMBOL_GPL (rcu_batches_completed);EXPORT_SYMBOL (call_rcu);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL (call_rcu_bh);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL_GPL (synchronize_rcu);
kernel/rcutorture.c +487 -0
487 lines not on this page · raw message
lib/Kconfig.debug +21 -0
@@ -168,6 +168,14 @@ config DEBUG_FS If unsure, say N. +config DEBUG_VM + bool "Debug VM" + depends on DEBUG_KERNEL + help + Enable this to debug the virtual-memory system. + + If unsure, say N. + config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML)
@@ -178,3 +186,16 @@ config FRAME_POINTER on some architectures or you use external debuggers. If you don't debug the kernel, you can say N. +config RCU_TORTURE_TEST + tristate "torture tests for RCU" + depends on DEBUG_KERNEL + 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 start automatically + at boot time (you probably don't). + Say M if you want the RCU torture tests to build as a module. + Say N if you are unsure.
mm/mmap.c +1 -1
@@ -1821,7 +1821,7 @@ asmlinkage long sys_munmap(unsigned longstatic inline void verify_mm_writelocked (struct mm_struct *mm) { -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_DEBUG_VM if (unlikely (down_read_trylock (&mm->mmap_sem))) {WARN_ON (1 );up_read (&mm->mmap_sem);
Hi Paul,
Quoted 4 lines · Paul E. McKenney
OK, the attached patch covers this and also fixes the redundant #include that Greg KH spotted.
Thoughts?
Wonderful. Great job!
Regards
Ingo Oeser
Quoted 12 lines · Paul E. McKenney
Quoted 11 lines · Andrew Morton
Quoted 3 lines · Ingo Oeser
DEBUG_KERNELshould do nothing more than showing the debugging
options.yup.
Quoted 4 lines
E.g. I don't expect to enable any additional code in an unrelated file, if I enable Magic-SysRQ on an embedded, unattended device to be able to analyze potential problems via serial console.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
@Andrew: Would you accept a patch to fix that?
more yup.
OK, the attached patch covers this and also fixes the redundant #include that Greg KH spotted.
Thoughts?
Paul,
I enabled RCU_TORTURE_TEST in 2.6.14-rc5-mm1. My machine took 10+ minutes to boot and let me login. RCU kthreads are hogging the CPU. Is this expected ?
Thanks,
Badari
top - 15:32:55 up 22 min, 1 user, load average: 10.96, 12.07, 9.18
Tasks: 94 total, 11 running, 83 sleeping, 0 stopped, 0 zombie Cpu(s): 2.5% us, 97.5% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si Mem: 7145152k total, 350656k used, 6794496k free, 50876k buffers Swap: 1048784k total, 0k used, 1048784k free, 160168k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 168 root 20 -5 0 0 0 R 50.2 0.0 10:44.01
rcu_torture_rea
171 root 20 -5 0 0 0 R 50.2 0.0 10:47.86rcu_torture_rea
175 root 20 -5 0 0 0 R 50.2 0.0 10:49.83rcu_torture_rea
169 root 20 -5 0 0 0 R 49.9 0.0 10:47.07rcu_torture_rea
172 root 20 -5 0 0 0 R 49.9 0.0 10:50.04rcu_torture_rea
173 root 20 -5 0 0 0 R 49.9 0.0 10:43.79rcu_torture_rea
174 root 20 -5 0 0 0 R 49.9 0.0 10:39.16rcu_torture_rea
170 root 20 -5 0 0 0 R 40.2 0.0 10:38.68rcu_torture_rea
Quoted 3 lines · Badari Pulavarty
Paul,
I enabled
RCU_TORTURE_TESTin 2.6.14-rc5-mm1. My machine took 10+ minutes to boot and let me login. RCU kthreads are hogging the CPU. Is this expected ?
Uhh... It's a torture test. What exactly do _you_ expect it will do? I think the idea is to enable it as a module and load it when you want to start torture testing, and unload it when done. "TORTURE_TEST"s are not for production systems :-D.
Cheers,
Kyle Moffett
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/E/U d- s++: a18 C++++>$ ULBX*++++(+++)>$ P++++(+++)>$ L++++(+++)>$ !E- W+++(++) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+ PGP+ t+(+++) 5 X R? !tv-(--) b++++(++) DI+(++) D+++ G e>++++$ h*(+)>++$ r%(--) !y?-(--) ------END GEEK CODE BLOCK------
Quoted 11 lines · Kyle Moffett
Quoted 5 lines · Badari Pulavarty
Paul,
I enabled
RCU_TORTURE_TESTin 2.6.14-rc5-mm1. My machine took 10+ minutes to boot and let me login. RCU kthreads are hogging the CPU. Is this expected ?Uhh... It's a torture test. What exactly do _you_ expect it will do? I think the idea is to enable it as a module and load it when you want to start torture testing, and unload it when done. "TORTURE_TEST"s are not for production systems :-D.
I was expecting that - even if its compiled in, there would be a way to turn on/off the tests from /proc or something :)
Thanks,
Badari
Quoted 4 lines · Badari Pulavarty
Quoted 1 line · Kyle Moffett
Uhh... It's a torture test. What exactly do _you_ expect it will do? I think the idea is to enable it as a module and load it when you want to start torture testing, and unload it when done. "TORTURE_TEST"s are not for production systems :-D.
I was expecting that - even if its compiled in, there would be a way to turn on/off the tests from /proc or something :)
From the docs:
Quoted 7 lines
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.
MODULE PARAMETERS
[snip description of parameters]
You turn the test on and off by inserting and removing the module, as I found in about 30 seconds by reading the top of the patch.
Cheers,
Kyle Moffett
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/E/U d- s++: a18 C++++>$ ULBX*++++(+++)>$ P++++(+++)>$ L++++(+++)>$ !E- W+++(++) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+ PGP+ t+(+++) 5 X R? !tv-(--) b++++(++) DI+(++) D+++ G e>++++$ h*(+)>++$ r%(--) !y?-(--) ------END GEEK CODE BLOCK------
Quoted 4 lines · Badari Pulavarty
Quoted 3 lines · Kyle Moffett
Quoted 2 lines · Badari Pulavarty
Paul,
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
I enabled
RCU_TORTURE_TESTin 2.6.14-rc5-mm1. My machine took 10+ minutes to boot and let me login. RCU kthreads are hogging the CPU. Is this expected ?Uhh... It's a torture test. What exactly do _you_ expect it will do? I think the idea is to enable it as a module and load it when you want to start torture testing, and unload it when done. "TORTURE_TEST"s are not for production systems :-D.
Hey, and if you think that is fun, just try compiling it in (CONFIG_RCU_TORTURE_TEST=y) and then build rcutorture.c as an external module, then insmod'ing it! You get two torture tests running concurrently. I found this out the hard way while learning how the "tristate" directive works.
Quoted 2 lines
I was expecting that - even if its compiled in, there would be a way to turn on/off the tests from /proc or something :)
Well, I submitted -that- patch a couple of weeks ago, and it was roundly denounced for /proc pollution, hence the shiny new modules implementation of it.
I must admit I was rather negative on the idea of using modules for this sort of thing, but after actually trying it, I found that it really works quite nicely. The module loader even parses all your arguments for you, so you can very easily parameterize the tests.
Thanx, Paul
Quoted 20 lines · Badari Pulavarty
Quoted 19 lines · Paul E. McKenney
Quoted 7 lines · Andrew Morton
Quoted 3 lines · Ingo Oeser
DEBUG_KERNELshould do nothing more than showing the debugging
options.yup.
Quoted 7 lines
Quoted 5 lines
E.g. I don't expect to enable any additional code in an unrelated file, if I enable Magic-SysRQ on an embedded, unattended device to be able to analyze potential problems via serial console.
@Andrew: Would you accept a patch to fix that?
more yup.
OK, the attached patch covers this and also fixes the redundant #include that Greg KH spotted.
Quoted 7 lines
Quoted 1 line
Thoughts?
Paul,
I enabled
RCU_TORTURE_TESTin 2.6.14-rc5-mm1. My machine took 10+ minutes to boot and let me login. RCU kthreads are hogging the CPU. Is this expected ?
If you did CONFIG_RCU_TORTURE_TEST=y, then yes.
I do CONFIG_RCU_TORTURE_TEST=m so that I can just do a "modprobe rcutorture" when I want to start the test. Also allows me to do several runs per boot with different arguments.
I wonder if I should somehow exclude "=y" on this one -- I haven't come up with any case where it is useful.
Thoughts?
Thanx, Paul
Quoted 31 lines
Thanks,
Badaritop - 15:32:55 up 22 min, 1 user, load average: 10.96, 12.07, 9.18
Tasks: 94 total, 11 running, 83 sleeping, 0 stopped, 0 zombie Cpu(s): 2.5% us, 97.5% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si Mem: 7145152k total, 350656k used, 6794496k free, 50876k buffers Swap: 1048784k total, 0k used, 1048784k free, 160168k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 168 root 20 -5 0 0 0 R 50.2 0.0 10:44.01
rcu_torture_rea
171 root 20 -5 0 0 0 R 50.2 0.0 10:47.86rcu_torture_rea
175 root 20 -5 0 0 0 R 50.2 0.0 10:49.83rcu_torture_rea
169 root 20 -5 0 0 0 R 49.9 0.0 10:47.07rcu_torture_rea
172 root 20 -5 0 0 0 R 49.9 0.0 10:50.04rcu_torture_rea
173 root 20 -5 0 0 0 R 49.9 0.0 10:43.79rcu_torture_rea
174 root 20 -5 0 0 0 R 49.9 0.0 10:39.16rcu_torture_rea
170 root 20 -5 0 0 0 R 40.2 0.0 10:38.68rcu_torture_rea
Quoted 23 lines · Paul E. McKenney
Quoted 22 lines · Badari Pulavarty
Quoted 20 lines · Paul E. McKenney
Quoted 7 lines · Andrew Morton
Quoted 3 lines · Ingo Oeser
DEBUG_KERNELshould do nothing more than showing the debugging
options.yup.
Quoted 7 lines
Quoted 5 lines
E.g. I don't expect to enable any additional code in an unrelated file, if I enable Magic-SysRQ on an embedded, unattended device to be able to analyze potential problems via serial console.
@Andrew: Would you accept a patch to fix that?
more yup.
OK, the attached patch covers this and also fixes the redundant #include that Greg KH spotted.
Thoughts?
Quoted 7 lines
Quoted 5 lines
Paul,
I enabled
RCU_TORTURE_TESTin 2.6.14-rc5-mm1. My machine took 10+ minutes to boot and let me login. RCU kthreads are hogging the CPU. Is this expected ?If you did
CONFIG_RCU_TORTURE_TEST=y, then yes.
Yep. I have a bad habit of saying "y" to all interesting stuff in -mm kernel (while doing make oldconfig). I don't use "modules", initrd etc..
I compiled it as a module. No harm done :)
Thanks,
Badari
Quoted 1 line · Paul E. McKenney
+#include <
linux/debugfs.h>
Not needed, as you don't make any debugfs calls.
thanks,
greg k-h