x86: TSC make the calibration loop smarter
authorThomas Gleixner <tglx@linutronix.de>
Thu, 4 Sep 2008 15:18:59 +0000 (15:18 +0000)
committerIngo Molnar <mingo@elte.hu>
Thu, 4 Sep 2008 15:35:35 +0000 (17:35 +0200)
The last changes made the calibration loop 250ms long which is far
too much. Try to do that more clever.

Experiments have shown that using a 10ms delay for the PIT based calibration
gives us a good enough value. If we have a reference (HPET/PMTIMER) and the
result of the PIT and the reference is close enough, then we can break out of
the calibration loop on a match right away and use the reference value.

Otherwise we just loop 3 times and decide then, which value to take.

One caveat is that for virtualized environments the PIT calibration often does
not work at all and I found out that 10us is a bit too short as well for the
reference to give a sane result. The solution here is to make the last loop
longer when the first two PIT calibrations failed.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

No differences found