Re: asm-generic: Disallow no-op mb() for SMP systems

From: Peter Zijlstra
Date: Thu Feb 01 2018 - 10:53:06 EST


On Thu, Feb 01, 2018 at 04:50:07PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 01, 2018 at 03:39:51PM +0000, Will Deacon wrote:
> > > I could've gotten my brain in a twist or course, which isn't _that_
> > > unusual. I never seem to be able to quite remember the holes you have
> > > with ll/sc on arm64 :-)
> >
> > Is smp_mb__before_atomic supposed to provide ordering guarantees if it's
> > used before a failed cmpxchg? If so, I think it's needed here because the
> > l.swa might not even execute. Or did I just invent another problem?
>
> I think it should do so indeed (and afaik all our current archs are good
> that way).

See commit:

34d54f3d6917 ("locking/pvqspinlock: Relax cmpxchg's to improve performance on some architectures")