[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-smp
Subject:    RE: Mutex roadmap
From:       John Baldwin <jhb () FreeBSD ! ORG>
Date:       2000-12-14 17:58:20
[Download RAW message or body]


On 14-Dec-00 Julian Elischer wrote:
> In my attempts to understand locking on behaplf of netgraph, I 
> ended up writing up this little roadmap of where things are...
> 
> In the hope that SOMEONE finds it useful, I'm posting it here.

Some corrections: :)

> ============== Macros that implement assembler locking primatives ====
> I'm not sure where these are used (I couldn't find any users).
> Or if they are compatible with the other stuff... are they coming of going?

MTX_EXIT is used in fork_trampoline() on the x86, and in switch_trampoline() on
the alpha and ia64.  This specific instance of MTX_EXIT will hopefully be moved
out to a MI C function fork_trampoline() that returns to a very short MD stub
fork_return in asm.

> MTX_ENTER()             Macro for non recursive spinlocks. (appears unused)
>                         alpha/include/mutex.h
>                         ia64/include/mutex.h
>                         i386/include/mutex.h

Just say 'machine/mutex.h', as it is more concise. :)

> ========= Standard MI atomic ops. Defined per processor.==============
> atomic stuff defined in {ia64,alpha,i386}/include/atomic.h
>   largely by macros tha produce inline asm functions.
>   only i386 examples detailed here.
>   Note that on the alpha "compare and set" is quite expensive
>   as it takes about 10 instructions. maybe we should use a different
>   primative..

On the alpha all of the atomic ops are built from checked loads and conditional
stores.  It's a RISC chip and doesn't have a 'semaphore' instruction like
'cmpxchg' or 'fetchadd' AFAIK.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.Baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic