Skip to content

Commit 2f08469

Browse files
committed
rcu: Mark rcu_state.ncpus to detect concurrent writes
The rcu_state structure's ncpus field is only to be modified by the CPU-hotplug CPU-online code path, which is single-threaded. This commit therefore enlists KCSAN's help in enforcing this restriction. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 4f58820 commit 2f08469

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/rcu/tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,6 +3612,7 @@ void rcu_cpu_starting(unsigned int cpu)
36123612
nbits = bitmap_weight(&oldmask, BITS_PER_LONG);
36133613
/* Allow lockless access for expedited grace periods. */
36143614
smp_store_release(&rcu_state.ncpus, rcu_state.ncpus + nbits); /* ^^^ */
3615+
ASSERT_EXCLUSIVE_WRITER(rcu_state.ncpus);
36153616
rcu_gpnum_ovf(rnp, rdp); /* Offline-induced counter wrap? */
36163617
rdp->rcu_onl_gp_seq = READ_ONCE(rcu_state.gp_seq);
36173618
rdp->rcu_onl_gp_flags = READ_ONCE(rcu_state.gp_flags);

0 commit comments

Comments
 (0)