Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1577670

[patch 2/2] x86/tsc: Make the TSC ADJUST sanitizing work for tsc_reliable

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject [patch 2/2] x86/tsc: Make the TSC ADJUST sanitizing work for tsc_reliable
Date 2017-02-09 16:20 +0100
Message-ID <t8YFQ-7Mt-9@gated-at.bofh.it> (permalink)
References <t8YFQ-7Mt-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When the TSC is marked reliable then the synchronization check is skipped,
but that also skips the TSC ADJUST sanitizing code. So on a machine with a
wreckaged BIOS the TSC deviation between CPUs might go unnoticed.

Let the TSC adjust sanitizing code run unconditionally and just skip the
expensive synchronization checks when TSC is marked reliable.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/tsc_sync.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -286,13 +286,6 @@ void check_tsc_sync_source(int cpu)
 	if (unsynchronized_tsc())
 		return;
 
-	if (tsc_clocksource_reliable) {
-		if (cpu == (nr_cpu_ids-1) || system_state != SYSTEM_BOOTING)
-			pr_info(
-			"Skipped synchronization checks as TSC is reliable.\n");
-		return;
-	}
-
 	/*
 	 * Set the maximum number of test runs to
 	 *  1 if the CPU does not provide the TSC_ADJUST MSR
@@ -380,14 +373,19 @@ void check_tsc_sync_target(void)
 	int cpus = 2;
 
 	/* Also aborts if there is no TSC. */
-	if (unsynchronized_tsc() || tsc_clocksource_reliable)
+	if (unsynchronized_tsc())
 		return;
 
 	/*
 	 * Store, verify and sanitize the TSC adjust register. If
 	 * successful skip the test.
+	 *
+	 * The test is also skipped when the TSC is marked reliable. This
+	 * is true for SoCs which have no fallback clocksource. On these
+	 * SoCs the TSC is frequency synchronized, but still the TSC ADJUST
+	 * register might have been wreckaged by the BIOS..
 	 */
-	if (tsc_store_and_check_tsc_adjust(false)) {
+	if (tsc_store_and_check_tsc_adjust(false) || tsc_clocksource_reliable) {
 		atomic_inc(&skip_test);
 		return;
 	}

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[patch 2/2] x86/tsc: Make the TSC ADJUST sanitizing work for  tsc_reliable Thomas Gleixner <tglx@linutronix.de> - 2017-02-09 16:20 +0100
  [tip:x86/urgent] x86/tsc: Make the TSC ADJUST sanitizing work for  tsc_reliable tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-02-10 10:50 +0100

csiph-web