cvs commit: src/sys/amd64/isa clock.c

Peter Wemm peter at
Mon Dec 12 15:31:41 PST 2005

On Monday 12 December 2005 02:27 pm, you wrote:
>   Modified files:
>     sys/amd64/isa        clock.c
>   Log:
>   For the amd64 platform, we can depend on the TSC being present. 
> This patch changes DELAY to use the TSC once it has been calibrated. 
> This does NOT use the TSC for long-term timekeeping.   It only uses
> it to bound the DELAY() spinloop.  This should not be affected by the
> Athlon64 X2 TSC quirks because the cpu is not halted while we use
> DELAY().
>   Revision  Changes    Path
>   1.223     +15 -0     src/sys/amd64/isa/clock.c

My intentions are to merge a variant of this to i386, then replace 
DELAY() on amd64 entirely.

One key advantage to this way of doing DELAY() is that the new code does 
not aquire a mtx_spin lock.  And mtx_spin locks can call DELAY().

This Can Be Bad(TM). 

Only i386/amd64/pc98 have a DELAY implementation that does this.  All 
the other plaforms have a DELAY() with no internal spinlocks.  This 
effectively brings amd64 (and later i386) into line with the other 
platforms.  Old i386 machines with no TSC (or broken TSC) won't use it, 
but since they can't run SMP, spinlocks should mostly be a NOP and the 
mtx_lock_spin() -> DELAY() -> getit() -> mtx_lock_spin() problem should 
be a non-event on those machines.
Peter Wemm - peter at; peter at; peter at
"All of this is for nothing if we don't go to the stars" - JMS/B5

More information about the cvs-src mailing list