[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240802154618.4149953-2-paulmck@kernel.org>
Date: Fri, 2 Aug 2024 08:46:15 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>
Cc: "H. Peter Anvin" <hpa@...or.com>,
John Stultz <jstultz@...gle.com>,
Stephen Boyd <sboyd@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Feng Tang <feng.tang@...el.com>,
Waiman Long <longman@...hat.com>,
Neeraj Upadhyay <Neeraj.Upadhyay@....com>,
x86@...nel.org,
kernel-team@...a.com,
linux-kernel@...r.kernel.org,
"Paul E. McKenney" <paulmck@...nel.org>
Subject: [PATCH v2 TSC and clocksource-watchdog updates for v6.12 2/5] clocksource: Fix brown-bag boolean thinko in cs_watchdog_read()
The current "nretries > 1 || nretries >= max_retries" check in
cs_watchdog_read() will always evaluate to true, and thus pr_warn(), if
nretries is greater than 1. The intent is instead to never warn on the
first try, but otherwise warn if the successful retry was the last retry.
Therefore, change that "||" to "&&".
Reported-by: Borislav Petkov <bp@...en8.de>
Fixes: db3a34e17433 ("clocksource: Retry clock read if long delays detected")
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
---
kernel/time/clocksource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 9ca4e8d2a70f8..581cdbb538448 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -253,7 +253,7 @@ static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow,
wd_delay = cycles_to_nsec_safe(watchdog, *wdnow, wd_end);
if (wd_delay <= WATCHDOG_MAX_SKEW) {
- if (nretries > 1 || nretries >= max_retries) {
+ if (nretries > 1 && nretries >= max_retries) {
pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n",
smp_processor_id(), watchdog->name, nretries);
}
--
2.40.1
Powered by blists - more mailing lists