[PATCH 3/3] x86/tsc: Print tsc_khz, when it differs from cpu_khz

From: Len Brown
Date: Fri Dec 22 2017 - 00:28:51 EST


From: Len Brown <len.brown@xxxxxxxxx>

When Linux detects the CPU and TSC rate are the same

tsc: Detected 2900.000 MHz processor

tells us both. But if Linux detects a TSC rate that differs
from the CPU rate, print that also:

tsc: Detected 2904.000 MHz TSC

Signed-off-by: Len Brown <len.brown@xxxxxxxxx>
---
arch/x86/kernel/tsc.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 3bf4df7f52d7..6077ef5354d5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1316,6 +1316,11 @@ void __init tsc_init(void)
(unsigned long)cpu_khz / 1000,
(unsigned long)cpu_khz % 1000);

+ if (cpu_khz != tsc_khz)
+ pr_info("Detected %lu.%03lu MHz TSC",
+ (unsigned long)tsc_khz / 1000,
+ (unsigned long)tsc_khz % 1000);
+
/* Sanitize TSC ADJUST before cyc2ns gets initialized */
tsc_store_and_check_tsc_adjust(true);

--
2.14.0-rc0