mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] clocksource: tsc: respect tsc bootparam for clocksource_tsc_early
@ 2019-10-24 17:59 Michael Zhivich
  2019-11-05  0:29 ` [tip: x86/urgent] x86/tsc: Respect tsc command line paraemeter " tip-bot2 for Michael Zhivich
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Zhivich @ 2019-10-24 17:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, mingo, bp, hpa, rafael.j.wysocki, Michael Zhivich

Introduction of clocksource_tsc_early broke functionality of "tsc=reliable"
and "tsc=nowatchdog" bootparams, since clocksource_tsc_early is *always*
registered with CLOCK_SOURCE_MUST_VERIFY and thus put on the watchdog list.

This frequently causes TSC to be declared unstable during boot:

  clocksource: timekeeping watchdog on CPU0: Marking clocksource
               'tsc-early' as unstable because the skew is too large:
  clocksource: 'refined-jiffies' wd_now: fffb7018 wd_last: fffb6e9d 
               mask: ffffffff
  clocksource: 'tsc-early' cs_now: 68a6a7070f6a0 cs_last: 68a69ab6f74d6 
               mask: ffffffffffffffff
  tsc: Marking TSC unstable due to clocksource watchdog

The corresponding elapsed times are cs_nsec=1224152026 and wd_nsec=378942392, so
watchdog differs from TSC by 0.84 seconds.  Since jiffies is not guaranteed
to provide reliable timekeeping due to possibility of missing timer
interrupts, this is a false positive.

This issue affects machines running with HPET disabled; otherwise, HPET would
be the watchdog for tsc-early clocksource, and this situation would be avoided. 

Restore previous behavior by respecting "tsc=reliable" and "tsc=nowatchdog"
boot params when registering clocksource_tsc_early.

Fixes: aa83c45762a24 ("x86/tsc: Introduce early tsc clocksource")
Signed-off-by: Michael Zhivich <mzhivich@akamai.com>
---
 arch/x86/kernel/tsc.c | 3 +++
 1 file changed, 3 insertions(+)

 Changes from v1: updated commit message, added "Fixes" tag.

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index c59454c382fd..7e322e2daaf5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1505,6 +1505,9 @@ void __init tsc_init(void)
 		return;
 	}
 
+	if (tsc_clocksource_reliable || no_tsc_watchdog)
+		clocksource_tsc_early.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
+
 	clocksource_register_khz(&clocksource_tsc_early, tsc_khz);
 	detect_art();
 }
-- 
2.17.1


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

end of thread, other threads:[~2019-11-05  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24 17:59 [PATCH v2] clocksource: tsc: respect tsc bootparam for clocksource_tsc_early Michael Zhivich
2019-11-05  0:29 ` [tip: x86/urgent] x86/tsc: Respect tsc command line paraemeter " tip-bot2 for Michael Zhivich

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

all inboxes | Powered by JetHome®