Commit c54bc0fc authored by Anna-Maria Behnsen's avatar Anna-Maria Behnsen Committed by Thomas Gleixner

timers: Fix warning condition in __run_timers()

When the timer base is empty, base::next_expiry is set to base::clk +
NEXT_TIMER_MAX_DELTA and base::next_expiry_recalc is false. When no timer
is queued until jiffies reaches base::next_expiry value, the warning for
not finding any expired timer and base::next_expiry_recalc is false in
__run_timers() triggers.

To prevent triggering the warning in this valid scenario
base::timers_pending needs to be added to the warning condition.

Fixes: 31cd0e11 ("timers: Recalculate next timer interrupt only when necessary")
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarAnna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20220405191732.7438-3-anna-maria@linutronix.de
parent 31231092
...@@ -1722,11 +1722,14 @@ static inline void __run_timers(struct timer_base *base) ...@@ -1722,11 +1722,14 @@ static inline void __run_timers(struct timer_base *base)
time_after_eq(jiffies, base->next_expiry)) { time_after_eq(jiffies, base->next_expiry)) {
levels = collect_expired_timers(base, heads); levels = collect_expired_timers(base, heads);
/* /*
* The only possible reason for not finding any expired * The two possible reasons for not finding any expired
* timer at this clk is that all matching timers have been * timer at this clk are that all matching timers have been
* dequeued. * dequeued or no timer has been queued since
* base::next_expiry was set to base::clk +
* NEXT_TIMER_MAX_DELTA.
*/ */
WARN_ON_ONCE(!levels && !base->next_expiry_recalc); WARN_ON_ONCE(!levels && !base->next_expiry_recalc
&& base->timers_pending);
base->clk++; base->clk++;
base->next_expiry = __next_timer_interrupt(base); base->next_expiry = __next_timer_interrupt(base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment