@@ -222,6 +222,16 @@ static unsigned long rcu_rnp_online_cpus(struct rcu_node *rnp)
222
222
return READ_ONCE (rnp -> qsmaskinitnext );
223
223
}
224
224
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
+
225
235
/*
226
236
* Return true if an RCU grace period is in progress. The READ_ONCE()s
227
237
* 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)
1168
1178
bool rcu_lockdep_current_cpu_online (void )
1169
1179
{
1170
1180
struct rcu_data * rdp ;
1171
- struct rcu_node * rnp ;
1172
1181
bool ret = false;
1173
1182
1174
1183
if (in_nmi () || !rcu_scheduler_fully_active )
1175
1184
return true;
1176
1185
preempt_disable_notrace ();
1177
1186
rdp = this_cpu_ptr (& rcu_data );
1178
- rnp = rdp -> mynode ;
1179
1187
/*
1180
1188
* Strictly, we care here about the case where the current CPU is
1181
1189
* in rcu_cpu_starting() and thus has an excuse for rdp->grpmask
1182
1190
* not being up to date. So arch_spin_is_locked() might have a
1183
1191
* false positive if it's held by some *other* CPU, but that's
1184
1192
* OK because that just means a false *negative* on the warning.
1185
1193
*/
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 ))
1188
1195
ret = true;
1189
1196
preempt_enable_notrace ();
1190
1197
return ret ;
@@ -1269,8 +1276,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
1269
1276
* For more detail, please refer to the "Hotplug CPU" section
1270
1277
* of RCU's Requirements documentation.
1271
1278
*/
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 ))) {
1274
1280
struct rcu_node * rnp1 ;
1275
1281
1276
1282
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)
1279
1285
for (rnp1 = rnp ; rnp1 ; rnp1 = rnp1 -> parent )
1280
1286
pr_info ("%s: %d:%d ->qsmask %#lx ->qsmaskinit %#lx ->qsmaskinitnext %#lx ->rcu_gp_init_mask %#lx\n" ,
1281
1287
__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 ));
1283
1288
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 ) ],
1285
1290
(long )rdp -> rcu_onl_gp_seq , rdp -> rcu_onl_gp_flags ,
1286
1291
(long )rdp -> rcu_ofl_gp_seq , rdp -> rcu_ofl_gp_flags );
1287
1292
return 1 ; /* Break things loose after complaining. */
0 commit comments