From: "tip-bot2 for Anna-Maria Behnsen" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Johannes Berg <johannes@sipsolutions.net>,
"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] timers: Fix warning condition in __run_timers()
Date: Sat, 09 Apr 2022 20:22:32 -0000 [thread overview]
Message-ID: <164953575293.4207.16304445982254847122.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20220405191732.7438-3-anna-maria@linutronix.de>
The following commit has been merged into the timers/core branch of tip:
Commit-ID: c54bc0fc84214b203f7a0ebfd1bd308ce2abe920
Gitweb: https://git.kernel.org/tip/c54bc0fc84214b203f7a0ebfd1bd308ce2abe920
Author: Anna-Maria Behnsen <anna-maria@linutronix.de>
AuthorDate: Tue, 05 Apr 2022 21:17:32 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 09 Apr 2022 22:17:47 +02:00
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: 31cd0e119d50 ("timers: Recalculate next timer interrupt only when necessary")
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20220405191732.7438-3-anna-maria@linutronix.de
---
kernel/time/timer.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 85f1021..9dd2a39 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1722,11 +1722,14 @@ static inline void __run_timers(struct timer_base *base)
time_after_eq(jiffies, base->next_expiry)) {
levels = collect_expired_timers(base, heads);
/*
- * The only possible reason for not finding any expired
- * timer at this clk is that all matching timers have been
- * dequeued.
+ * The two possible reasons for not finding any expired
+ * timer at this clk are that all matching timers have been
+ * 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->next_expiry = __next_timer_interrupt(base);
prev parent reply other threads:[~2022-04-09 20:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 19:17 [PATCH 0/2] timers: Small fixes Anna-Maria Behnsen
2022-04-05 19:17 ` [PATCH 1/2] timers: Initialize base::next_expiry_recalc during prepare cpu Anna-Maria Behnsen
2022-04-05 21:51 ` Frederic Weisbecker
2022-04-09 20:22 ` [tip: timers/core] timers: Initialize base::next_expiry_recalc in timers_prepare_cpu() tip-bot2 for Anna-Maria Behnsen
2022-04-05 19:17 ` [PATCH 2/2] timers: Fix warning in __run_timers() Anna-Maria Behnsen
2022-04-05 21:43 ` Frederic Weisbecker
2022-04-09 20:22 ` tip-bot2 for Anna-Maria Behnsen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=164953575293.4207.16304445982254847122.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.