public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag
       [not found] <87340xfeje.ffs@tglx>
@ 2026-04-16 19:26 ` tip-bot2 for Thomas Gleixner
  2026-04-19 15:11   ` Linux regression tracking (Thorsten Leemhuis)
  0 siblings, 1 reply; 6+ messages in thread
From: tip-bot2 for Thomas Gleixner @ 2026-04-16 19:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Hanabishi, Eric Naim, Thomas Gleixner, stable, x86, linux-kernel

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     4096fd0e8eaea13ebe5206700b33f49635ae18e5
Gitweb:        https://git.kernel.org/tip/4096fd0e8eaea13ebe5206700b33f49635ae18e5
Author:        Thomas Gleixner <tglx@kernel.org>
AuthorDate:    Tue, 14 Apr 2026 22:55:01 +02:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Thu, 16 Apr 2026 21:22:04 +02:00

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
---
 kernel/time/clockevents.c    | 7 ++++++-
 kernel/time/tick-broadcast.c | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index b4d7306..5e22697 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -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)
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 7e57fa3..115e0bf 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -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.

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag
  2026-04-16 19:26 ` [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag tip-bot2 for Thomas Gleixner
@ 2026-04-19 15:11   ` Linux regression tracking (Thorsten Leemhuis)
  2026-04-21  6:18     ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Linux regression tracking (Thorsten Leemhuis) @ 2026-04-19 15:11 UTC (permalink / raw)
  To: Thomas Gleixner, Linus Torvalds
  Cc: Hanabishi, Eric Naim, stable, linux-tip-commits, x86,
	linux-kernel, Linux kernel regressions list

On 4/16/26 21:26, tip-bot2 for Thomas Gleixner wrote:
> The following commit has been merged into the timers/urgent branch of tip:
> 
> Commit-ID:     4096fd0e8eaea13ebe5206700b33f49635ae18e5
> Gitweb:        https://git.kernel.org/tip/4096fd0e8eaea13ebe5206700b33f49635ae18e5
> Author:        Thomas Gleixner <tglx@kernel.org>
> AuthorDate:    Tue, 14 Apr 2026 22:55:01 +02:00
> Committer:     Thomas Gleixner <tglx@kernel.org>
> CommitterDate: Thu, 16 Apr 2026 21:22:04 +02:00
> 
> clockevents: Add missing resets of the next_event_forced flag

Just wondering: what's the plan to mainline this? I wonder if this is
worth mainlining rather quickly and the tell the stable team right
afterwards to queue it up for 7.0.1, as in addition to the two affected
people in this thread (one of which stated that "several users from
CachyOS reported this regression as well") I noticed three more 7.0 bug
reports in the past few days that likely are fixed by the quoted patch:

https://gitlab.freedesktop.org/drm/amd/-/work_items/5178#note_3432195
https://bugzilla.kernel.org/show_bug.cgi?id=221370
https://bugzilla.kernel.org/show_bug.cgi?id=221377

Ciao, Thorsten

> 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
> ---
>  kernel/time/clockevents.c    | 7 ++++++-
>  kernel/time/tick-broadcast.c | 1 +
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
> index b4d7306..5e22697 100644
> --- a/kernel/time/clockevents.c
> +++ b/kernel/time/clockevents.c
> @@ -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)
> diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
> index 7e57fa3..115e0bf 100644
> --- a/kernel/time/tick-broadcast.c
> +++ b/kernel/time/tick-broadcast.c
> @@ -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.
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag
  2026-04-19 15:11   ` Linux regression tracking (Thorsten Leemhuis)
@ 2026-04-21  6:18     ` Thomas Gleixner
  2026-04-21  6:26       ` Thorsten Leemhuis
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2026-04-21  6:18 UTC (permalink / raw)
  To: Linux regression tracking (Thorsten Leemhuis), Linus Torvalds
  Cc: Hanabishi, Eric Naim, stable, linux-tip-commits, x86,
	linux-kernel, Linux kernel regressions list

On Sun, Apr 19 2026 at 17:11, Linux regression tracking (Thorsten Leemhuis) wrote:
> On 4/16/26 21:26, tip-bot2 for Thomas Gleixner wrote:
>> The following commit has been merged into the timers/urgent branch of tip:
>> 
>> Commit-ID:     4096fd0e8eaea13ebe5206700b33f49635ae18e5
>> Gitweb:        https://git.kernel.org/tip/4096fd0e8eaea13ebe5206700b33f49635ae18e5
>> Author:        Thomas Gleixner <tglx@kernel.org>
>> AuthorDate:    Tue, 14 Apr 2026 22:55:01 +02:00
>> Committer:     Thomas Gleixner <tglx@kernel.org>
>> CommitterDate: Thu, 16 Apr 2026 21:22:04 +02:00
>> 
>> clockevents: Add missing resets of the next_event_forced flag
>
> Just wondering: what's the plan to mainline this? I wonder if this is
> worth mainlining rather quickly and the tell the stable team right
> afterwards to queue it up for 7.0.1, as in addition to the two affected
> people in this thread (one of which stated that "several users from
> CachyOS reported this regression as well") I noticed three more 7.0 bug
> reports in the past few days that likely are fixed by the quoted patch:

It's in Linus tree and I asked the stable folks to withhold the original
patch which it fixes, so they can queue both at once.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag
  2026-04-21  6:18     ` Thomas Gleixner
@ 2026-04-21  6:26       ` Thorsten Leemhuis
  2026-04-21  6:41         ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Leemhuis @ 2026-04-21  6:26 UTC (permalink / raw)
  To: Thomas Gleixner, Greg KH
  Cc: Hanabishi, Eric Naim, stable, linux-tip-commits, x86,
	Linus Torvalds, linux-kernel, Linux kernel regressions list

On 4/21/26 08:18, Thomas Gleixner wrote:
> On Sun, Apr 19 2026 at 17:11, Linux regression tracking (Thorsten Leemhuis) wrote:
>> On 4/16/26 21:26, tip-bot2 for Thomas Gleixner wrote:
>>> The following commit has been merged into the timers/urgent branch of tip:
>>>
>>> Commit-ID:     4096fd0e8eaea13ebe5206700b33f49635ae18e5
>>> Gitweb:        https://git.kernel.org/tip/4096fd0e8eaea13ebe5206700b33f49635ae18e5
>>> Author:        Thomas Gleixner <tglx@kernel.org>
>>> AuthorDate:    Tue, 14 Apr 2026 22:55:01 +02:00
>>> Committer:     Thomas Gleixner <tglx@kernel.org>
>>> CommitterDate: Thu, 16 Apr 2026 21:22:04 +02:00
>>>
>>> clockevents: Add missing resets of the next_event_forced flag
>>
>> Just wondering: what's the plan to mainline this? I wonder if this is
>> worth mainlining rather quickly and the tell the stable team right
>> afterwards to queue it up for 7.0.1, as in addition to the two affected
>> people in this thread (one of which stated that "several users from
>> CachyOS reported this regression as well") I noticed three more 7.0 bug
>> reports in the past few days that likely are fixed by the quoted patch:
> 
> It's in Linus tree and I asked the stable folks to withhold the original
> patch which it fixes, so they can queue both at once.

Yeah, I noticed, and many thx! Also many thx for planning the backport,
this is great. But that "original patch" is already in 7.0, which makes
me wonder:

Should we ask Greg (now CCed) to include a backport (once it exists) for
7.0.1, even if that is in testing already and might mean that this needs
another stable-rc or delayed? Because in addition to those three reports
I mentioned earlier I noticed one more today:
https://bugzilla.kernel.org/show_bug.cgi?id=221377

And maybe this is the same issue, too:
https://bugzilla.kernel.org/show_bug.cgi?id=221388

IOW: quite a few people are hitting this.

Ciao, Thorsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag
  2026-04-21  6:26       ` Thorsten Leemhuis
@ 2026-04-21  6:41         ` Greg KH
  2026-04-21  6:42           ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2026-04-21  6:41 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Thomas Gleixner, Hanabishi, Eric Naim, stable, linux-tip-commits,
	x86, Linus Torvalds, linux-kernel, Linux kernel regressions list

On Tue, Apr 21, 2026 at 08:26:35AM +0200, Thorsten Leemhuis wrote:
> On 4/21/26 08:18, Thomas Gleixner wrote:
> > On Sun, Apr 19 2026 at 17:11, Linux regression tracking (Thorsten Leemhuis) wrote:
> >> On 4/16/26 21:26, tip-bot2 for Thomas Gleixner wrote:
> >>> The following commit has been merged into the timers/urgent branch of tip:
> >>>
> >>> Commit-ID:     4096fd0e8eaea13ebe5206700b33f49635ae18e5
> >>> Gitweb:        https://git.kernel.org/tip/4096fd0e8eaea13ebe5206700b33f49635ae18e5
> >>> Author:        Thomas Gleixner <tglx@kernel.org>
> >>> AuthorDate:    Tue, 14 Apr 2026 22:55:01 +02:00
> >>> Committer:     Thomas Gleixner <tglx@kernel.org>
> >>> CommitterDate: Thu, 16 Apr 2026 21:22:04 +02:00
> >>>
> >>> clockevents: Add missing resets of the next_event_forced flag
> >>
> >> Just wondering: what's the plan to mainline this? I wonder if this is
> >> worth mainlining rather quickly and the tell the stable team right
> >> afterwards to queue it up for 7.0.1, as in addition to the two affected
> >> people in this thread (one of which stated that "several users from
> >> CachyOS reported this regression as well") I noticed three more 7.0 bug
> >> reports in the past few days that likely are fixed by the quoted patch:
> > 
> > It's in Linus tree and I asked the stable folks to withhold the original
> > patch which it fixes, so they can queue both at once.
> 
> Yeah, I noticed, and many thx! Also many thx for planning the backport,
> this is great. But that "original patch" is already in 7.0, which makes
> me wonder:
> 
> Should we ask Greg (now CCed) to include a backport (once it exists) for
> 7.0.1, even if that is in testing already and might mean that this needs
> another stable-rc or delayed? Because in addition to those three reports
> I mentioned earlier I noticed one more today:
> https://bugzilla.kernel.org/show_bug.cgi?id=221377
> 
> And maybe this is the same issue, too:
> https://bugzilla.kernel.org/show_bug.cgi?id=221388
> 
> IOW: quite a few people are hitting this.

I've already dropped this from all of the other stable queues.  If you
want me to pick up something from linux-next now, for 7.0.1, I'll be
glad to do so, just let me know.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag
  2026-04-21  6:41         ` Greg KH
@ 2026-04-21  6:42           ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2026-04-21  6:42 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Thomas Gleixner, Hanabishi, Eric Naim, stable, linux-tip-commits,
	x86, Linus Torvalds, linux-kernel, Linux kernel regressions list

On Tue, Apr 21, 2026 at 08:41:17AM +0200, Greg KH wrote:
> On Tue, Apr 21, 2026 at 08:26:35AM +0200, Thorsten Leemhuis wrote:
> > On 4/21/26 08:18, Thomas Gleixner wrote:
> > > On Sun, Apr 19 2026 at 17:11, Linux regression tracking (Thorsten Leemhuis) wrote:
> > >> On 4/16/26 21:26, tip-bot2 for Thomas Gleixner wrote:
> > >>> The following commit has been merged into the timers/urgent branch of tip:
> > >>>
> > >>> Commit-ID:     4096fd0e8eaea13ebe5206700b33f49635ae18e5
> > >>> Gitweb:        https://git.kernel.org/tip/4096fd0e8eaea13ebe5206700b33f49635ae18e5
> > >>> Author:        Thomas Gleixner <tglx@kernel.org>
> > >>> AuthorDate:    Tue, 14 Apr 2026 22:55:01 +02:00
> > >>> Committer:     Thomas Gleixner <tglx@kernel.org>
> > >>> CommitterDate: Thu, 16 Apr 2026 21:22:04 +02:00
> > >>>
> > >>> clockevents: Add missing resets of the next_event_forced flag
> > >>
> > >> Just wondering: what's the plan to mainline this? I wonder if this is
> > >> worth mainlining rather quickly and the tell the stable team right
> > >> afterwards to queue it up for 7.0.1, as in addition to the two affected
> > >> people in this thread (one of which stated that "several users from
> > >> CachyOS reported this regression as well") I noticed three more 7.0 bug
> > >> reports in the past few days that likely are fixed by the quoted patch:
> > > 
> > > It's in Linus tree and I asked the stable folks to withhold the original
> > > patch which it fixes, so they can queue both at once.
> > 
> > Yeah, I noticed, and many thx! Also many thx for planning the backport,
> > this is great. But that "original patch" is already in 7.0, which makes
> > me wonder:
> > 
> > Should we ask Greg (now CCed) to include a backport (once it exists) for
> > 7.0.1, even if that is in testing already and might mean that this needs
> > another stable-rc or delayed? Because in addition to those three reports
> > I mentioned earlier I noticed one more today:
> > https://bugzilla.kernel.org/show_bug.cgi?id=221377
> > 
> > And maybe this is the same issue, too:
> > https://bugzilla.kernel.org/show_bug.cgi?id=221388
> > 
> > IOW: quite a few people are hitting this.
> 
> I've already dropped this from all of the other stable queues.  If you
> want me to pick up something from linux-next now, for 7.0.1, I'll be
> glad to do so, just let me know.

Ah, nevermind, I see Thomas sent this right before I wrote this email,
I'll go pick it up after my morning coffee kicks in :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-21  6:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87340xfeje.ffs@tglx>
2026-04-16 19:26 ` [tip: timers/urgent] clockevents: Add missing resets of the next_event_forced flag tip-bot2 for Thomas Gleixner
2026-04-19 15:11   ` Linux regression tracking (Thorsten Leemhuis)
2026-04-21  6:18     ` Thomas Gleixner
2026-04-21  6:26       ` Thorsten Leemhuis
2026-04-21  6:41         ` Greg KH
2026-04-21  6:42           ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox