From: paulmck@kernel.org
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
"Paul E . McKenney" <paulmck@kernel.org>
Subject: [PATCH tip/core/rcu 21/24] rcu: Make FQS more aggressive in complaining about offline CPUs
Date: Mon, 31 Aug 2020 11:01:13 -0700 [thread overview]
Message-ID: <20200831180116.32690-21-paulmck@kernel.org> (raw)
In-Reply-To: <20200831180050.GA32590@paulmck-ThinkPad-P72>
From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
The RCU grace-period kthread's force-quiescent state (FQS) loop should
never see an offline CPU that has not yet reported a quiescent state.
After all, the offline CPU should have reported a quiescent state
during the CPU-offline process, or, failing that, by rcu_gp_init()
if it ran concurrently with either the CPU going offline or the last
task on a leaf rcu_node structure exiting its RCU read-side critical
section while all CPUs corresponding to that structure are offline.
The FQS loop should therefore complain if it does see an offline CPU
that has not yet reported a quiescent state.
And it does, but only once the grace period has been in force for a
full second. This commit therefore makes this warning more aggressive,
so that it will trigger as soon as the condition makes its appearance.
Light testing with TREE03 and hotplug shows no warnings. This commit
also converts the warning to WARN_ON_ONCE() in order to stave off possible
log spam.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tree.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 2c7afe4..396abe0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1214,13 +1214,28 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
return 1;
}
- /* If waiting too long on an offline CPU, complain. */
- if (!(rdp->grpmask & rcu_rnp_online_cpus(rnp)) &&
- time_after(jiffies, rcu_state.gp_start + HZ)) {
+ /*
+ * Complain if a CPU that is considered to be offline from RCU's
+ * perspective has not yet reported a quiescent state. After all,
+ * the offline CPU should have reported a quiescent state during
+ * the CPU-offline process, or, failing that, by rcu_gp_init()
+ * if it ran concurrently with either the CPU going offline or the
+ * last task on a leaf rcu_node structure exiting its RCU read-side
+ * critical section while all CPUs corresponding to that structure
+ * are offline. This added warning detects bugs in any of these
+ * code paths.
+ *
+ * The rcu_node structure's ->lock is held here, which excludes
+ * the relevant portions the CPU-hotplug code, the grace-period
+ * initialization code, and the rcu_read_unlock() code paths.
+ *
+ * For more detail, please refer to the "Hotplug CPU" section
+ * of RCU's Requirements documentation.
+ */
+ if (WARN_ON_ONCE(!(rdp->grpmask & rcu_rnp_online_cpus(rnp)))) {
bool onl;
struct rcu_node *rnp1;
- WARN_ON(1); /* Offline CPUs are supposed to report QS! */
pr_info("%s: grp: %d-%d level: %d ->gp_seq %ld ->completedqs %ld\n",
__func__, rnp->grplo, rnp->grphi, rnp->level,
(long)rnp->gp_seq, (long)rnp->completedqs);
--
2.9.5
next prev parent reply other threads:[~2020-08-31 18:02 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 18:00 [PATCH tip/core/rcu 0/24] Miscellaneous fixes for v5.10 Paul E. McKenney
2020-08-31 18:00 ` [PATCH tip/core/rcu 01/24] rcu: Remove KCSAN stubs paulmck
2020-08-31 18:00 ` [PATCH tip/core/rcu 02/24] rcu: Remove KCSAN stubs from update.c paulmck
2020-08-31 18:00 ` [PATCH tip/core/rcu 03/24] srcu: Remove KCSAN stubs paulmck
2020-08-31 18:00 ` [PATCH tip/core/rcu 04/24] rcu: Initialize at declaration time in rcu_exp_handler() paulmck
2020-08-31 18:00 ` [PATCH tip/core/rcu 05/24] rcu/trace: Print negative GP numbers correctly paulmck
2020-08-31 18:00 ` [PATCH tip/core/rcu 06/24] rcu/trace: Use gp_seq_req in acceleration's rcu_grace_period tracepoint paulmck
2020-08-31 18:00 ` [PATCH tip/core/rcu 07/24] nocb: Clarify RCU nocb CPU error message paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 08/24] rcu/tree: Force quiescent state on callback overload paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 09/24] rcu/tree: Remove CONFIG_PREMPT_RCU check in force_qs_rnp() paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 10/24] nocb: Remove show_rcu_nocb_state() false positive printout paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 11/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_divisor paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 12/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_resched_ns paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 13/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_kick_kthreads paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 14/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_cpu_stall_ftrace_dump paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 15/24] rcu: Fix kerneldoc comments in rcupdate.h paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 16/24] rculist: Introduce list/hlist_for_each_entry_srcu() macros paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 17/24] kvm: mmu: page_track: Fix RCU list API usage paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 18/24] rcu: Move rcu_cpu_started per-CPU variable to rcu_data paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 19/24] rcu/nocb: Add a warning for non-GP kthread running GP code paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 20/24] rcu: Clarify comments about FQS loop reporting quiescent states paulmck
2020-08-31 18:01 ` paulmck [this message]
2020-08-31 18:01 ` [PATCH tip/core/rcu 22/24] rcu: Remove unused __rcu_is_watching() function paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 23/24] rcu/segcblist: Prevent useless GP start if no CBs to accelerate paulmck
2020-08-31 18:01 ` [PATCH tip/core/rcu 24/24] rcu: Shrink each possible cpu krcp paulmck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200831180116.32690-21-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®