@@ -222,6 +222,16 @@ static unsigned long rcu_rnp_online_cpus(struct rcu_node *rnp)
222222 return READ_ONCE (rnp -> qsmaskinitnext );
223223}
224224
225+ /*
226+ * Is the CPU corresponding to the specified rcu_data structure online
227+ * from RCU's perspective? This perspective is given by that structure's
228+ * ->qsmaskinitnext field rather than by the global cpu_online_mask.
229+ */
230+ static bool rcu_rdp_cpu_online (struct rcu_data * rdp )
231+ {
232+ return !!(rdp -> grpmask & rcu_rnp_online_cpus (rdp -> mynode ));
233+ }
234+
225235/*
226236 * Return true if an RCU grace period is in progress. The READ_ONCE()s
227237 * permit this function to be invoked without holding the root rcu_node
@@ -1168,23 +1178,20 @@ void rcu_request_urgent_qs_task(struct task_struct *t)
11681178bool rcu_lockdep_current_cpu_online (void )
11691179{
11701180 struct rcu_data * rdp ;
1171- struct rcu_node * rnp ;
11721181 bool ret = false;
11731182
11741183 if (in_nmi () || !rcu_scheduler_fully_active )
11751184 return true;
11761185 preempt_disable_notrace ();
11771186 rdp = this_cpu_ptr (& rcu_data );
1178- rnp = rdp -> mynode ;
11791187 /*
11801188 * Strictly, we care here about the case where the current CPU is
11811189 * in rcu_cpu_starting() and thus has an excuse for rdp->grpmask
11821190 * not being up to date. So arch_spin_is_locked() might have a
11831191 * false positive if it's held by some *other* CPU, but that's
11841192 * OK because that just means a false *negative* on the warning.
11851193 */
1186- if (rdp -> grpmask & rcu_rnp_online_cpus (rnp ) ||
1187- arch_spin_is_locked (& rcu_state .ofl_lock ))
1194+ if (rcu_rdp_cpu_online (rdp ) || arch_spin_is_locked (& rcu_state .ofl_lock ))
11881195 ret = true;
11891196 preempt_enable_notrace ();
11901197 return ret ;
@@ -1269,8 +1276,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
12691276 * For more detail, please refer to the "Hotplug CPU" section
12701277 * of RCU's Requirements documentation.
12711278 */
1272- if (WARN_ON_ONCE (!(rdp -> grpmask & rcu_rnp_online_cpus (rnp )))) {
1273- bool onl ;
1279+ if (WARN_ON_ONCE (!rcu_rdp_cpu_online (rdp ))) {
12741280 struct rcu_node * rnp1 ;
12751281
12761282 pr_info ("%s: grp: %d-%d level: %d ->gp_seq %ld ->completedqs %ld\n" ,
@@ -1279,9 +1285,8 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
12791285 for (rnp1 = rnp ; rnp1 ; rnp1 = rnp1 -> parent )
12801286 pr_info ("%s: %d:%d ->qsmask %#lx ->qsmaskinit %#lx ->qsmaskinitnext %#lx ->rcu_gp_init_mask %#lx\n" ,
12811287 __func__ , rnp1 -> grplo , rnp1 -> grphi , rnp1 -> qsmask , rnp1 -> qsmaskinit , rnp1 -> qsmaskinitnext , rnp1 -> rcu_gp_init_mask );
1282- onl = !!(rdp -> grpmask & rcu_rnp_online_cpus (rnp ));
12831288 pr_info ("%s %d: %c online: %ld(%d) offline: %ld(%d)\n" ,
1284- __func__ , rdp -> cpu , ".o" [onl ],
1289+ __func__ , rdp -> cpu , ".o" [rcu_rdp_cpu_online ( rdp ) ],
12851290 (long )rdp -> rcu_onl_gp_seq , rdp -> rcu_onl_gp_flags ,
12861291 (long )rdp -> rcu_ofl_gp_seq , rdp -> rcu_ofl_gp_flags );
12871292 return 1 ; /* Break things loose after complaining. */
0 commit comments