1. 31 10月, 2008 1 次提交
  2. 07 9月, 2008 1 次提交
  3. 05 9月, 2008 2 次提交
    • I
      x86: quick TSC calibration, improve · 4156e9a8
      Ingo Molnar 提交于
      - make sure the final TSC timestamp is reliable too
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4156e9a8
    • L
      x86: quick TSC calibration · 6ac40ed0
      Linus Torvalds 提交于
      Introduce a fast TSC-calibration method on sane hardware.
      
      It only uses 17920 PIT timer ticks to calibrate the TSC, plus 256 ticks on
      each side to make sure the TSC values were very close to the tick, so the
      whole calibration takes 15ms. Yet, despite only takign 15ms,
      we can actually give pretty stringent guarantees of accuracy:
      
       - the code requires that we hit each 256-counter block at least 50 times,
         so the TSC error is basically at *MOST* just a few PIT cycles off in
         any direction. In practice, it's going to be about one microseconds
         off (which is how long it takes to read the counter)
      
       - so over 17920 PIT cycles, we can pretty much guarantee that the
         calibration error is less than one half of a percent.
      
      My testing bears this out: on my machine, the quick-calibration reports
      2934.085kHz, while the slow one reports 2933.415.
      
      Yes, the slower calibration is still more precise. For me, the slow
      calibration is stable to within about one hundreth of a percent, so it's
      (at a guess) roughly an order-and-a-half of magnitude more precise. The
      longer you wait, the more precise you can be.
      
      However, the nice thing about the fast TSC PIT synchronization is that
      it's pretty much _guaranteed_ to give that 0.5% precision, and fail
      gracefully (and very quickly) if it doesn't get it. And it really is
      fairly simple (even if there's a lot of _details_ there, and I didn't get
      all of those right ont he first try or even the second ;)
      
      The patch says "110 insertions", but 63 of those new lines are actually
      comments.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ---
       arch/x86/kernel/tsc.c |  111 ++++++++++++++++++++++++++++++++++++++++++++++++-
       1 files changed, 110 insertions(+), 1 deletions(-)
      6ac40ed0
  4. 04 9月, 2008 5 次提交
  5. 03 9月, 2008 2 次提交
    • L
      Split up PIT part of TSC calibration from native_calibrate_tsc · ec0c15af
      Linus Torvalds 提交于
      The TSC calibration function is still very complicated, but this makes
      it at least a little bit less so by moving the PIT part out into a
      helper function of its own.
      Tested-by: NLarry Finger <Larry.Finger@lwfinger.net>
      Signed-of-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ec0c15af
    • T
      [x86] Fix TSC calibration issues · fbb16e24
      Thomas Gleixner 提交于
      Larry Finger reported at http://lkml.org/lkml/2008/9/1/90:
      An ancient laptop of mine started throwing errors from b43legacy when
      I started using 2.6.27 on it. This has been bisected to commit bfc0f594
      "x86: merge tsc calibration".
      
      The unification of the TSC code adopted mostly the 64bit code, which
      prefers PMTIMER/HPET over the PIT calibration.
      
      Larrys system has an AMD K6 CPU. Such systems are known to have
      PMTIMER incarnations which run at double speed. This results in a
      miscalibration of the TSC by factor 0.5. So the resulting calibrated
      CPU/TSC speed is half of the real CPU speed, which means that the TSC
      based delay loop will run half the time it should run. That might
      explain why the b43legacy driver went berserk.
      
      On the other hand we know about systems, where the PIT based
      calibration results in random crap due to heavy SMI/SMM
      disturbance. On those systems the PMTIMER/HPET based calibration logic
      with SMI detection shows better results.
      
      According to Alok also virtualized systems suffer from the PIT
      calibration method.
      
      The solution is to use a more wreckage aware aproach than the current
      either/or decision.
      
      1) reimplement the retry loop which was dropped from the 32bit code
      during the merge. It repeats the calibration and selects the lowest
      frequency value as this is probably the closest estimate to the real
      frequency
      
      2) Monitor the delta of the TSC values in the delay loop which waits
      for the PIT counter to reach zero. If the maximum value is
      significantly different from the minimum, then we have a pretty safe
      indicator that the loop was disturbed by an SMI.
      
      3) keep the pmtimer/hpet reference as a backup solution for systems
      where the SMI disturbance is a permanent point of failure for PIT
      based calibration
      
      4) do the loop iteration for both methods, record the lowest value and
      decide after all iterations finished.
      
      5) Set a clear preference to PIT based calibration when the result
      makes sense.
      
      The implementation does the reference calibration based on
      HPET/PMTIMER around the delay, which is necessary for the PIT anyway,
      but keeps separate TSC values to ensure the "independency" of the
      resulting calibration values.
      
      Tested on various 32bit/64bit machines including Geode 266Mhz, AMD K6
      (affected machine with a double speed pmtimer which I grabbed out of
      the dump), Pentium class machines and AMD/Intel 64 bit boxen.
      Bisected-by: NLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fbb16e24
  6. 25 8月, 2008 2 次提交
  7. 18 8月, 2008 1 次提交
  8. 11 8月, 2008 1 次提交
    • M
      x86, tsc: fix section mismatch warning · 90936cfe
      Marcin Slusarz 提交于
      WARNING: vmlinux.o(.text+0x7950): Section mismatch in reference from the function native_calibrate_tsc() to the function .init.text:tsc_read_refs()
      The function native_calibrate_tsc() references
      the function __init tsc_read_refs().
      This is often because native_calibrate_tsc lacks a __init
      annotation or the annotation of tsc_read_refs is wrong.
      
      tsc_read_refs is called from native_calibrate_tsc which is not __init
      and native_calibrate_tsc cannot be marked __init
      Signed-off-by: NMarcin Slusarz <marcin.slusarz@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      90936cfe
  9. 16 7月, 2008 1 次提交
  10. 11 7月, 2008 1 次提交
  11. 09 7月, 2008 6 次提交