From: Andrew Morton This makes an unholy mess of time-x86_64-split-x86_64-kernel-timec-up.patch Cc: Andi Kleen Cc: John Stultz Cc: Ingo Molnar Cc: Thomas Gleixner Signed-off-by: Andrew Morton --- arch/x86_64/kernel/time.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) Index: linux-2.6.20-rc6-mm/arch/x86_64/kernel/time.c =================================================================== --- linux-2.6.20-rc6-mm.orig/arch/x86_64/kernel/time.c +++ linux-2.6.20-rc6-mm/arch/x86_64/kernel/time.c @@ -658,30 +658,6 @@ core_initcall(cpufreq_tsc); */ #define TICK_COUNT 100000000 -#define TICK_MIN 5000 -#define MAX_READ_RETRIES 5 - -/* - * Some platforms take periodic SMI interrupts with 5ms duration. Make sure none - * occurs between the reads of the hpet & TSC. - */ -static void __init read_hpet_tsc(int *hpet, int *tsc) -{ - int tsc1, tsc2, hpet1, retries = 0; - static int msg; - - do { - tsc1 = get_cycles_sync(); - hpet1 = hpet_readl(HPET_COUNTER); - tsc2 = get_cycles_sync(); - } while (tsc2 - tsc1 > TICK_MIN && retries++ < MAX_READ_RETRIES); - if (retries >= MAX_READ_RETRIES && !msg++) - printk(KERN_WARNING - "hpet.c: exceeded max retries to read HPET & TSC\n"); - *hpet = hpet1; - *tsc = tsc2; -} - static unsigned int __init hpet_calibrate_tsc(void) { @@ -692,11 +668,13 @@ static unsigned int __init hpet_calibrat local_irq_save(flags); local_irq_disable(); - read_hpet_tsc(&hpet_start, &tsc_start); + hpet_start = hpet_readl(HPET_COUNTER); + rdtscl(tsc_start); do { local_irq_disable(); - read_hpet_tsc(&hpet_now, &tsc_now); + hpet_now = hpet_readl(HPET_COUNTER); + tsc_now = get_cycles_sync(); local_irq_restore(flags); } while ((tsc_now - tsc_start) < TICK_COUNT && (hpet_now - hpet_start) < TICK_COUNT);