rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt
Subsystems (2)
Zqiang
reviewerPATCH 1/1 rcutorture: Fix suspicious rcu_dereference_check() usage for trivial-preempt
Running the trivial-preempt flavor triggers a lockdep "suspicious RCU usage" warning from rcu_torture_one_read_start():
WARNING: suspicious RCU usagekernel/rcu/rcutorture.c:2581 suspicious rcu_dereference_check() usage!
...lockdep_rcu_suspiciousrcu_torture_one_read_startrcu_torture_one_readrcu_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.
--- kernel/rcu/rcutorture.c | 1 - 1 file changed, 1 deletion(-)
kernel/rcu/rcutorture.c +0 -1
@@ -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,
Signature · 1 line
2.17.1
Quoted 20 lines · Zqiang
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:2581suspiciousrcu_dereference_check()usage!
...lockdep_rcu_suspiciousrcu_torture_one_read_startrcu_torture_one_readrcu_torture_readerThe 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 incrementscurrent->rcu_trivial_preempt_nesting, it's not also RCU read critical sections. thercu_dereference_check()condition is therefore false, and lockdep report warnings. this commit therefore drop .readlock_held
callback to avoid this lockdep warnings.
Quoted 1 line
Fixes c6f4e552e1ea ("rcutorture: Add a textbook-style trivial preemptible RCU")
Looks ok to me.
Quoted 11 lines
Signed-off-by Zqiang <[email protected]>---
kernel/rcu/rcutorture.c| 1 -1 file changed, 1 deletion(-)kernel/rcu/rcutorture.c +0
-0
kernel/rcu/rcutorture.c static struct rcu_torture_ops trivial_preempt_ops = { · line 1169
Quoted 7 lines
kernel/rcu/rcutorture.c +0
-1@@ -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
Paul E. McKenney
maintainerQuoted 21 lines · Bradley Morgan
Quoted 20 lines · Zqiang
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:2581suspiciousrcu_dereference_check()usage!
...lockdep_rcu_suspiciousrcu_torture_one_read_startrcu_torture_one_readrcu_torture_readerThe 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 incrementscurrent->rcu_trivial_preempt_nesting, it's not also RCU read critical sections. thercu_dereference_check()condition is therefore false, and lockdep report warnings. this commit therefore drop .readlock_held
callback to avoid this lockdep warnings.
Quoted 7 lines
Quoted 1 line
Fixes c6f4e552e1ea ("rcutorture: Add a textbook-style trivial preemptible RCU")Looks ok to me.
Reviewed-by Bradley Morgan <[email protected]>Quoted 1 line
Signed-off-by Zqiang <[email protected]>
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
Quoted 20 lines
Quoted 10 lines
---
kernel/rcu/rcutorture.c| 1 -1 file changed, 1 deletion(-)kernel/rcu/rcutorture.c +0
-0kernel/rcu/rcutorture.c static struct rcu_torture_ops trivial_preempt_ops = { · line 1169
Quoted 7 lines
kernel/rcu/rcutorture.c +0
-1@@ -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
Quoted 24 lines · Paul E. McKenney
Quoted 23 lines · Bradley Morgan
Quoted 21 lines · Zqiang
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:2581suspiciousrcu_dereference_check()usage!
...lockdep_rcu_suspiciousrcu_torture_one_read_startrcu_torture_one_readrcu_torture_readerThe 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 incrementscurrent->rcu_trivial_preempt_nesting, it's not also RCU read critical sections. thercu_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")
Quoted 8 lines
Quoted 5 lines
Looks ok to me.
Reviewed-by Bradley Morgan <[email protected]>Quoted 1 line
Signed-off-by Zqiang <[email protected]>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:
I will drop it from my tree, apologies for my confusion!
Thanx, Paul
Quoted 20 lines
Quoted 20 lines
Quoted 10 lines
---
kernel/rcu/rcutorture.c| 1 -1 file changed, 1 deletion(-)kernel/rcu/rcutorture.c +0
-0kernel/rcu/rcutorture.c static struct rcu_torture_ops trivial_preempt_ops = { · line 1169
Quoted 7 lines
kernel/rcu/rcutorture.c +0
-1@@ -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
Joel Fernandes
maintainerQuoted 34 lines · Paul E. McKenney
Quoted 24 lines · Paul E. McKenney
Quoted 23 lines · Bradley Morgan
Quoted 21 lines · Zqiang
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:2581suspiciousrcu_dereference_check()usage!
...lockdep_rcu_suspiciousrcu_torture_one_read_startrcu_torture_one_readrcu_torture_readerThe 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 incrementscurrent->rcu_trivial_preempt_nesting, it's not also RCU read critical sections. thercu_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")Quoted 8 lines
Quoted 5 lines
Looks ok to me.
Reviewed-by Bradley Morgan <[email protected]>Quoted 1 line
Signed-off-by Zqiang <[email protected]>And it works here, thank you both. I have queued this, and thank you Zqiang for thinking to test trivial-preempt with lockdep enabled!
Quoted 8 lines
Wait, Joel is doing the next merge window, not me!
Joel, please make that be:
Reviewed-by Paul E. McKenney <[email protected]>Tested-by Paul E. McKenney <[email protected]>I will drop it from my tree, apologies for my confusion!
Applied for 7.5 for further testing, thanks!
thanks,
Joel Fernandes