[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190930120229.GD4581@hirez.programming.kicks-ass.net>
Date: Mon, 30 Sep 2019 14:02:29 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Andrea Parri <parri.andrea@...il.com>,
David Howells <dhowells@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Will Deacon <will@...nel.org>,
"Paul E. McKenney" <paulmck@...ux.ibm.com>,
Mark Rutland <mark.rutland@....com>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
jose.marchesi@...cle.com
Subject: Re: Do we need to correct barriering in circular-buffers.rst?
On Mon, Sep 30, 2019 at 01:54:40PM +0200, Peter Zijlstra wrote:
> On Mon, Sep 30, 2019 at 11:33:52AM +0200, Peter Zijlstra wrote:
> > Like I said before, something like: "disallowing store hoists over control
> > flow depending on a volatile load" would be sufficient I think.
>
> We need to add 'control flow depending on an inline-asm' to that. We
> also very much use that.
An example of that would be something like:
bool spin_try_lock(struct spinlock *lock)
{
u32 zero = 0;
if (atomic_try_cmpxchg_relaxed(&lock->val, &zero, 1)) {
smp_acquire__after_ctrl_dep(); /* aka smp_rmb() */
return true;
}
return false;
}
(I think most our actual trylock functions use cmpxchg_acquire(), but the
above would be a valid implementation -- and it is the simplest
construct using smp_acquire__after_ctrl_dep() I could come up with in a
hurry)
Powered by blists - more mailing lists