Re: two RCU torture bugs

From: Paul E. McKenney
Date: Mon Aug 24 2015 - 14:50:44 EST

On Sun, Aug 23, 2015 at 10:29:15PM -0700, Paul E. McKenney wrote:
> On Sun, Aug 23, 2015 at 10:07:49PM -0700, David Miller wrote:
> >
> > 1) Doc bug, documentation mentions torture_type such as "rcu_sync",
> > but those don't seem to exist.
> >
> > 2) If you specify an unrecognized type, the module cannot be unloaded.
> > Amusingly it says that it cannot unload because the unrecognized
> > torture test type you requested is "running" :-)
> Clearly Iftekhar was mutating the wrong code. ;-)
> And clearly I need to occasionally test failure cases. There is code that
> is supposed to unwind upon failure, but it has apparently bitrotted...

Do the following pair of untested patches help?

Thanx, Paul


commit d568705d102ceb61884a3a8b77a98168094acbca
Author: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Mon Aug 24 11:37:58 2015 -0700

rcutorture: Fix module unwind when bad torture_type specified

The rcutorture module has a list of torture types, and specifying a
type not on this list is supposed to cleanly fail the module load.
Unfortunately, the "fail" happens without the "cleanly". This commit
therefore adds the needed clean-up after an incorrect torture_type.

Reported-by: David Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index f9ec6cbe77d3..9c4f5cd86532 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -695,7 +695,7 @@ static bool __maybe_unused torturing_tasks(void)


-static bool torturing_tasks(void)
+static bool __maybe_unused torturing_tasks(void)
return false;
@@ -1742,8 +1742,8 @@ rcu_torture_init(void)
for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
pr_alert(" %s", torture_ops[i]->name);
- torture_init_end();
- return -EINVAL;
+ firsterr = -EINVAL;
+ goto unwind;
if (cur_ops->fqs == NULL && fqs_duration != 0) {
pr_alert("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n");


commit 20f34145cfbba04b44b8fbd29689bdcc0ab0b303
Author: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Mon Aug 24 11:46:00 2015 -0700

documentation: Catch up list of torture_type options

This commit rids the documentation of long-obsolete torture_type options
such as rcu_sync and adds new ones such as tasks. Also add verbiage
noting the fact that rcutorture now concurrently tests the asynchrounous,
synchronous, expedited synchronous, and polling grace-period primitives.

Reported-by: David Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

diff --git a/Documentation/RCU/torture.txt b/Documentation/RCU/torture.txt
index dac02a6219b1..118e7c176ce7 100644
--- a/Documentation/RCU/torture.txt
+++ b/Documentation/RCU/torture.txt
@@ -166,40 +166,27 @@ test_no_idle_hz Whether or not to test the ability of RCU to operate in

torture_type The type of RCU to test, with string values as follows:

- "rcu": rcu_read_lock(), rcu_read_unlock() and call_rcu().
- "rcu_sync": rcu_read_lock(), rcu_read_unlock(), and
- synchronize_rcu().
- "rcu_expedited": rcu_read_lock(), rcu_read_unlock(), and
- synchronize_rcu_expedited().
+ "rcu": rcu_read_lock(), rcu_read_unlock() and call_rcu(),
+ along with expedited, synchronous, and polling
+ variants.

"rcu_bh": rcu_read_lock_bh(), rcu_read_unlock_bh(), and
- call_rcu_bh().
- "rcu_bh_sync": rcu_read_lock_bh(), rcu_read_unlock_bh(),
- and synchronize_rcu_bh().
+ call_rcu_bh(), along with expedited and synchronous
+ variants.

- "rcu_bh_expedited": rcu_read_lock_bh(), rcu_read_unlock_bh(),
- and synchronize_rcu_bh_expedited().
+ "rcu_busted": This tests an intentionally incorrect version
+ of RCU in order to help test rcutorture itself.

"srcu": srcu_read_lock(), srcu_read_unlock() and
- call_srcu().
- "srcu_sync": srcu_read_lock(), srcu_read_unlock() and
- synchronize_srcu().
- "srcu_expedited": srcu_read_lock(), srcu_read_unlock() and
- synchronize_srcu_expedited().
+ call_srcu(), along with expedited and
+ synchronous variants.

"sched": preempt_disable(), preempt_enable(), and
- call_rcu_sched().
- "sched_sync": preempt_disable(), preempt_enable(), and
- synchronize_sched().
+ call_rcu_sched(), along with expedited,
+ synchronous, and polling variants.

- "sched_expedited": preempt_disable(), preempt_enable(), and
- synchronize_sched_expedited().
+ "tasks": voluntary context switch and call_rcu_tasks(),
+ along with expedited and synchronous variants.

Defaults to "rcu".

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at