rcutorture: Add SRCU deadlock scenarios
authorPaul E. McKenney <paulmck@kernel.org>
Sat, 14 Jan 2023 05:34:27 +0000 (21:34 -0800)
committerBoqun Feng <boqun.feng@gmail.com>
Mon, 27 Mar 2023 18:16:10 +0000 (11:16 -0700)
commitd94f12e8a46d3a8623fd77231e2dcab780368685
treee732215ba0481d68bb0931ac6d5afc67debbb409
parent0471db447cb7de56bbe2fedd9256b4d2b8ef642a
rcutorture: Add SRCU deadlock scenarios

In order to test the new SRCU-lockdep functionality, this commit adds
an rcutorture.test_srcu_lockdep module parameter that, when non-zero,
selects an SRCU deadlock scenario to execute.  This parameter is a
five-digit number formatted as DNNL, where "D" is 1 to force a deadlock
and 0 to avoid doing so; "NN" is the test number, 0 for SRCU-based, 1
for SRCU/mutex-based, and 2 for SRCU/rwsem-based; and "L" is the number
of steps in the deadlock cycle.

Note that rcutorture.test_srcu_lockdep=1 will also force a hard hang.

If a non-zero value of rcutorture.test_srcu_lockdep does not select a
deadlock scenario, a console message is printed and testing continues.

[ paulmck: Apply kernel test robot feedback, add rwsem support. ]
[ paulmck: Apply Dan Carpenter feedback. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
kernel/rcu/rcutorture.c