diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2023-04-07 16:47:34 -0700 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2023-05-11 13:42:39 -0700 |
commit | a24c1aab652ebacf9ea62470a166514174c96fe1 (patch) | |
tree | 0cc5ee341800288924cc70a2a78fd4bfd9d698fc /kernel/rcu | |
parent | 9146eb25495ea8bfb5010192e61e3ed5805ce9ef (diff) | |
download | linux-a24c1aab652ebacf9ea62470a166514174c96fe1.tar.gz |
rcu: Mark rcu_cpu_kthread() accesses to ->rcu_cpu_has_work
The rcu_data structure's ->rcu_cpu_has_work field can be modified by
any CPU attempting to wake up the rcuc kthread. Therefore, this commit
marks accesses to this field from the rcu_cpu_kthread() function.
This data race was reported by KCSAN. Not appropriate for backporting
due to failure being unlikely.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu')
-rw-r--r-- | kernel/rcu/tree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index e2dbea6cee4b30..faa1c01d29170d 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2481,12 +2481,12 @@ static void rcu_cpu_kthread(unsigned int cpu) *statusp = RCU_KTHREAD_RUNNING; local_irq_disable(); work = *workp; - *workp = 0; + WRITE_ONCE(*workp, 0); local_irq_enable(); if (work) rcu_core(); local_bh_enable(); - if (*workp == 0) { + if (!READ_ONCE(*workp)) { trace_rcu_utilization(TPS("End CPU kthread@rcu_wait")); *statusp = RCU_KTHREAD_WAITING; return; |