summaryrefslogtreecommitdiff
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2026-07-16 13:05:00 -0700
committerPaul E. McKenney <paulmck@kernel.org>2026-07-24 16:59:23 -0700
commita050e671d3545cf1890ab764387958be6c542f6c (patch)
treef03d17184e549ea3f1c0ebd7a6eb421ab221829e /kernel/rcu
parentd2282f9bc75ca39a8ea5b7fe87191609985aca30 (diff)
downloadlinux-next-a050e671d3545cf1890ab764387958be6c542f6c.tar.gz
linux-next-a050e671d3545cf1890ab764387958be6c542f6c.zip
rcu: Use WRITE_ONCE() for ->rcu_need_heavy_qs
Currently raw_cpu_write() is used to clear the ->rcu_need_heavy_qs field of the per-CPU rcu_data structure. However, on x86 this is a normal assignment, which does not play well with concurrent accesses. This commit therefore upgrades the uses of raw_cpu_write() to its concurrency-safe counterpart WRITE_ONCE() of an rdp pointer obtained from this_cpu_ptr(&rcu_data). KCSAN located this issue. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 03a43d3d2616..91d5b4dd08bf 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -357,9 +357,10 @@ bool rcu_watching_zero_in_eqs(int cpu, int *vp)
*/
notrace void rcu_momentary_eqs(void)
{
+ struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
int seq;
- raw_cpu_write(rcu_data.rcu_need_heavy_qs, false);
+ WRITE_ONCE(rdp->rcu_need_heavy_qs, false);
seq = ct_state_inc(2 * CT_RCU_WATCHING);
/* It is illegal to call this from idle state. */
WARN_ON_ONCE(!(seq & CT_RCU_WATCHING));