[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200731004012.2324147-1-joel@joelfernandes.org>
Date: Thu, 30 Jul 2020 20:40:10 -0400
From: "Joel Fernandes (Google)" <joel@...lfernandes.org>
To: linux-kernel@...r.kernel.org
Cc: "Joel Fernandes (Google)" <joel@...lfernandes.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Neeraj Upadhyay <neeraju@...eaurora.org>,
Josh Triplett <josh@...htriplett.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
rcu@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>
Subject: [PATCH v2 1/3] rcu/tree: Add a warning if CPU being onlined did not report QS already
Add a warning if CPU being onlined did not report QS already. This is to
simplify the code in the CPU onlining path and also to make clear about
where QS is reported. The act of QS reporting in CPU onlining path is
is likely unnecessary as shown by code reading and testing with
rcutorture's TREE03 and hotplug parameters.
Cc: Paul E. McKenney <paulmck@...nel.org>
Cc: Neeraj Upadhyay <neeraju@...eaurora.org>
Suggested-by: Paul E. McKenney <paulmck@...nel.org>
Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
---
kernel/rcu/tree.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 65e1b5e92319..6b6fc28bb670 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3996,7 +3996,19 @@ void rcu_cpu_starting(unsigned int cpu)
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);
- if (rnp->qsmask & mask) { /* RCU waiting on incoming CPU? */
+
+ /*
+ * Delete QS reporting from here, by June 2021, if warning does not
+ * fire, in order to make the rules for reporting QS for an offline CPUs
+ * more clear. The CPU onlining path does not need to report QS for
+ * an offline CPU. Either the QS should have reported during CPU
+ * offlining, or during rcu_gp_init() if it detected a race with either
+ * CPU offlining or task unblocking on previously offlined CPUs. Note
+ * that to avoid hotplug notifier deadlocks,the FQS loop also does not
+ * report QS for an offline CPU any longer (unless it splats due to an
+ * offline CPU blocking the GP for too long).
+ */
+ if (WARN_ON_ONCE(rnp->qsmask & mask)) { /* RCU waiting on incoming CPU? */
rcu_disable_urgency_upon_qs(rdp);
/* Report QS -after- changing ->qsmaskinitnext! */
rcu_report_qs_rnp(mask, rnp, rnp->gp_seq, flags);
--
2.28.0.163.g6104cc2f0b6-goog
Powered by blists - more mailing lists