History

rcu: Make FQS more aggressive in complaining about offline CPUs

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.

Joel Fernandes (Google) committed 6 years ago

Commit 666ca291 parent f37599e1 file · +19 −4Browse files

Unified · Split

kernel/rcu/tree.c+19−4
@@ -1214,13 +1214,28 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp) · 1213 unmodified lines
12141214 return 1;
12151215 }
12161216
1217− /* If waiting too long on an offline CPU, complain. */
1218− if (!(rdp->grpmask & rcu_rnp_online_cpus(rnp)) &&
1219− time_after(jiffies, rcu_state.gp_start + HZ)) {
1217+ /*
1218+ * Complain if a CPU that is considered to be offline from RCU's
1219+ * perspective has not yet reported a quiescent state. After all,
1220+ * the offline CPU should have reported a quiescent state during
1221+ * the CPU-offline process, or, failing that, by rcu_gp_init()
1222+ * if it ran concurrently with either the CPU going offline or the
1223+ * last task on a leaf rcu_node structure exiting its RCU read-side
1224+ * critical section while all CPUs corresponding to that structure
1225+ * are offline. This added warning detects bugs in any of these
1226+ * code paths.
1227+ *
1228+ * The rcu_node structure's ->lock is held here, which excludes
1229+ * the relevant portions the CPU-hotplug code, the grace-period
1230+ * initialization code, and the rcu_read_unlock() code paths.
1231+ *
1232+ * For more detail, please refer to the "Hotplug CPU" section
1233+ * of RCU's Requirements documentation.
1234+ */
1235+ if (WARN_ON_ONCE(!(rdp->grpmask & rcu_rnp_online_cpus(rnp)))) {
12201236 bool onl;
12211237 struct rcu_node *rnp1;
12221238
1223− WARN_ON(1); /* Offline CPUs are supposed to report QS! */
12241239 pr_info("%s: grp: %d-%d level: %d ->gp_seq %ld ->completedqs %ld\n",
12251240 __func__, rnp->grplo, rnp->grphi, rnp->level,
12261241 (long)rnp->gp_seq, (long)rnp->completedqs);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t