diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2020-02-10 14:29:58 +0100 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2020-04-27 20:01:15 +0200 |
commit | 2f08469563550d15cb08a60898d3549720600eee (patch) | |
tree | 57dfe47e476fbe1457f801ab439b41cf83291d49 /kernel/rcu/tree.c | |
parent | srcu: Add KCSAN stubs (diff) | |
download | linux-2f08469563550d15cb08a60898d3549720600eee.tar.xz linux-2f08469563550d15cb08a60898d3549720600eee.zip |
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 <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r-- | kernel/rcu/tree.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 156ac8d0418b..c88240a685ec 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3612,6 +3612,7 @@ void rcu_cpu_starting(unsigned int cpu) nbits = bitmap_weight(&oldmask, BITS_PER_LONG); /* Allow lockless access for expedited grace periods. */ smp_store_release(&rcu_state.ncpus, rcu_state.ncpus + nbits); /* ^^^ */ + ASSERT_EXCLUSIVE_WRITER(rcu_state.ncpus); rcu_gpnum_ovf(rnp, rdp); /* Offline-induced counter wrap? */ rdp->rcu_onl_gp_seq = READ_ONCE(rcu_state.gp_seq); rdp->rcu_onl_gp_flags = READ_ONCE(rcu_state.gp_flags); |