summaryrefslogtreecommitdiffstats
path: root/kernel/rcu/srcutree.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <frederic@kernel.org>2022-10-13 19:22:43 +0200
committerPaul E. McKenney <paulmck@kernel.org>2022-10-21 19:16:15 +0200
commitae3c0706160b60ac5e7d36aac428ae6e572dc932 (patch)
tree18c1a1769c77d5e0ed4b3cfdfca7f67aec65970a /kernel/rcu/srcutree.c
parentsrcu: Warn when NMI-unsafe API is used in NMI (diff)
downloadlinux-ae3c0706160b60ac5e7d36aac428ae6e572dc932.tar.xz
linux-ae3c0706160b60ac5e7d36aac428ae6e572dc932.zip
srcu: Explain the reason behind the read side critical section on GP start
Tell about the need to protect against concurrent updaters who may overflow the GP counter behind the current update. Reported-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to '')
-rw-r--r--kernel/rcu/srcutree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 18bb696cff8c..272830a87e56 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -1158,6 +1158,11 @@ static unsigned long srcu_gp_start_if_needed(struct srcu_struct *ssp,
int ss_state;
check_init_srcu_struct(ssp);
+ /*
+ * While starting a new grace period, make sure we are in an
+ * SRCU read-side critical section so that the grace-period
+ * sequence number cannot wrap around in the meantime.
+ */
idx = __srcu_read_lock_nmisafe(ssp, false);
ss_state = smp_load_acquire(&ssp->srcu_size_state);
if (ss_state < SRCU_SIZE_WAIT_CALL)