Skip to contentSkip to conversation

clockevents: Reset next_event_forced in the coupled programming path

PATCH In review Zhan Xusheng 2 participants 3 messages Apr 27 – Apr 28 High-resolution timers, timer wheel, clockevents

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clockevents: Reset next_event_forced in the coupled programming path

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.

---
 kernel/time/clockevents.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/time/clockevents.c +3 -1
index 5e22697b098d..ee1a350b9b43 100644
@@ -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()));
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 5 lines · Zhan Xusheng

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.

#2 lore raw
Quoted 4 lines · Thomas Gleixner

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