linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] x86: TSC calibration update
@ 2016-03-31  4:13 Len Brown
  2016-03-31  4:13 ` [PATCH 1/9] x86 tsc_msr: Identify Intel-specific code Len Brown
  2016-06-10 13:20 ` [PATCH 0/9] x86: TSC calibration update Thomas Gleixner
  0 siblings, 2 replies; 11+ messages in thread
From: Len Brown @ 2016-03-31  4:13 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel

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(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-06-10 13:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-31  4:13 [PATCH 0/9] x86: TSC calibration update Len Brown
2016-03-31  4:13 ` [PATCH 1/9] x86 tsc_msr: Identify Intel-specific code Len Brown
2016-03-31  4:13   ` [PATCH 2/9] x86 tsc_msr: Remove debugging messages Len Brown
2016-03-31  4:13   ` [PATCH 3/9] x86 tsc_msr: Update comments, expand definitions Len Brown
2016-03-31  4:13   ` [PATCH 4/9] x86 tsc_msr: Correct Silvermont reference clock values Len Brown
2016-03-31  4:13   ` [PATCH 5/9] x86 tsc_msr: Add Airmont " Len Brown
2016-03-31  4:13   ` [PATCH 6/9] x86 tsc_msr: Extend to include Intel Core Architecture Len Brown
2016-03-31  4:13   ` [PATCH 7/9] x86 tsc_msr: Remove irqoff around MSR-based TSC enumeration Len Brown
2016-03-31  4:13   ` [PATCH 8/9] x86 tsc: enumerate SKL cpu_khz and tsc_khz via CPUID Len Brown
2016-03-31  4:13   ` [PATCH 9/9] x86 tsc: enumerate BXT " Len Brown
2016-06-10 13:20 ` [PATCH 0/9] x86: TSC calibration update Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).