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

Joseph Salisbury joseph.salisbury at canonical.com
Thu Feb 1 18:59:29 UTC 2018


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

BugLink: http://bugs.launchpad.net/bugs/1744988

If CPU and TSC frequency are the same the printout of the CPU frequency is
valid for the TSC as well:

      tsc: Detected 2900.000 MHz processor

If the TSC frequency is different there is no information in dmesg. Add a
conditional printout:

  tsc: Detected 2904.000 MHz TSC

Signed-off-by: Len Brown <len.brown at intel.com>
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Cc: peterz at infradead.org
Link: https://lkml.kernel.org/r/537b342debcd8e8aebc8d631015dcdf9f9ba8a26.1513920414.git.len.brown@intel.com

(cherry picked from commit 4b5b2127238e689ee18aa6752959751dd61c4c73)
Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
---
 arch/x86/kernel/tsc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 0be7a5f..0fc353b 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1297,6 +1297,12 @@ 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.7.4





More information about the kernel-team mailing list