Re: [PATCH] rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt
From: Joel Fernandes
Date: Tue Oct 20 2026 - 18:20:26 EST
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@xxxxxxxxx> 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@xxxxxxxxxxxxxx>
> > >
> > > >Signed-off-by: Zqiang <qiang.zhang@xxxxxxxxx>
> >
> > 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@xxxxxxxxxx>
> Tested-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
>
> I will drop it from my tree, apologies for my confusion!
Applied for 7.5 for further testing, thanks!
thanks,
Joel Fernandes