Re: [PATCH -v4 5/7] locking, arch: Update spin_unlock_wait()
From: Peter Zijlstra
Date: Fri Jun 03 2016 - 15:13:52 EST
On Fri, Jun 03, 2016 at 06:35:37PM +0100, Will Deacon wrote:
> On Fri, Jun 03, 2016 at 03:42:49PM +0200, Peter Zijlstra wrote:
> > On Fri, Jun 03, 2016 at 01:47:34PM +0100, Will Deacon wrote:
> > > Even on x86, I think you need a fence here:
> > >
> > > X86 lock
> > > {
> > > }
> > > P0 | P1 ;
> > > MOV EAX,$1 | MOV EAX,$1 ;
> > > LOCK XCHG [x],EAX | LOCK XCHG [y],EAX ;
> > > MOV EBX,[y] | MOV EBX,[x] ;
> > > exists
> > > (0:EAX=0 /\ 0:EBX=0 /\ 1:EAX=0 /\ 1:EBX=0)
> > >
> > > is permitted by herd.
> >
> > I am puzzled.. this should not be. You say adding MFENCE after LOCK XCHG
> > makes it 'work', but we assume LOCK <op> is a full fence all over the
> > place.
> >
> > I'm thinking herd is busted.
>
> FWIW -- I spoke to the Herd authors and they confirmed that this is a
> regresion in herd (fixed in the bleeding edge version).
Good, means I'm not slowly going crazeh -- or at least, this isn't one
of the signs :-)