Merge tag 'rcu-urgent.2022.10.20a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
Pull RCU fix from Paul McKenney:
"Fix a regression caused by commit bf95b2bc3e ("rcu: Switch polled
grace-period APIs to ->gp_seq_polled"), which could incorrectly leave
interrupts enabled after an early-boot call to synchronize_rcu().
Such synchronize_rcu() calls must acquire leaf rcu_node locks in order
to properly interact with polled grace periods, but the code did not
take into account the possibility of synchronize_rcu() being invoked
from the portion of the boot sequence during which interrupts are
disabled.
This commit therefore switches the lock acquisition and release from
irq to irqsave/irqrestore"
* tag 'rcu-urgent.2022.10.20a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
rcu: Keep synchronize_rcu() from enabling irqs in early boot
This commit is contained in:
+6
-4
@@ -1403,30 +1403,32 @@ static void rcu_poll_gp_seq_end(unsigned long *snap)
|
||||
// where caller does not hold the root rcu_node structure's lock.
|
||||
static void rcu_poll_gp_seq_start_unlocked(unsigned long *snap)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct rcu_node *rnp = rcu_get_root();
|
||||
|
||||
if (rcu_init_invoked()) {
|
||||
lockdep_assert_irqs_enabled();
|
||||
raw_spin_lock_irq_rcu_node(rnp);
|
||||
raw_spin_lock_irqsave_rcu_node(rnp, flags);
|
||||
}
|
||||
rcu_poll_gp_seq_start(snap);
|
||||
if (rcu_init_invoked())
|
||||
raw_spin_unlock_irq_rcu_node(rnp);
|
||||
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
|
||||
}
|
||||
|
||||
// Make the polled API aware of the end of a grace period, but where
|
||||
// caller does not hold the root rcu_node structure's lock.
|
||||
static void rcu_poll_gp_seq_end_unlocked(unsigned long *snap)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct rcu_node *rnp = rcu_get_root();
|
||||
|
||||
if (rcu_init_invoked()) {
|
||||
lockdep_assert_irqs_enabled();
|
||||
raw_spin_lock_irq_rcu_node(rnp);
|
||||
raw_spin_lock_irqsave_rcu_node(rnp, flags);
|
||||
}
|
||||
rcu_poll_gp_seq_end(snap);
|
||||
if (rcu_init_invoked())
|
||||
raw_spin_unlock_irq_rcu_node(rnp);
|
||||
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user