Skip to content

Commit 7587a4a

Browse files
committed
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
2 parents 1d21376 + 53e87e3 commit 7587a4a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

kernel/softirq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,8 @@ void irq_enter_rcu(void)
595595
{
596596
__irq_enter_raw();
597597

598-
if (is_idle_task(current) && (irq_count() == HARDIRQ_OFFSET))
598+
if (tick_nohz_full_cpu(smp_processor_id()) ||
599+
(is_idle_task(current) && (irq_count() == HARDIRQ_OFFSET)))
599600
tick_irq_enter();
600601

601602
account_hardirq_enter(current);

kernel/time/tick-sched.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,13 @@ static inline void tick_nohz_irq_enter(void)
13751375
now = ktime_get();
13761376
if (ts->idle_active)
13771377
tick_nohz_stop_idle(ts, now);
1378+
/*
1379+
* If all CPUs are idle. We may need to update a stale jiffies value.
1380+
* Note nohz_full is a special case: a timekeeper is guaranteed to stay
1381+
* alive but it might be busy looping with interrupts disabled in some
1382+
* rare case (typically stop machine). So we must make sure we have a
1383+
* last resort.
1384+
*/
13781385
if (ts->tick_stopped)
13791386
tick_nohz_update_jiffies(now);
13801387
}

0 commit comments

Comments
 (0)