Commit 7587a4a5 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Borislav Petkov:

 - Prevent a tick storm when a dedicated timekeeper CPU in nohz_full
   mode runs for prolonged periods with interrupts disabled and ends up
   programming the next tick in the past, leading to that storm

* tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timers/nohz: Last resort update jiffies on nohz_full IRQ entry
parents 1d213767 53e87e3c
...@@ -595,7 +595,8 @@ void irq_enter_rcu(void) ...@@ -595,7 +595,8 @@ void irq_enter_rcu(void)
{ {
__irq_enter_raw(); __irq_enter_raw();
if (is_idle_task(current) && (irq_count() == HARDIRQ_OFFSET)) if (tick_nohz_full_cpu(smp_processor_id()) ||
(is_idle_task(current) && (irq_count() == HARDIRQ_OFFSET)))
tick_irq_enter(); tick_irq_enter();
account_hardirq_enter(current); account_hardirq_enter(current);
......
...@@ -1375,6 +1375,13 @@ static inline void tick_nohz_irq_enter(void) ...@@ -1375,6 +1375,13 @@ static inline void tick_nohz_irq_enter(void)
now = ktime_get(); now = ktime_get();
if (ts->idle_active) if (ts->idle_active)
tick_nohz_stop_idle(ts, now); tick_nohz_stop_idle(ts, now);
/*
* If all CPUs are idle. We may need to update a stale jiffies value.
* Note nohz_full is a special case: a timekeeper is guaranteed to stay
* alive but it might be busy looping with interrupts disabled in some
* rare case (typically stop machine). So we must make sure we have a
* last resort.
*/
if (ts->tick_stopped) if (ts->tick_stopped)
tick_nohz_update_jiffies(now); tick_nohz_update_jiffies(now);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment