[lkml]   [2019]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: 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

 \ /
  Last update: 2019-09-30 14:02    [W:0.055 / U:4.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site