Skip to content

Commit bf37da9

Browse files
committed
rcu: Don't acquire lock in NMI handler in rcu_nmi_enter_common()
The rcu_nmi_enter_common() function can be invoked both in interrupt and NMI handlers. If it is invoked from process context (as opposed to userspace or idle context) on a nohz_full CPU, it might acquire the CPU's leaf rcu_node structure's ->lock. Because this lock is held only with interrupts disabled, this is safe from an interrupt handler, but doing so from an NMI handler can result in self-deadlock. This commit therefore adds "irq" to the "if" condition so as to only acquire the ->lock from irq handlers or process context, never from an NMI handler. Fixes: 5b14557 ("rcu: Avoid tick_dep_set_cpu() misordering") Reported-by: Thomas Gleixner <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Joel Fernandes (Google) <[email protected]> Cc: <[email protected]> # 5.5.x
1 parent aa93ec6 commit bf37da9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/rcu/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static __always_inline void rcu_nmi_enter_common(bool irq)
825825
rcu_cleanup_after_idle();
826826

827827
incby = 1;
828-
} else if (tick_nohz_full_cpu(rdp->cpu) &&
828+
} else if (irq && tick_nohz_full_cpu(rdp->cpu) &&
829829
rdp->dynticks_nmi_nesting == DYNTICK_IRQ_NONIDLE &&
830830
READ_ONCE(rdp->rcu_urgent_qs) &&
831831
!READ_ONCE(rdp->rcu_forced_tick)) {

0 commit comments

Comments
 (0)