PERFORCE change 72454 for review

John Baldwin jhb at FreeBSD.org
Wed Mar 16 14:26:45 PST 2005


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 at 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 at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the p4-projects mailing list