[tip: timers/core] clocksource: Don't use non-continuous clocksources as watchdog
From: tip-bot2 for Thomas Gleixner
Date: Thu Mar 12 2026 - 07:26:44 EST
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 1432f9d4e8aa2d7585b678bdd0b740597af00d6e
Gitweb: https://git.kernel.org/tip/1432f9d4e8aa2d7585b678bdd0b740597af00d6e
Author: Thomas Gleixner <tglx@xxxxxxxxxx>
AuthorDate: Sat, 24 Jan 2026 00:17:57 +01:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Thu, 12 Mar 2026 12:23:27 +01:00
clocksource: Don't use non-continuous clocksources as watchdog
Using a non-continuous aka untrusted clocksource as a watchdog for another
untrusted clocksource is equivalent to putting the fox in charge of the
henhouse.
That's especially true with the jiffies clocksource which depends on
interrupt delivery based on a periodic timer. Neither the frequency of that
timer is trustworthy nor the kernel's ability to react on it in a timely
manner and rearm it if it is not self rearming.
Just don't bother to deal with this. It's not worth the trouble and only
relevant to museum piece hardware.
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20260123231521.858743259@xxxxxxxxxx
---
kernel/time/clocksource.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 3c20544..e753a06 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -651,6 +651,13 @@ static void clocksource_select_watchdog(bool fallback)
if (cs->flags & CLOCK_SOURCE_MUST_VERIFY)
continue;
+ /*
+ * If it's not continuous, don't put the fox in charge of
+ * the henhouse.
+ */
+ if (!(cs->flags & CLOCK_SOURCE_IS_CONTINUOUS))
+ continue;
+
/* Skip current if we were requested for a fallback. */
if (fallback && cs == old_wd)
continue;