public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] x86/tsc: Future-proof native_calibrate_tsc()
@ 2017-12-22  5:27 Len Brown
  2017-12-22  5:27 ` [PATCH 2/3] x86/tsc: Fix erroneous TSC rate on Skylake Xeon Len Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Len Brown @ 2017-12-22  5:27 UTC (permalink / raw)
  To: x86; +Cc: peterz, linux-kernel, Len Brown, Bin Gao, stable

From: Len Brown <len.brown@intel.com>

If native_calibrate_tsc() can not discover the TSC frequency,
via CPUID or via built-in table, it must return without
setting X86_FEATURE_TSC_KNOWN_FREQ.  Otherwise, X86_FEATURE_TSC_KNOWN_FREQ
will prevent TSC refined calibration.

This patch allows Linux to correctly support future Intel hardware,
that has (cpu_khz != tsc_khz), and support for CPUID.15
without support for CPUID.15.crystal_khz.

This patch is needed since X86_FEATURE_TSC_KNOWN_FREQ was added in Linux-4.10:

	commit 4ca4df0b7eb0
	("x86/tsc: Mark TSC frequency determined by CPUID as known")

If not applied, such systems will run with tsc_khz = cpu_khz,
which may result in under-stated TSC rate, and time-of-day drift.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Bin Gao <bin.gao@intel.com>
Cc: <stable@vger.kernel.org> # v4.10+
---
 arch/x86/kernel/tsc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 8ea117f8142e..ce4b71119c36 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -612,6 +612,8 @@ unsigned long native_calibrate_tsc(void)
 		}
 	}
 
+	if (crystal_khz == 0)
+		return 0;
 	/*
 	 * TSC frequency determined by CPUID is a "hardware reported"
 	 * frequency and is the most accurate one so far we have. This
-- 
2.14.0-rc0

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

end of thread, other threads:[~2018-01-14 11:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-22  5:27 [PATCH 1/3] x86/tsc: Future-proof native_calibrate_tsc() Len Brown
2017-12-22  5:27 ` [PATCH 2/3] x86/tsc: Fix erroneous TSC rate on Skylake Xeon Len Brown
2018-01-02 15:36   ` Prarit Bhargava
2018-01-02 21:09     ` Len Brown
2018-01-14 11:43   ` [tip:x86/urgent] " tip-bot for Len Brown
2017-12-22  5:27 ` [PATCH 3/3] x86/tsc: Print tsc_khz, when it differs from cpu_khz Len Brown
2018-01-14 11:44   ` [tip:x86/urgent] " tip-bot for Len Brown
2018-01-14 11:43 ` [tip:x86/urgent] x86/tsc: Future-proof native_calibrate_tsc() tip-bot for Len Brown

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