Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clockevents: Add missing resets of the next_event_forced flag

The prevention mechanism against timer interrupt starvation missed to reset
the next_event_forced flag in a couple of places:

- When the clock event state changes. That can cause the flag to be
stale over a shutdown/startup sequence

- When a non-forced event is armed, which then prevents rearming before
that event. If that event is far out in the future this will cause
missed timer interrupts.

- In the suspend wakeup handler.

That led to stalls which have been reported by several people.

Add the missing resets, which fixes the problems for the reporters.

Fixes: d6e152d905bd ("clockevents: Prevent timer interrupt starvation")
Reported-by: Hanabishi <i.r.e.c.c.a.k.u.n+kernel.org@gmail.com>
Reported-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Hanabishi <i.r.e.c.c.a.k.u.n+kernel.org@gmail.com>
Tested-by: Eric Naim <dnaim@cachyos.org>
Cc: stable@vger.kernel.org
Closes: https://lore.kernel.org/68d1e9ac-2780-4be3-8ee3-0788062dd3a4@gmail.com
Link: https://patch.msgid.link/87340xfeje.ffs@tglx

+7 -1
+6 -1
kernel/time/clockevents.c
··· 94 94 if (dev->features & CLOCK_EVT_FEAT_DUMMY) 95 95 return 0; 96 96 97 + /* On state transitions clear the forced flag unconditionally */ 98 + dev->next_event_forced = 0; 99 + 97 100 /* Transition with new state-specific callbacks */ 98 101 switch (state) { 99 102 case CLOCK_EVT_STATE_DETACHED: ··· 369 366 if (delta > (int64_t)dev->min_delta_ns) { 370 367 delta = min(delta, (int64_t) dev->max_delta_ns); 371 368 cycles = ((u64)delta * dev->mult) >> dev->shift; 372 - if (!dev->set_next_event((unsigned long) cycles, dev)) 369 + if (!dev->set_next_event((unsigned long) cycles, dev)) { 370 + dev->next_event_forced = 0; 373 371 return 0; 372 + } 374 373 } 375 374 376 375 if (dev->next_event_forced)
+1
kernel/time/tick-broadcast.c
··· 108 108 109 109 static void tick_oneshot_wakeup_handler(struct clock_event_device *wd) 110 110 { 111 + wd->next_event_forced = 0; 111 112 /* 112 113 * If we woke up early and the tick was reprogrammed in the 113 114 * meantime then this may be spurious but harmless.