Skip to contentSkip to conversation

FAILED: patch "[PATCH] clockevents: Add missing resets of the next_event_forced flag" failed to apply to 7.0-stable tree

PATCH [email protected] 2 participants 3 messages May 12 – May 14

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 7.0-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.0.y
git checkout FETCH_HEAD
git cherry-pick -x 4096fd0e8eaea13ebe5206700b33f49635ae18e5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026051258-schedule-parcel-c95c@gregkh' --subject-prefix 'PATCH 7.0.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 4096fd0e8eaea13ebe5206700b33f49635ae18e5 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <[email protected]>
Date: Tue, 14 Apr 2026 22:55:01 +0200
Subject: [PATCH] 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.

kernel/time/clockevents.c +6 -1
index b4d730604972..5e22697b098d 100644
@@ -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,8 +369,10 @@ 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)
kernel/time/tick-broadcast.c +1 -0
index 7e57fa31ee26..115e0bf01276 100644
@@ -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.
maintainer
#1 lore raw
Quoted 1 line · On Tue, May 12 2026 at 15:50, [email protected] wrote:

The patch below does not apply to the 7.0-stable tree.

Obviously not. It's in linux-7.0.y since April 22:

commit 9401b593fa48218d2667df1610b0ebc518554880

Author:     Thomas Gleixner <[email protected]>
AuthorDate: Tue Apr 21 08:26:19 2026 +0200
Commit:     Greg Kroah-Hartman <[email protected]>
CommitDate: Wed Apr 22 13:32:23 2026 +0200

clockevents: Add missing resets of the next_event_forced flag

commit 4096fd0e8eaea13ebe5206700b33f49635ae18e5 upstream.

author maintainer
#2 lore raw
Quoted 6 lines · Thomas Gleixner
Quoted 1 line · On Tue, May 12 2026 at 15:50, [email protected] wrote:

The patch below does not apply to the 7.0-stable tree.

Obviously not. It's in linux-7.0.y since April 22:

commit 9401b593fa48218d2667df1610b0ebc518554880

Quoted 9 lines
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Tue Apr 21 08:26:19 2026 +0200
Commit:     Greg Kroah-Hartman <[email protected]>
CommitDate: Wed Apr 22 13:32:23 2026 +0200

clockevents: Add missing resets of the next_event_forced flag

commit 4096fd0e8eaea13ebe5206700b33f49635ae18e5 upstream.

Sorry about that, my fault :(