Skip to content

Commit 3f6c3d2

Browse files
committed
rcu: Don't assert interrupts enabled too early in boot
The rcu_poll_gp_seq_end() and rcu_poll_gp_seq_end_unlocked() both check that interrupts are enabled, as they normally should be when waiting for an RCU grace period. Except that it is legal to wait for grace periods during early boot, before interrupts have been enabled for the first time, and polling for grace periods is required to work during this time. This can result in false-positive lockdep splats in the presence of boot-time-initiated tracing. This commit therefore conditions those interrupts-enabled checks on rcu_scheduler_active having advanced past RCU_SCHEDULER_INACTIVE, by which time interrupts have been enabled. Reported-by: Steven Rostedt <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Tested-by: Steven Rostedt (Google) <[email protected]>
1 parent 31d8aaa commit 3f6c3d2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

kernel/rcu/tree.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ static void rcu_poll_gp_seq_start(unsigned long *snap)
13681368
{
13691369
struct rcu_node *rnp = rcu_get_root();
13701370

1371-
if (rcu_init_invoked())
1371+
if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE)
13721372
raw_lockdep_assert_held_rcu_node(rnp);
13731373

13741374
// If RCU was idle, note beginning of GP.
@@ -1384,7 +1384,7 @@ static void rcu_poll_gp_seq_end(unsigned long *snap)
13841384
{
13851385
struct rcu_node *rnp = rcu_get_root();
13861386

1387-
if (rcu_init_invoked())
1387+
if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE)
13881388
raw_lockdep_assert_held_rcu_node(rnp);
13891389

13901390
// If the previously noted GP is still in effect, record the
@@ -1407,7 +1407,8 @@ static void rcu_poll_gp_seq_start_unlocked(unsigned long *snap)
14071407
struct rcu_node *rnp = rcu_get_root();
14081408

14091409
if (rcu_init_invoked()) {
1410-
lockdep_assert_irqs_enabled();
1410+
if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE)
1411+
lockdep_assert_irqs_enabled();
14111412
raw_spin_lock_irqsave_rcu_node(rnp, flags);
14121413
}
14131414
rcu_poll_gp_seq_start(snap);
@@ -1423,7 +1424,8 @@ static void rcu_poll_gp_seq_end_unlocked(unsigned long *snap)
14231424
struct rcu_node *rnp = rcu_get_root();
14241425

14251426
if (rcu_init_invoked()) {
1426-
lockdep_assert_irqs_enabled();
1427+
if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE)
1428+
lockdep_assert_irqs_enabled();
14271429
raw_spin_lock_irqsave_rcu_node(rnp, flags);
14281430
}
14291431
rcu_poll_gp_seq_end(snap);

0 commit comments

Comments
 (0)