public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 0/5] clocksource: Rewrite clocksource watchdog and related cleanups
@ 2026-01-23 23:17 Thomas Gleixner
  2026-01-23 23:17 ` [patch 1/5] parisc: Remove unused clocksource flags Thomas Gleixner
                   ` (4 more replies)
  0 siblings, 5 replies; 30+ messages in thread
From: Thomas Gleixner @ 2026-01-23 23:17 UTC (permalink / raw)
  To: LKML
  Cc: Paul E. McKenney, John Stultz, Waiman Long, Peter Zijlstra,
	Daniel Lezcano, Stephen Boyd, x86, Gautham R. Shenoy,
	Jiri Wiesner, Daniel J Blueman, Scott Hamilton, Helge Deller,
	linux-parisc, Thomas Bogendoerfer, linux-mips

The clocksource watchdog code has over time reached the state of an
unpenetrable maze of duct tape and staples. The original design, which was
made in the context of systems far smaller than today, is based on the
assumption that the to be monitored clocksource (TSC) can be trivially
compared against a known to be stable clocksource (HPET/ACPI-PM timer).

Over the years it turned out that this approach has major flaws:

  - Long delays between watchdog invocations can result in wrap arounds
    of the reference clocksource

  - Scalability of the reference clocksource readout can degrade on large
    multi-socket systems due to interconnect congestion

  - Fixed margins based on magic assumptions, which do not work when the
    watchdog interval diverges too much.

This was addressed with various heuristics which degraded the accurracy of
the watchdog to the point that it fails to detect actual TSC problems on
older hardware which exposes slow inter CPU drifts due to firmware
manipulating the TSC to hide SMI time.

To address this and bring back sanity to the watchdog, rewrite the code
completely with a different approach:

  1) Restrict the validation against a reference clocksource to the boot
     CPU, which is usually the CPU/Socket closest to the legacy block which
     contains the reference source (HPET/ACPI-PM timer). Validate that the
     reference readout is within a bound latency so that the actual
     comparison against the TSC stays within 500ppm as long as the clocks
     are stable.

  2) Compare the TSCs of the other CPUs in a round robin fashion against
     the boot CPU in the same way the TSC synchronization on CPU hotplug
     works. This still can suffer from delayed reaction of the remote CPU
     to the SMP function call and the latency of the control variable cache
     line. But this latency is not affecting correctness. It only affects
     the accuracy. With low contention the readout latency is in the low
     nanoseconds range, which detects even slight skews between CPUs. Under
     high contention this becomes obviously less accurate, but still
     detects slow skews reliably as it solely relies on subsequent readouts
     being monotonically increasing. It just can take slightly longer to
     detect the issue.

  3) Rewrite the watchdog test so it tests the various mechanisms one by
     one and validates the result against the expectation.

The series also cleans up random places which set the watchdog bits without
actually ever using them. Right now the only architecture which uses the
clocksource watchdog is x86.

The series is based on

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core

and also available from git:

   git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git timers/clocksource

Thanks,

	tglx
---
 Documentation/admin-guide/kernel-parameters.txt |    7 
 arch/mips/Kconfig                               |    1 
 arch/parisc/kernel/time.c                       |    5 
 arch/x86/include/asm/time.h                     |    1 
 arch/x86/kernel/hpet.c                          |    4 
 arch/x86/kernel/tsc.c                           |   61 --
 drivers/clocksource/Kconfig                     |    1 
 drivers/clocksource/acpi_pm.c                   |    4 
 include/linux/clocksource.h                     |   24 
 kernel/time/Kconfig                             |   12 
 kernel/time/clocksource-wdtest.c                |  268 ++++----
 kernel/time/clocksource.c                       |  731 ++++++++++++------------
 kernel/time/jiffies.c                           |    1 
 13 files changed, 536 insertions(+), 584 deletions(-)

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2026-03-20 12:42 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 23:17 [patch 0/5] clocksource: Rewrite clocksource watchdog and related cleanups Thomas Gleixner
2026-01-23 23:17 ` [patch 1/5] parisc: Remove unused clocksource flags Thomas Gleixner
2026-01-24  8:40   ` Helge Deller
2026-03-12 11:25   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2026-01-23 23:17 ` [patch 2/5] MIPS: Dont select CLOCKSOURCE_WATCHDOG Thomas Gleixner
2026-01-24 22:28   ` Maciej W. Rozycki
2026-01-26  9:10     ` Thomas Gleixner
2026-03-12 11:25   ` [tip: timers/core] MIPS: Don't " tip-bot2 for Thomas Gleixner
2026-01-23 23:17 ` [patch 3/5] x86/tsc: Handle CLOCK_SOURCE_VALID_FOR_HRES correctly Thomas Gleixner
2026-03-12 11:25   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2026-01-23 23:17 ` [patch 4/5] clocksource: Dont use non-continuous clocksources as watchdog Thomas Gleixner
2026-03-12 11:25   ` [tip: timers/core] clocksource: Don't " tip-bot2 for Thomas Gleixner
2026-01-23 23:18 ` [patch 5/5] clocksource: Rewrite watchdog code completely Thomas Gleixner
2026-02-02  6:45   ` Daniel J Blueman
2026-02-02 11:27     ` Thomas Gleixner
2026-02-15 12:18       ` Daniel J Blueman
2026-02-23 13:53         ` Thomas Gleixner
2026-03-08  9:53           ` Thomas Gleixner
2026-03-15 14:59           ` Daniel J Blueman
2026-03-17  9:01             ` Thomas Gleixner
2026-03-18 14:10               ` Daniel J Blueman
2026-03-19 20:31                 ` Thomas Gleixner
2026-03-20  2:21                   ` Daniel J Blueman
2026-03-20  8:26               ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2026-03-20 12:42               ` tip-bot2 for Thomas Gleixner
2026-02-25 18:13   ` [patch 5/5] " Jiri Wiesner
2026-03-08 10:05     ` Thomas Gleixner
2026-03-11 13:12       ` Jiri Wiesner
2026-03-09 15:43   ` Borislav Petkov
2026-03-11  7:58     ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox