FAILED: patch "[PATCH] clocksource: Fix brown-bag boolean thinko in" failed to apply to 5.10-stable tree

gregkh
2024-08-11T15:56:49Z

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x f2655ac2c06a15558e51ed6529de280e1553c86e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2024081137-departed-drop-down-937e@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..

Possible dependencies:

f2655ac2c06a ("clocksource: Fix brown-bag boolean thinko in cs_watchdog_read()")
2ed08e4bc532 ("clocksource: Scale the watchdog read retries automatically")
877a0e83c57f ("torture: Enable clocksource watchdog with "tsc=watchdog"")
1a5620671a1b ("clocksource: Reduce the default clocksource_watchdog() retries to 2")
c86ff8c55b8a ("clocksource: Avoid accidental unstable marking of clocksources")
ef4dac7dbde7 ("torture: Add clocksource-watchdog testing to torture.sh")
1253b9b87e42 ("clocksource: Provide kernel module to test clocksource watchdog")
2e27e793e280 ("clocksource: Reduce clocksource-skew threshold")
fa218f1cce6b ("clocksource: Limit number of CPUs checked for clock synchronization")
7560c02bdffb ("clocksource: Check per-CPU clock synchronization when marked unstable")
db3a34e17433 ("clocksource: Retry clock read if long delays detected")
a115a775a8d5 ("torture: Add "make allmodconfig" to torture.sh")
197220d4a334 ("torture: Remove use of "eval" in torture.sh")
1adb5d6b5225 ("torture: Make torture.sh use common time-duration bash functions")
bfc19c13d24c ("torture: Add torture.sh torture-everything script")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From f2655ac2c06a15558e51ed6529de280e1553c86e Mon Sep 17 00:00:00 2001
From: "Paul E. McKenney" <paulmck@kernel.org>
Date: Fri, 2 Aug 2024 08:46:15 -0700
Subject: [PATCH] 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 "&&".

Fixes: db3a34e17433 ("clocksource: Retry clock read if long delays detected")
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20240802154618.4149953-2-paulmck@kernel.org

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index d25ba49e313c..d0538a75f4c6 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -246,7 +246,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);
}