[PATCH 1/3] x86/tsc: future proof native_calibrate_tsc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Len Brown <len.brown@xxxxxxxxx>

Linux-4.10 added X86_FEATURE_TSC_KNOWN_FREQ.

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

When it is set, run-time refined TSC calibration is disabled.

But native_calibrate_tsc() sets it on all systems with CPUID.15,
even if crystal_khz can not be discovered via CPUID.15 or via
built-in table.  eg. When a new Intel processor comes out
that does not return CPUID.15.crystal_khz, and does not have
its model# and crystal_khz listed in native_calibate_tsc().

This results in (tsc_khz = cpu_khz) and TSC refined calibration
disabled.  But for machines with the TSC and CPU in different clock
domains (and those support CPUID.15), almost all such configurations
will experience measurable negative timeofday clock drift.

Signed-off-by: Len Brown <len.brown@xxxxxxxxx>
Cc: Bin Gao <bin.gao@xxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 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..49d772672367 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -609,6 +609,8 @@ unsigned long native_calibrate_tsc(void)
 		case INTEL_FAM6_ATOM_GOLDMONT:
 			crystal_khz = 19200;	/* 19.2 MHz */
 			break;
+		default:
+			return 0;	/* no X86_FEATURE_TSC_KNOWN_FREQ */
 		}
 	}
 
-- 
2.14.0-rc0




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]