Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2000 09:58:20 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.ORG>
To:        Julian Elischer <julian@elischer.org>
Cc:        smp@FreeBSD.ORG
Subject:   RE: Mutex roadmap
Message-ID:  <XFMail.001214095820.jhb@FreeBSD.org>
In-Reply-To: <3A38E440.B89DA298@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001214095820.jhb>