Skip to content

Commit

Permalink
rcutorture: Complain when invalid SRCU reader_flavor is specified
Browse files Browse the repository at this point in the history
Currently, rcutorture ignores reader_flavor bits that are not in the
SRCU_READ_FLAVOR_ALL bitmask, which could confuse rcutorture users into
believing buggy patches had been fully tested.  This commit therefore
produces a splat in this case.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
  • Loading branch information
Paul E. McKenney authored and Boqun Feng committed Feb 5, 2025
1 parent 5d45bdf commit 38b43ec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/rcu/rcutorture.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ static int srcu_torture_read_lock(void)
int idx;
int ret = 0;

WARN_ON_ONCE(reader_flavor & ~SRCU_READ_FLAVOR_ALL);

if ((reader_flavor & SRCU_READ_FLAVOR_NORMAL) || !(reader_flavor & SRCU_READ_FLAVOR_ALL)) {
idx = srcu_read_lock(srcu_ctlp);
WARN_ON_ONCE(idx & ~0x1);
Expand Down

0 comments on commit 38b43ec

Please sign in to comment.