Skip to content

Commit 5f2e71e

Browse files
committed
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 <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Olof Johansson <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent f2e0421 commit 5f2e71e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

arch/x86/kernel/tsc_sync.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,6 @@ void check_tsc_sync_source(int cpu)
286286
if (unsynchronized_tsc())
287287
return;
288288

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-
296289
/*
297290
* Set the maximum number of test runs to
298291
* 1 if the CPU does not provide the TSC_ADJUST MSR
@@ -380,14 +373,19 @@ void check_tsc_sync_target(void)
380373
int cpus = 2;
381374

382375
/* Also aborts if there is no TSC. */
383-
if (unsynchronized_tsc() || tsc_clocksource_reliable)
376+
if (unsynchronized_tsc())
384377
return;
385378

386379
/*
387380
* Store, verify and sanitize the TSC adjust register. If
388381
* 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..
389387
*/
390-
if (tsc_store_and_check_tsc_adjust(false)) {
388+
if (tsc_store_and_check_tsc_adjust(false) || tsc_clocksource_reliable) {
391389
atomic_inc(&skip_test);
392390
return;
393391
}

0 commit comments

Comments
 (0)