* [tip: core/rcu] rcu: Add WRITE_ONCE() to rcu_node ->qsmaskinitnext
@ 2020-03-24 9:16 tip-bot2 for Paul E. McKenney
0 siblings, 0 replies; only message in thread
From: tip-bot2 for Paul E. McKenney @ 2020-03-24 9:16 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Paul E. McKenney, x86, LKML
The following commit has been merged into the core/rcu branch of tip:
Commit-ID: 105abf82b0a62664edabcd4c5b4d9414c74ef399
Gitweb: https://git.kernel.org/tip/105abf82b0a62664edabcd4c5b4d9414c74ef399
Author: Paul E. McKenney <paulmck@kernel.org>
AuthorDate: Fri, 03 Jan 2020 15:44:23 -08:00
Committer: Paul E. McKenney <paulmck@kernel.org>
CommitterDate: Thu, 20 Feb 2020 15:58:22 -08:00
rcu: Add WRITE_ONCE() to rcu_node ->qsmaskinitnext
The rcu_state structure's ->qsmaskinitnext field is read locklessly,
so this commit adds the WRITE_ONCE() to an update in order to provide
proper documentation and READ_ONCE()/WRITE_ONCE() pairing.
This data race was reported by KCSAN. Not appropriate for backporting
due to failure being unlikely for systems not doing incessant CPU-hotplug
operations.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 9443909..346321a 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3379,7 +3379,7 @@ void rcu_cpu_starting(unsigned int cpu)
rnp = rdp->mynode;
mask = rdp->grpmask;
raw_spin_lock_irqsave_rcu_node(rnp, flags);
- rnp->qsmaskinitnext |= mask;
+ WRITE_ONCE(rnp->qsmaskinitnext, rnp->qsmaskinitnext | mask);
oldmask = rnp->expmaskinitnext;
rnp->expmaskinitnext |= mask;
oldmask ^= rnp->expmaskinitnext;
@@ -3432,7 +3432,7 @@ void rcu_report_dead(unsigned int cpu)
rcu_report_qs_rnp(mask, rnp, rnp->gp_seq, flags);
raw_spin_lock_irqsave_rcu_node(rnp, flags);
}
- rnp->qsmaskinitnext &= ~mask;
+ WRITE_ONCE(rnp->qsmaskinitnext, rnp->qsmaskinitnext & ~mask);
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
raw_spin_unlock(&rcu_state.ofl_lock);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-24 9:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 9:16 [tip: core/rcu] rcu: Add WRITE_ONCE() to rcu_node ->qsmaskinitnext tip-bot2 for Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®