Skip to content

Commit 57779dc

Browse files
Alok Katariajohnstultz-work
authored andcommitted
x86, tsc: Skip refined tsc calibration on systems with reliable TSC
While running the latest Linux as guest under VMware in highly over-committed situations, we have seen cases when the refined TSC algorithm fails to get a valid tsc_start value in tsc_refine_calibration_work from multiple attempts. As a result the kernel keeps on scheduling the tsc_irqwork task for later. Subsequently after several attempts when it gets a valid start value it goes through the refined calibration and either bails out or uses the new results. Given that the kernel originally read the TSC frequency from the platform, which is the best it can get, I don't think there is much value in refining it. So for systems which get the TSC frequency from the platform we should skip the refined tsc algorithm. We can use the TSC_RELIABLE cpu cap flag to detect this, right now it is set only on VMware and for Moorestown Penwell both of which have there own TSC calibration methods. Signed-off-by: Alok N Kataria <akataria@vmware.com> Cc: John Stultz <johnstul@us.ibm.com> Cc: Dirk Brandewie <dirk.brandewie@gmail.com> Cc: Alan Cox <alan@linux.intel.com> Cc: stable@kernel.org [jstultz: Reworked to simply not schedule the refining work, rather then scheduling the work and bombing out later] Signed-off-by: John Stultz <john.stultz@linaro.org>
1 parent 4a64990 commit 57779dc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎arch/x86/kernel/tsc.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,16 @@ static int __init init_tsc_clocksource(void)
932932
clocksource_tsc.rating = 0;
933933
clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
934934
}
935+
936+
/*
937+
* Trust the results of the earlier calibration on systems
938+
* exporting a reliable TSC.
939+
*/
940+
if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
941+
clocksource_register_khz(&clocksource_tsc, tsc_khz);
942+
return 0;
943+
}
944+
935945
schedule_delayed_work(&tsc_irqwork, 0);
936946
return 0;
937947
}

0 commit comments

Comments
 (0)