diff options
author | Joel Fernandes (Google) <joel@joelfernandes.org> | 2022-09-17 18:41:58 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2022-10-18 23:59:57 +0200 |
commit | aba9645bd10bd9f793732b06495b1312ee44865e (patch) | |
tree | 00b6009b63c84f16c3f25cdc8322ca91861fa8ba | |
parent | rcu: Remove unused 'cpu' in rcu_virt_note_context_switch() (diff) | |
download | linux-aba9645bd10bd9f793732b06495b1312ee44865e.tar.xz linux-aba9645bd10bd9f793732b06495b1312ee44865e.zip |
rcu: Use READ_ONCE() for lockless read of rnp->qsmask
The rnp->qsmask is locklessly accessed from rcutree_dying_cpu(). This
may help avoid load tearing due to concurrent access, KCSAN
issues, and preserve sanity of people reading the mask in tracing.
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
-rw-r--r-- | kernel/rcu/tree.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 0ca21ac0f064..5ec97e3f7468 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2106,7 +2106,7 @@ int rcutree_dying_cpu(unsigned int cpu) if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) return 0; - blkd = !!(rnp->qsmask & rdp->grpmask); + blkd = !!(READ_ONCE(rnp->qsmask) & rdp->grpmask); trace_rcu_grace_period(rcu_state.name, READ_ONCE(rnp->gp_seq), blkd ? TPS("cpuofl-bgp") : TPS("cpuofl")); return 0; |