aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-02-09 10:08:42 -0500
committerThomas Gleixner <tglx@linutronix.de>2017-02-10 03:47:17 -0500
commit5f2e71e71410ecb858cfec184ba092adaca61626 (patch)
treedae498d353d35fd4e89597143e9f5e125c886968
parentf2e04214ef7f7e49d1e06109ad1b2718155dab25 (diff)
x86/tsc: Make the TSC ADJUST sanitizing work for tsc_reliable
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> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Olof Johansson <olof@lixom.net> Link: http://lkml.kernel.org/r/20170209151231.491189912@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/tsc_sync.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index d0db011051a5..728f75378475 100644
--- 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)
286 if (unsynchronized_tsc()) 286 if (unsynchronized_tsc())
287 return; 287 return;
288 288
289 if (tsc_clocksource_reliable) {
290 if (cpu == (nr_cpu_ids-1) || system_state != SYSTEM_BOOTING)
291 pr_info(
292 "Skipped synchronization checks as TSC is reliable.\n");
293 return;
294 }
295
296 /* 289 /*
297 * Set the maximum number of test runs to 290 * Set the maximum number of test runs to
298 * 1 if the CPU does not provide the TSC_ADJUST MSR 291 * 1 if the CPU does not provide the TSC_ADJUST MSR
@@ -380,14 +373,19 @@ void check_tsc_sync_target(void)
380 int cpus = 2; 373 int cpus = 2;
381 374
382 /* Also aborts if there is no TSC. */ 375 /* Also aborts if there is no TSC. */
383 if (unsynchronized_tsc() || tsc_clocksource_reliable) 376 if (unsynchronized_tsc())
384 return; 377 return;
385 378
386 /* 379 /*
387 * Store, verify and sanitize the TSC adjust register. If 380 * Store, verify and sanitize the TSC adjust register. If
388 * successful skip the test. 381 * successful skip the test.
382 *
383 * The test is also skipped when the TSC is marked reliable. This
384 * is true for SoCs which have no fallback clocksource. On these
385 * SoCs the TSC is frequency synchronized, but still the TSC ADJUST
386 * register might have been wreckaged by the BIOS..
389 */ 387 */
390 if (tsc_store_and_check_tsc_adjust(false)) { 388 if (tsc_store_and_check_tsc_adjust(false) || tsc_clocksource_reliable) {
391 atomic_inc(&skip_test); 389 atomic_inc(&skip_test);
392 return; 390 return;
393 } 391 }