From: Paul E. McKenney Date: Thu, 9 Jan 2025 18:14:53 +0000 (-0800) Subject: rcutorture: Complain when invalid SRCU reader_flavor is specified X-Git-Tag: v6.15-rc1~221^2^5~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38b43eca6665434225284c0b583a39340f4e1f37;p=thirdparty%2Fkernel%2Flinux.git rcutorture: Complain when invalid SRCU reader_flavor is specified 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 Signed-off-by: Boqun Feng --- diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 9c9a349b9c7f8..be4e3c6b912fe 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -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);