Skip to content

Commit 358662a

Browse files
author
Frederic Weisbecker
committed
rcu: Assume IRQS disabled from rcu_report_dead()
rcu_report_dead() is the last RCU word from the CPU down through the hotplug path. It is called in the idle loop right before the CPU shuts down for good. Because it removes the CPU from the grace period state machine and reports an ultimate quiescent state if necessary, no further use of RCU is allowed. Therefore it is expected that IRQs are disabled upon calling this function and are not to be re-enabled again until the CPU shuts down. Remove the IRQs disablement from that function and verify instead that it is actually called with IRQs disabled as it is expected at that special point in the idle path. Reviewed-by: Joel Fernandes (Google) <[email protected]> Reviewed-by: Paul E. McKenney <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent 7df2a2a commit 358662a

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
@@ -4562,19 +4562,23 @@ void rcu_cpu_starting(unsigned int cpu)
45624562
*/
45634563
void rcu_report_dead(unsigned int cpu)
45644564
{
4565-
unsigned long flags, seq_flags;
4565+
unsigned long flags;
45664566
unsigned long mask;
45674567
struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
45684568
struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */
45694569

4570+
/*
4571+
* IRQS must be disabled from now on and until the CPU dies, or an interrupt
4572+
* may introduce a new READ-side while it is actually off the QS masks.
4573+
*/
4574+
lockdep_assert_irqs_disabled();
45704575
// Do any dangling deferred wakeups.
45714576
do_nocb_deferred_wakeup(rdp);
45724577

45734578
rcu_preempt_deferred_qs(current);
45744579

45754580
/* Remove outgoing CPU from mask in the leaf rcu_node structure. */
45764581
mask = rdp->grpmask;
4577-
local_irq_save(seq_flags);
45784582
arch_spin_lock(&rcu_state.ofl_lock);
45794583
raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
45804584
rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq);
@@ -4588,8 +4592,6 @@ void rcu_report_dead(unsigned int cpu)
45884592
WRITE_ONCE(rnp->qsmaskinitnext, rnp->qsmaskinitnext & ~mask);
45894593
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
45904594
arch_spin_unlock(&rcu_state.ofl_lock);
4591-
local_irq_restore(seq_flags);
4592-
45934595
rdp->cpu_started = false;
45944596
}
45954597

0 commit comments

Comments
 (0)