rcu/nocb: Detect unsafe checks for offloaded rdp
authorFrederic Weisbecker <frederic@kernel.org>
Thu, 12 Nov 2020 00:51:21 +0000 (01:51 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 8 Mar 2021 22:20:20 +0000 (14:20 -0800)
commit3820b513a2e33d6dee1caa3b4815f92079cb9890
tree2f33e76d0b43ea20841c991d3717687a5c699486
parenta38fd8748464831584a19438cbb3082b5a2dab15
rcu/nocb: Detect unsafe checks for offloaded rdp

Provide CONFIG_PROVE_RCU sanity checks to ensure we are always reading
the offloaded state of an rdp in a safe and stable way and prevent from
its value to be changed under us. We must either hold the barrier mutex,
the cpu-hotplug lock (read or write) or the nocb lock.
Local non-preemptible reads are also safe. NOCB kthreads and timers have
their own means of synchronization against the offloaded state updaters.

Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Neeraj Upadhyay <neeraju@codeaurora.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree.c
kernel/rcu/tree_plugin.h