Commit ccbc9fdb authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'timers-urgent-2026-04-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
 "Fix timer stalls caused by incorrect handling of the
  dev->next_event_forced flag"

* tag 'timers-urgent-2026-04-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clockevents: Add missing resets of the next_event_forced flag
parents 65e9974a 4096fd0e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@ static int __clockevents_switch_state(struct clock_event_device *dev,
	if (dev->features & CLOCK_EVT_FEAT_DUMMY)
		return 0;

	/* On state transitions clear the forced flag unconditionally */
	dev->next_event_forced = 0;

	/* Transition with new state-specific callbacks */
	switch (state) {
	case CLOCK_EVT_STATE_DETACHED:
@@ -366,9 +369,11 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, b
	if (delta > (int64_t)dev->min_delta_ns) {
		delta = min(delta, (int64_t) dev->max_delta_ns);
		cycles = ((u64)delta * dev->mult) >> dev->shift;
		if (!dev->set_next_event((unsigned long) cycles, dev))
		if (!dev->set_next_event((unsigned long) cycles, dev)) {
			dev->next_event_forced = 0;
			return 0;
		}
	}

	if (dev->next_event_forced)
		return 0;
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ static struct clock_event_device *tick_get_oneshot_wakeup_device(int cpu)

static void tick_oneshot_wakeup_handler(struct clock_event_device *wd)
{
	wd->next_event_forced = 0;
	/*
	 * If we woke up early and the tick was reprogrammed in the
	 * meantime then this may be spurious but harmless.