Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Mar 2005 16:17:34 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        Jake Burkholder <jake@locore.ca>
Cc:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   Re: PERFORCE change 72454 for review
Message-ID:  <200503161617.34804.jhb@FreeBSD.org>
In-Reply-To: <4234CA9D.9080108@locore.ca>
References:  <200503032211.j23MBlia013010@repoman.freebsd.org> <4234CA9D.9080108@locore.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 13 March 2005 06:19 pm, Jake Burkholder wrote:
> John Baldwin wrote:
> >http://perforce.freebsd.org/chv.cgi?CH=72454
> >
> >Change 72454 by jhb@jhb_slimer on 2005/03/03 22:11:16
> >
> >	Clobber all memory for atomic ops with an acquire barrier.
> >
> >	Suggested by:	   alc
> >
> >Affected files ...
> >
> >.. //depot/projects/smpng/sys/sparc64/include/atomic.h#7 edit
> >
> >Differences ...
> >
> >==== //depot/projects/smpng/sys/sparc64/include/atomic.h#7 (text+ko) ====
> >
> >@@ -90,6 +90,7 @@
> > 	itype(sz) v;							\
> > 	v = atomic_cas(p, e, s, sz);					\
> > 	membar(LoadLoad | LoadStore);					\
> >+	__asm __volatile("" : : : "memory");				\
> > 	v;								\
> > })
> >
> >@@ -115,6 +116,7 @@
> > 	itype(sz) t;							\
> > 	t = atomic_op(p, op, v, sz);					\
> > 	membar(LoadLoad | LoadStore);					\
> >+	__asm __volatile("" : : : "memory");				\
> > 	t;								\
> > })
> >
> >@@ -132,6 +134,7 @@
> > 	itype(sz) v;							\
> > 	v = atomic_load(p, sz);						\
> > 	membar(LoadLoad | LoadStore);					\
> >+	__asm __volatile("" : : : "memory");				\
> > 	v;								\
> > })
>
> membar already has a memory clobber fwiw.

It does on ppc, too, I'm not sure if I should remove them from there.  The 
problem is that "memory" is a notice to gcc to not store values across an 
instruction, but just because we order writes doesn't mean that gcc needs to 
throw out values.  Only an 'acq' membar really has that requirement.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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