:> Since all I WANT to do is
:> disable intr
:> popf (chache hit)
:> I am annoyed by the fact that I have all those extra bus cycles going on.
:> I can live with it for development but it still annoys me.
:You haven't yet explained how you plan to disable interrupts on the other
:... every activity meets with opposition, everyone who acts has his
Julian, I would recommend using the cmpxchgl instruction to implement
atomic operations. Look at /usr/src/sys/i386/i386/mplock.s for
an example. You will be in much better shape if you can avoid
cli/sti (as Mike points out, it doesn't work across cpu's).
mplock.s already has basic MP-compatible lock recursion and should
provide a ready example on how you need to do the locking.
There is a serious issue you need to consider when implementing
an SMP-capable lock, and that is cpu-cpu synchronization.
In order to synchronize an operation across multiple cpu's on IA32 you
have to use the 'lock;' instruction prefix. Typically, the cmpxchgl
must be locked. However, you only need to lock it when there is
possible contention.. when you are aquiring the lock. You do not need
to lock it when you are releasing the lock.
If your assembly gets too complex, just make the assembly a subroutine
call. Believe me, subroutine overhead is *nothing* compared to bus
locking overhead. For that matter, the cli/sti alone will have more
overhead then a subroutine call. Just write it in assembly and forget
about trying to use the C __asm() directive. You'll be happier.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message