Skip to content

x86: TSC calibration update

Len Brown lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9x86 tsc_msr: Identify Intel-specific codearch/x86/kernel/tsc_msr.c+3 -00 replies
2/9x86 tsc_msr: Remove debugging messagesarch/x86/kernel/tsc_msr.c+3 -160 replies
3/9x86 tsc_msr: Update comments, expand definitionsarch/x86/kernel/tsc_msr.c+10 -260 replies
4/9x86 tsc_msr: Correct Silvermont reference clock valuesarch/x86/kernel/tsc_msr.c+3 -30 replies
5/9x86 tsc_msr: Add Airmont reference clock valuesarch/x86/kernel/tsc_msr.c+4 -10 replies
6/9x86 tsc_msr: Extend to include Intel Core Architecturearch/x86/kernel/tsc_msr.c+41 -80 replies
7/9x86 tsc_msr: Remove irqoff around MSR-based TSC enumerationarch/x86/include/asm/tsc.h arch/x86/kernel/tsc.c arch/x86/kernel/tsc_msr.c+3 -70 replies
8/9x86 tsc: enumerate SKL cpu_khz and tsc_khz via CPUIDarch/x86/include/asm/tsc.h arch/x86/include/asm/x86_init.h arch/x86/kernel/tsc.c +1 more+73 -80 replies
9/9x86 tsc: enumerate BXT tsc_khz via CPUIDarch/x86/kernel/tsc.c+17 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] x86: TSC calibration update

cpu_khz and tsc_khz initialization can be unreliable and expensive. They are initialized in tsc_init()/native_calibrate_tsc(), which prints:

pr_info("Detected %lu.%03lu MHz processor\n", cpu_khz...)

native_calibrate_cpu() first tries quick_pit_calibrate(), which can take over 50.0M cycles to succeed,
or as few as 2.4M cycles to fail.

On failure, pit_calibrate_tsc() is attempted, which can succeed in as few as 20M cycles, but may consume over 240M cycles before it fails.

By comparison, on many processors, tsc frequency can be discovered by table and MSR or CPUID in under 0.002M cycles.

Subsequently tsc_refine_calibration_work() checks our work, but it takes under 0.004M cycles.

pr_info("Refined TSC clocksource calibration: %lu.%03lu MHz\n", tsc_khz...)

Finally, CPU and TSC frequency are not guaranteed to be identical, and this series allows cpu_khz and tsc_khz to differ within a few percent.

cheers,
Len Brown, Intel Open Source Technology Center

this patch set is also available via git:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git x86

Bin Gao (1):
x86 tsc: enumerate BXT tsc_khz via CPUID

Len Brown (8):
x86 tsc_msr: Identify Intel-specific code
x86 tsc_msr: Remove debugging messages
x86 tsc_msr: Update comments, expand definitions x86 tsc_msr: Correct Silvermont reference clock values x86 tsc_msr: Add Airmont reference clock values x86 tsc_msr: Extend to include Intel Core Architecture x86 tsc_msr: Remove irqoff around MSR-based TSC enumeration x86 tsc: enumerate SKL cpu_khz and tsc_khz via CPUID

 arch/x86/include/asm/tsc.h      |   4 +-
 arch/x86/include/asm/x86_init.h |   4 +-
 arch/x86/kernel/tsc.c           |  96 ++++++++++++++++++++++++++++++----
 arch/x86/kernel/tsc_msr.c       | 112 ++++++++++++++++++++++------------------
 arch/x86/kernel/x86_init.c      |   1 +
 5 files changed, 152 insertions(+), 65 deletions(-)