This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: "memory" clobber in synchronization primitives
- To: rth@cygnus.com
- Subject: Re: "memory" clobber in synchronization primitives
- From: Geoff Keating <geoffk@ozemail.com.au>
- Date: Wed, 9 Sep 1998 19:31:36 +1000
- CC: roland@frob.com, drepper@cygnus.com, libc-hacker@gnu.org
- References: <199808311904.PAA12326@baalperazim.frob.com> <199809010424.OAA00600@geoffk.wattle.id.au> <19980909012921.D18516@dot.cygnus.com>
> Date: Wed, 9 Sep 1998 01:29:21 -0700
> From: Richard Henderson <rth@cygnus.com>
> On Tue, Sep 01, 1998 at 02:24:23PM +1000, Geoff Keating wrote:
> > The actual compare_and_swap procedure has two
> > 'sync' instructions surrounding the main code, which are 'asm
> > volatile' and therefore memory barriers.
>
> Um, asm_volatile is not a memory barrier. An asm with an
> explict memory clobber is.
When I said `memory barrier', I meant that gcc will not shift
loads/stores across the barrier. I think 'asm volatile' guarantees
this---I certainly hope it does.
They should have just explicit memory clobbers anyway, and no
'volatile'. I think the patch I presented earlier fixes this.
--
Geoffrey Keating <geoffk@ozemail.com.au>