2.6.17 rcutorture: add ops vector to test multiple RCUs
Subsystems (2)
cover 2.6.17 rcutorture: add ops vector to test multiple RCUs
This series contains the following:
o Catch-up updates to the rcutorture documentation.
o Ops vector for rcutorture to allow it to test multiple RCU
implementations (e.g., both call_rcu() and call_rcu_bh() currently in mainline).
o Add operations to allow the _bh variant of RCU to be tested.
Thanx, Paul
PATCH 1/3 rcutorture: catchup doc fixes for idle-hz tests
This just catches the RCU torture documentation up with the recent fixes that test RCU for architectures that turn of the scheduling-clock interrupt for idle CPUs and the addition of a SUCCESS/FAILURE indication, fixing up an obsolete comment as well.
---
Documentation/RCU/torture.txt | 12 +++++++++++- kernel/rcutorture.c | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-)
Documentation/RCU/torture.txt +11 -1
@@ -35,6 +35,15 @@ 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. Used in conjunction + with test_no_idle_hz. + +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. + verbose Enable debug printk()s. Default is disabled.
@@ -119,4 +128,5 @@ The following script may be used to tort 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. +checked for such errors. The "rmmod" command forces a "SUCCESS" or +"FAILURE" indication to be printk()ed.
kernel/rcutorture.c +1 -1
@@ -1,5 +1,5 @@/* -* Read-Copy Update /proc-based torture test facility +* Read-Copy Update module-based torture test facility * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
PATCH 2/3 rcutorture: add ops vector and Classic RCU ops
In reply to Paul E. McKenneyAdd an ops vector to rcutorture, and add the ops for Classic RCU. Update the rcutorture documentation to reflect slight change to the dmesg formats.
---
Documentation/RCU/torture.txt | 22 +++-- kernel/rcutorture.c | 163 ++++++++++++++++++++++++++++++------------ 2 files changed, 133 insertions(+), 52 deletions(-)
Documentation/RCU/torture.txt +13 -9
@@ -7,7 +7,7 @@ The CONFIG_RCU_TORTURE_TEST config optio 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 +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
@@ -44,6 +44,10 @@ test_no_idle_hz Whether or not to test t a kernel that disables the scheduling-clock interrupt to idle CPUs. Boolean parameter, "1" to test, "0" otherwise. +torture_type The type of RCU to test: "rcu" for the rcu_read_lock() + API, "rcu_bh" for the rcu_read_lock_bh() API, and "srcu" + for the "srcu_read_lock()" API. + verbose Enable debug printk()s. Default is disabled.
@@ -51,14 +55,14 @@ 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 + rcu-torture: --- Start of test: nreaders=16 stat_interval=0 verbose=0 + rcu-torture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915 + rcu-torture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0 + rcu-torture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0 + rcu-torture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0 + rcu-torture: --- End of test -The command "dmesg | grep rcutorture:" will extract this information on +The command "dmesg | grep torture:" 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
@@ -124,7 +128,7 @@ The following script may be used to tort modprobe rcutorture sleep 100 rmmod rcutorture - dmesg | grep rcutorture: + dmesg | grep torture: The output can be manually inspected for the error flag of "!!!". One could of course create a more elaborate script that automatically
kernel/rcutorture.c +120 -43
277 lines not on this page · raw message
cover rcutorture: add call_rcu_bh() operations
In reply to Paul E. McKenneyAdd operations for the call_rcu_bh() variant of RCU. Also add an rcu_batches_completed_bh() function, which is needed by rcutorture.
---
include/linux/rcupdate.h | 1 + kernel/rcupdate.c | 10 ++++++++++ kernel/rcutorture.c | 40 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-)
include/linux/rcupdate.h +1 -0
@@ -258,6 +258,7 @@ 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 ); +extern long rcu_batches_completed_bh (void );/* Exported interfaces */ extern void FASTCALL(call_rcu(struct rcu_head *head,
kernel/rcupdate.c +10 -0
@@ -182,6 +182,15 @@ long rcu_batches_completed(void)return rcu_ctrlblk.completed; } +/* +* Return the number of RCU batches processed thus far. Useful +* for debug and statistics. +*/ +long rcu_batches_completed_bh (void ) +{ +return rcu_bh_ctrlblk.completed; +} +static void rcu_barrier_callback (struct rcu_head *notused) {if (atomic_dec_and_test (&rcu_barrier_cpu_count))
@@ -627,6 +636,7 @@ module_param(qlowmark, int, 0);module_param (rsinterval, int,0 );#endif EXPORT_SYMBOL_GPL (rcu_batches_completed); +EXPORT_SYMBOL_GPL (rcu_batches_completed_bh);EXPORT_SYMBOL_GPL_FUTURE (call_rcu);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL_GPL_FUTURE (call_rcu_bh);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL_GPL (synchronize_rcu);
kernel/rcutorture.c +38 -2
@@ -66,7 +66,7 @@ MODULE_PARM_DESC(test_no_idle_hz, "Testmodule_param (shuffle_interval, int,0 );MODULE_PARM_DESC (shuffle_interval,"Number of seconds between shuffles" );module_param (torture_type, charp,0 ); -MODULE_PARM_DESC (torture_type,"Type of RCU to torture (rcu)" ); +MODULE_PARM_DESC (torture_type,"Type of RCU to torture (rcu, rcu_bh)" );#define TORTURE_FLAG "-torture:"#define PRINTK_STRING (s) \
@@ -246,8 +246,44 @@ static struct rcu_torture_ops rcu_ops = .name = "rcu" }; +/* +* Definitions for rcu_bh torture testing. +*/ + +static int rcu_bh_torture_read_lock (void ) +{ +rcu_read_lock_bh (); +return 0 ; +} + +static void rcu_bh_torture_read_unlock (int idx) +{ +rcu_read_unlock_bh (); +} + +static int rcu_bh_torture_completed (void ) +{ +return rcu_batches_completed_bh (); +} + +static void rcu_bh_torture_deferred_free (struct rcu_torture *p) +{ +call_rcu_bh (&p->rtort_rcu, rcu_torture_cb); +} + +static struct rcu_torture_ops rcu_bh_ops = { + .init =NULL , + .cleanup =NULL , + .readlock = rcu_bh_torture_read_lock, + .readunlock = rcu_bh_torture_read_unlock, + .completed = rcu_bh_torture_completed, + .deferredfree = rcu_bh_torture_deferred_free, + .stats =NULL , + .name ="rcu_bh" +}; +static struct rcu_torture_ops *torture_ops[] = - { &rcu_ops,NULL }; + { &rcu_ops, &rcu_bh_ops,NULL };/* * RCU torture writer kthread. Repeatedly substitutes a new structure
Re: [PATCH 0/3] rcutorture: add call_rcu_bh() operations
And that subject line should of course be:
[PATCH 3/3] rcutorture: add call_rcu_bh() operations
I guess I need to start using quilt or something... :-/
Thanx, Paul
Quoted 107 lines · Paul E. McKenney
Add operations for the
call_rcu_bh()variant of RCU. Also add anrcu_batches_completed_bh()function, which is needed by rcutorture.Signed-off-by Paul E. McKenney <[email protected]>---
include/linux/rcupdate.h | 1 + kernel/rcupdate.c | 10 ++++++++++ kernel/rcutorture.c | 40 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-)diff -urpNa -X dontdiff
linux-2.6.17-tortureops/include/linux/rcupdate.hlinux-2.6.17-torturercu_bh/include/linux/rcupdate.hinclude/linux/rcupdate.h +1
-0@@ -258,6 +258,7 @@ 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 ); +extern long rcu_batches_completed_bh (void );/* Exported interfaces */ extern void FASTCALL(call_rcu(struct rcu_head *head,diff -urpNa -X dontdiff
linux-2.6.17-tortureops/kernel/rcupdate.clinux-2.6.17-torturercu_bh/kernel/rcupdate.ckernel/rcupdate.c +10
-0@@ -182,6 +182,15 @@ long rcu_batches_completed(void)return rcu_ctrlblk.completed; } +/* +* Return the number of RCU batches processed thus far. Useful +* for debug and statistics. +*/ +long rcu_batches_completed_bh (void ) +{ +return rcu_bh_ctrlblk.completed; +} +static void rcu_barrier_callback (struct rcu_head *notused) {if (atomic_dec_and_test (&rcu_barrier_cpu_count))@@ -627,6 +636,7 @@ module_param(qlowmark, int, 0);module_param (rsinterval, int,0 );#endif EXPORT_SYMBOL_GPL (rcu_batches_completed); +EXPORT_SYMBOL_GPL (rcu_batches_completed_bh);EXPORT_SYMBOL_GPL_FUTURE (call_rcu);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL_GPL_FUTURE (call_rcu_bh);/* WARNING: GPL-only in April 2006. */ EXPORT_SYMBOL_GPL (synchronize_rcu);diff -urpNa -X dontdiff
linux-2.6.17-tortureops/kernel/rcutorture.clinux-2.6.17-torturercu_bh/kernel/rcutorture.ckernel/rcutorture.c +38
-2@@ -66,7 +66,7 @@ MODULE_PARM_DESC(test_no_idle_hz, "Testmodule_param (shuffle_interval, int,0 );MODULE_PARM_DESC (shuffle_interval,"Number of seconds between shuffles" );module_param (torture_type, charp,0 ); -MODULE_PARM_DESC (torture_type,"Type of RCU to torture (rcu)" ); +MODULE_PARM_DESC (torture_type,"Type of RCU to torture (rcu, rcu_bh)" );#define TORTURE_FLAG "-torture:"#define PRINTK_STRING (s) \@@ -246,8 +246,44 @@ static struct rcu_torture_ops rcu_ops = .name = "rcu" }; +/* +* Definitions for rcu_bh torture testing. +*/ + +static int rcu_bh_torture_read_lock (void ) +{ +rcu_read_lock_bh (); +return 0 ; +} + +static void rcu_bh_torture_read_unlock (int idx) +{ +rcu_read_unlock_bh (); +} + +static int rcu_bh_torture_completed (void ) +{ +return rcu_batches_completed_bh (); +} + +static void rcu_bh_torture_deferred_free (struct rcu_torture *p) +{ +call_rcu_bh (&p->rtort_rcu, rcu_torture_cb); +} + +static struct rcu_torture_ops rcu_bh_ops = { + .init =NULL , + .cleanup =NULL , + .readlock = rcu_bh_torture_read_lock, + .readunlock = rcu_bh_torture_read_unlock, + .completed = rcu_bh_torture_completed, + .deferredfree = rcu_bh_torture_deferred_free, + .stats =NULL , + .name ="rcu_bh" +}; +static struct rcu_torture_ops *torture_ops[] = - { &rcu_ops,NULL }; + { &rcu_ops, &rcu_bh_ops,NULL };/* * RCU torture writer kthread. Repeatedly substitutes a new structure