Commit 5f2e71e7 authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas 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.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent f2e04214
...@@ -286,13 +286,6 @@ void check_tsc_sync_source(int cpu) ...@@ -286,13 +286,6 @@ void check_tsc_sync_source(int cpu)
if (unsynchronized_tsc()) if (unsynchronized_tsc())
return; 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 * Set the maximum number of test runs to
* 1 if the CPU does not provide the TSC_ADJUST MSR * 1 if the CPU does not provide the TSC_ADJUST MSR
...@@ -380,14 +373,19 @@ void check_tsc_sync_target(void) ...@@ -380,14 +373,19 @@ void check_tsc_sync_target(void)
int cpus = 2; int cpus = 2;
/* Also aborts if there is no TSC. */ /* Also aborts if there is no TSC. */
if (unsynchronized_tsc() || tsc_clocksource_reliable) if (unsynchronized_tsc())
return; return;
/* /*
* Store, verify and sanitize the TSC adjust register. If * Store, verify and sanitize the TSC adjust register. If
* successful skip the test. * 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); atomic_inc(&skip_test);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment