diff -urN 2.2.15pre13/arch/i386/kernel/time.c slow-gtod-1/arch/i386/kernel/time.c --- 2.2.15pre13/arch/i386/kernel/time.c Sat Mar 4 18:02:00 2000 +++ slow-gtod-1/arch/i386/kernel/time.c Mon Mar 6 17:48:13 2000 @@ -112,6 +114,8 @@ #ifndef CONFIG_X86_TSC +spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED; + /* This function must be called with interrupts disabled * It was inspired by Steve McCanne's microtime-i386 for BSD. -- jrs * @@ -156,6 +160,8 @@ */ unsigned long jiffies_t; + /* gets recalled with irq locally disabled */ + spin_lock(&i8253_lock); /* timer count may underflow right here */ outb_p(0x00, 0x43); /* latch the count ASAP */ @@ -214,6 +220,7 @@ } } else jiffies_p = jiffies_t; + spin_unlock(&i8253_lock); count_p = count; @@ -447,10 +458,19 @@ rdtscl(last_tsc_low); +#if 0 /* + * SUBTLE: this is not necessary from here because it's implicit in the + * write xtime_lock. + */ + spin_lock(&i8253_lock); +#endif outb_p(0x00, 0x43); /* latch the count ASAP */ count = inb_p(0x40); /* read the latched count */ count |= inb(0x40) << 8; +#if 0 + spin_unlock(&i8253_lock); +#endif count = ((LATCH-1) - count) * TICK_SIZE; delay_at_last_interrupt = (count + LATCH/2) / LATCH;