aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-07-21 11:10:07 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-21 21:37:08 -0400
commit8180a550284bf2c8e13414082fc20b8983c2c401 (patch)
tree2e0019b9607573aa5681333861bc46a6f435c2a3 /arch
parente82f64e5bb0648a13630d752c35be1e7bd8bab96 (diff)
x86_64: hpet tsc calibration fix broken smi detection logic
The current SMI detection logic in read_hpet_tsc() makes sure, that when a SMI happens between the read of the HPET counter and the read of the TSC, this wrong value is used for TSC calibration. This is not the intention of the function. The comparison must ensure, that we do _NOT_ use such a value. Fix the check to use calibration values where delta of the two TSC reads is smaller than a reasonable threshold. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/kernel/hpet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86_64/kernel/hpet.c b/arch/x86_64/kernel/hpet.c
index b8286968662d..6b460402d504 100644
--- a/arch/x86_64/kernel/hpet.c
+++ b/arch/x86_64/kernel/hpet.c
@@ -190,7 +190,7 @@ int hpet_reenable(void)
190 */ 190 */
191 191
192#define TICK_COUNT 100000000 192#define TICK_COUNT 100000000
193#define TICK_MIN 5000 193#define SMI_THRESHOLD 50000
194#define MAX_TRIES 5 194#define MAX_TRIES 5
195 195
196/* 196/*
@@ -205,7 +205,7 @@ static void __init read_hpet_tsc(int *hpet, int *tsc)
205 tsc1 = get_cycles_sync(); 205 tsc1 = get_cycles_sync();
206 hpet1 = hpet_readl(HPET_COUNTER); 206 hpet1 = hpet_readl(HPET_COUNTER);
207 tsc2 = get_cycles_sync(); 207 tsc2 = get_cycles_sync();
208 if (tsc2 - tsc1 > TICK_MIN) 208 if ((tsc2 - tsc1) < SMI_THRESHOLD)
209 break; 209 break;
210 } 210 }
211 *hpet = hpet1; 211 *hpet = hpet1;