* [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt
@ 2026-10-20 9:49 Zqiang
2026-10-20 15:06 ` Bradley Morgan
0 siblings, 1 reply; 5+ messages in thread
From: Zqiang @ 2026-10-20 9:49 UTC (permalink / raw)
To: paulmck, frederic, neeraj.upadhyay, joelagnelf, urezki, boqun
Cc: qiang.zhang, rcu, linux-kernel
Running the trivial-preempt flavor triggers a lockdep "suspicious RCU
usage" warning from rcu_torture_one_read_start():
WARNING: suspicious RCU usage
kernel/rcu/rcutorture.c:2581 suspicious rcu_dereference_check() usage!
...
lockdep_rcu_suspicious
rcu_torture_one_read_start
rcu_torture_one_read
rcu_torture_reader
The trivial-preempt flavor .readlock_held is set to torture_readlock_not_held(),
which check RCU-bh/RCU-sched critical sections. however, it's read lock
just increments current->rcu_trivial_preempt_nesting, it's not also RCU
read critical sections. the rcu_dereference_check() condition is therefore
false, and lockdep report warnings. this commit therefore drop .readlock_held
callback to avoid this lockdep warnings.
Fixes: c6f4e552e1ea ("rcutorture: Add a textbook-style trivial preemptible RCU")
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
kernel/rcu/rcutorture.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 92ff197f4789..1bbf8192786a 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1164,7 +1164,6 @@ static struct rcu_torture_ops trivial_preempt_ops = {
.readlock = rcu_torture_read_lock_trivial_preempt,
.read_delay = rcu_read_delay, // just reuse rcu's version.
.readunlock = rcu_torture_read_unlock_trivial_preempt,
- .readlock_held = torture_readlock_not_held,
.get_gp_seq = rcu_no_completed,
.sync = synchronize_rcu_trivial_preempt,
.exp_sync = synchronize_rcu_trivial_preempt,
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt 2026-10-20 9:49 [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt Zqiang @ 2026-10-20 15:06 ` Bradley Morgan 2026-10-20 22:01 ` Paul E. McKenney 0 siblings, 1 reply; 5+ messages in thread From: Bradley Morgan @ 2026-10-20 15:06 UTC (permalink / raw) To: qiang.zhang Cc: boqun, frederic, joelagnelf, linux-kernel, neeraj.upadhyay, paulmck, rcu, urezki On 20 October 2026 10:49:07 BST, Zqiang <qiang.zhang@linux.dev> wrote: >Running the trivial-preempt flavor triggers a lockdep "suspicious RCU >usage" warning from rcu_torture_one_read_start(): > >WARNING: suspicious RCU usage >kernel/rcu/rcutorture.c:2581 suspicious rcu_dereference_check() usage! >... >lockdep_rcu_suspicious >rcu_torture_one_read_start >rcu_torture_one_read >rcu_torture_reader > >The trivial-preempt flavor .readlock_held is set to >torture_readlock_not_held(), >which check RCU-bh/RCU-sched critical sections. however, it's read lock >just increments current->rcu_trivial_preempt_nesting, it's not also RCU >read critical sections. the rcu_dereference_check() condition is therefore >false, and lockdep report warnings. this commit therefore drop >.readlock_held >callback to avoid this lockdep warnings. > >Fixes: c6f4e552e1ea ("rcutorture: Add a textbook-style trivial preemptible RCU") Looks ok to me. Reviewed-by: Bradley Morgan <brads@mainlining.org> >Signed-off-by: Zqiang <qiang.zhang@linux.dev> >--- > kernel/rcu/rcutorture.c | 1 - > 1 file changed, 1 deletion(-) > >diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c >index 92ff197f4789..1bbf8192786a 100644 >--- a/kernel/rcu/rcutorture.c >+++ b/kernel/rcu/rcutorture.c >@@ -1164,7 +1164,6 @@ static struct rcu_torture_ops trivial_preempt_ops = { > .readlock = rcu_torture_read_lock_trivial_preempt, > .read_delay = rcu_read_delay, // just reuse rcu's version. > .readunlock = rcu_torture_read_unlock_trivial_preempt, >- .readlock_held = torture_readlock_not_held, > .get_gp_seq = rcu_no_completed, > .sync = synchronize_rcu_trivial_preempt, > .exp_sync = synchronize_rcu_trivial_preempt, > --- Thanks! "I'm not a very positive person" - Linus torvalds ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt 2026-10-20 15:06 ` Bradley Morgan @ 2026-10-20 22:01 ` Paul E. McKenney 2026-10-20 22:03 ` Paul E. McKenney 0 siblings, 1 reply; 5+ messages in thread From: Paul E. McKenney @ 2026-10-20 22:01 UTC (permalink / raw) To: Bradley Morgan Cc: qiang.zhang, boqun, frederic, joelagnelf, linux-kernel, neeraj.upadhyay, rcu, urezki On Tue, Oct 20, 2026 at 04:06:49PM +0100, Bradley Morgan wrote: > On 20 October 2026 10:49:07 BST, Zqiang <qiang.zhang@linux.dev> wrote: > >Running the trivial-preempt flavor triggers a lockdep "suspicious RCU > >usage" warning from rcu_torture_one_read_start(): > > > >WARNING: suspicious RCU usage > >kernel/rcu/rcutorture.c:2581 suspicious rcu_dereference_check() usage! > >... > >lockdep_rcu_suspicious > >rcu_torture_one_read_start > >rcu_torture_one_read > >rcu_torture_reader > > > >The trivial-preempt flavor .readlock_held is set to > >torture_readlock_not_held(), > >which check RCU-bh/RCU-sched critical sections. however, it's read lock > >just increments current->rcu_trivial_preempt_nesting, it's not also RCU > >read critical sections. the rcu_dereference_check() condition is therefore > >false, and lockdep report warnings. this commit therefore drop > >.readlock_held > >callback to avoid this lockdep warnings. > > > >Fixes: c6f4e552e1ea ("rcutorture: Add a textbook-style trivial preemptible RCU") > > Looks ok to me. > > Reviewed-by: Bradley Morgan <brads@mainlining.org> > > >Signed-off-by: Zqiang <qiang.zhang@linux.dev> And it works here, thank you both. I have queued this, and thank you Zqiang for thinking to test trivial-preempt with lockdep enabled! Thanx, Paul > >--- > > kernel/rcu/rcutorture.c | 1 - > > 1 file changed, 1 deletion(-) > > > >diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > >index 92ff197f4789..1bbf8192786a 100644 > >--- a/kernel/rcu/rcutorture.c > >+++ b/kernel/rcu/rcutorture.c > >@@ -1164,7 +1164,6 @@ static struct rcu_torture_ops trivial_preempt_ops = { > > .readlock = rcu_torture_read_lock_trivial_preempt, > > .read_delay = rcu_read_delay, // just reuse rcu's version. > > .readunlock = rcu_torture_read_unlock_trivial_preempt, > >- .readlock_held = torture_readlock_not_held, > > .get_gp_seq = rcu_no_completed, > > .sync = synchronize_rcu_trivial_preempt, > > .exp_sync = synchronize_rcu_trivial_preempt, > > > > --- Thanks! > "I'm not a very positive person" - Linus torvalds ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt 2026-10-20 22:01 ` Paul E. McKenney @ 2026-10-20 22:03 ` Paul E. McKenney 2026-10-20 22:20 ` Joel Fernandes 0 siblings, 1 reply; 5+ messages in thread From: Paul E. McKenney @ 2026-10-20 22:03 UTC (permalink / raw) To: Bradley Morgan Cc: qiang.zhang, boqun, frederic, joelagnelf, linux-kernel, neeraj.upadhyay, rcu, urezki On Tue, Oct 20, 2026 at 03:01:27PM -0700, Paul E. McKenney wrote: > On Tue, Oct 20, 2026 at 04:06:49PM +0100, Bradley Morgan wrote: > > On 20 October 2026 10:49:07 BST, Zqiang <qiang.zhang@linux.dev> wrote: > > >Running the trivial-preempt flavor triggers a lockdep "suspicious RCU > > >usage" warning from rcu_torture_one_read_start(): > > > > > >WARNING: suspicious RCU usage > > >kernel/rcu/rcutorture.c:2581 suspicious rcu_dereference_check() usage! > > >... > > >lockdep_rcu_suspicious > > >rcu_torture_one_read_start > > >rcu_torture_one_read > > >rcu_torture_reader > > > > > >The trivial-preempt flavor .readlock_held is set to > > >torture_readlock_not_held(), > > >which check RCU-bh/RCU-sched critical sections. however, it's read lock > > >just increments current->rcu_trivial_preempt_nesting, it's not also RCU > > >read critical sections. the rcu_dereference_check() condition is therefore > > >false, and lockdep report warnings. this commit therefore drop > > >.readlock_held > > >callback to avoid this lockdep warnings. > > > > > >Fixes: c6f4e552e1ea ("rcutorture: Add a textbook-style trivial preemptible RCU") > > > > Looks ok to me. > > > > Reviewed-by: Bradley Morgan <brads@mainlining.org> > > > > >Signed-off-by: Zqiang <qiang.zhang@linux.dev> > > And it works here, thank you both. I have queued this, and thank you > Zqiang for thinking to test trivial-preempt with lockdep enabled! Wait, Joel is doing the next merge window, not me! Joel, please make that be: Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Tested-by: Paul E. McKenney <paulmck@kernel.org> I will drop it from my tree, apologies for my confusion! Thanx, Paul > > >--- > > > kernel/rcu/rcutorture.c | 1 - > > > 1 file changed, 1 deletion(-) > > > > > >diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > > >index 92ff197f4789..1bbf8192786a 100644 > > >--- a/kernel/rcu/rcutorture.c > > >+++ b/kernel/rcu/rcutorture.c > > >@@ -1164,7 +1164,6 @@ static struct rcu_torture_ops trivial_preempt_ops = { > > > .readlock = rcu_torture_read_lock_trivial_preempt, > > > .read_delay = rcu_read_delay, // just reuse rcu's version. > > > .readunlock = rcu_torture_read_unlock_trivial_preempt, > > >- .readlock_held = torture_readlock_not_held, > > > .get_gp_seq = rcu_no_completed, > > > .sync = synchronize_rcu_trivial_preempt, > > > .exp_sync = synchronize_rcu_trivial_preempt, > > > > > > > --- Thanks! > > "I'm not a very positive person" - Linus torvalds ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt 2026-10-20 22:03 ` Paul E. McKenney @ 2026-10-20 22:20 ` Joel Fernandes 0 siblings, 0 replies; 5+ messages in thread From: Joel Fernandes @ 2026-10-20 22:20 UTC (permalink / raw) To: Paul E. McKenney Cc: Bradley Morgan, qiang.zhang, boqun, frederic, linux-kernel, neeraj.upadhyay, rcu, urezki On Tue, Oct 20, 2026 at 03:03:27PM -0700, Paul E. McKenney wrote: > On Tue, Oct 20, 2026 at 03:01:27PM -0700, Paul E. McKenney wrote: > > On Tue, Oct 20, 2026 at 04:06:49PM +0100, Bradley Morgan wrote: > > > On 20 October 2026 10:49:07 BST, Zqiang <qiang.zhang@linux.dev> wrote: > > > >Running the trivial-preempt flavor triggers a lockdep "suspicious RCU > > > >usage" warning from rcu_torture_one_read_start(): > > > > > > > >WARNING: suspicious RCU usage > > > >kernel/rcu/rcutorture.c:2581 suspicious rcu_dereference_check() usage! > > > >... > > > >lockdep_rcu_suspicious > > > >rcu_torture_one_read_start > > > >rcu_torture_one_read > > > >rcu_torture_reader > > > > > > > >The trivial-preempt flavor .readlock_held is set to > > > >torture_readlock_not_held(), > > > >which check RCU-bh/RCU-sched critical sections. however, it's read lock > > > >just increments current->rcu_trivial_preempt_nesting, it's not also RCU > > > >read critical sections. the rcu_dereference_check() condition is therefore > > > >false, and lockdep report warnings. this commit therefore drop > > > >.readlock_held > > > >callback to avoid this lockdep warnings. > > > > > > > >Fixes: c6f4e552e1ea ("rcutorture: Add a textbook-style trivial preemptible RCU") > > > > > > Looks ok to me. > > > > > > Reviewed-by: Bradley Morgan <brads@mainlining.org> > > > > > > >Signed-off-by: Zqiang <qiang.zhang@linux.dev> > > > > And it works here, thank you both. I have queued this, and thank you > > Zqiang for thinking to test trivial-preempt with lockdep enabled! > > Wait, Joel is doing the next merge window, not me! > > Joel, please make that be: > > Reviewed-by: Paul E. McKenney <paulmck@kernel.org> > Tested-by: Paul E. McKenney <paulmck@kernel.org> > > I will drop it from my tree, apologies for my confusion! Applied for 7.5 for further testing, thanks! thanks, Joel Fernandes ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-20 22:20 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-10-20 9:49 [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt Zqiang 2026-10-20 15:06 ` Bradley Morgan 2026-10-20 22:01 ` Paul E. McKenney 2026-10-20 22:03 ` Paul E. McKenney 2026-10-20 22:20 ` Joel Fernandes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox