[PATCH] clockevents: Reset next_event_forced in the coupled programming path

Zhan Xusheng posted 1 patch 1 month, 2 weeks ago
kernel/time/clockevents.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] clockevents: Reset next_event_forced in the coupled programming path
Posted by Zhan Xusheng 1 month, 2 weeks ago
All successful event programming paths in clockevents_program_event()
reset next_event_forced to zero, except the clockevent_set_next_coupled()
path which was added before the starvation prevention mechanism.

Add the missing reset for consistency.

Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
---
 kernel/time/clockevents.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 5e22697b098d..ee1a350b9b43 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -357,8 +357,10 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, b
 	if (unlikely(dev->features & CLOCK_EVT_FEAT_HRTIMER))
 		return dev->set_next_ktime(expires, dev);
 
-	if (likely(clockevent_set_next_coupled(dev, expires)))
+	if (likely(clockevent_set_next_coupled(dev, expires))) {
+		dev->next_event_forced = 0;
 		return 0;
+	}
 
 	delta = ktime_to_ns(ktime_sub(expires, ktime_get()));
 
-- 
2.43.0
Re: [PATCH] clockevents: Reset next_event_forced in the coupled programming path
Posted by Thomas Gleixner 1 month, 2 weeks ago
On Mon, Apr 27 2026 at 17:28, Zhan Xusheng wrote:
> All successful event programming paths in clockevents_program_event()
> reset next_event_forced to zero, except the clockevent_set_next_coupled()
> path which was added before the starvation prevention mechanism.
>
> Add the missing reset for consistency.

What for?

It never reaches the point where it sets or checks that
next_event_forced bit.

Your AI slop is clearly not getting it.
Re: [PATCH] clockevents: Reset next_event_forced in the coupled programming path
Posted by Zhan Xusheng 1 month, 2 weeks ago
On Mon, 27 Apr 2026 at 17:08, Thomas Gleixner <tglx@kernel.org> wrote:
> What for?
>
> It never reaches the point where it sets or checks that
> next_event_forced bit.

You're right. Devices using the coupled path never reach the code
which sets or checks next_event_forced, so this reset is dead code.

Sorry for the noise.

Zhan Xusheng