Skip to content

Commit 7672d64

Browse files
committed
rcu: Add WRITE_ONCE() to rcu_node ->qsmask update
The rcu_node structure's ->qsmask 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. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 8a7e8f5 commit 7672d64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/rcu/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ static void rcu_report_qs_rnp(unsigned long mask, struct rcu_node *rnp,
18811881
WARN_ON_ONCE(oldmask); /* Any child must be all zeroed! */
18821882
WARN_ON_ONCE(!rcu_is_leaf_node(rnp) &&
18831883
rcu_preempt_blocked_readers_cgp(rnp));
1884-
rnp->qsmask &= ~mask;
1884+
WRITE_ONCE(rnp->qsmask, rnp->qsmask & ~mask);
18851885
trace_rcu_quiescent_state_report(rcu_state.name, rnp->gp_seq,
18861886
mask, rnp->qsmask, rnp->level,
18871887
rnp->grplo, rnp->grphi,

0 commit comments

Comments
 (0)