diff -urN 2.3.51pre2/arch/i386/kernel/time.c gettimeoffset-slow/arch/i386/kernel/time.c --- 2.3.51pre2/arch/i386/kernel/time.c Sun Jan 30 15:43:27 2000 +++ gettimeoffset-slow/arch/i386/kernel/time.c Fri Mar 10 05:10:01 2000 @@ -113,6 +113,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 * @@ -157,6 +159,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 */ @@ -215,6 +219,7 @@ } } else jiffies_p = jiffies_t; + spin_unlock(&i8253_lock); count_p = count; @@ -448,10 +453,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;