lkml.org 
[lkml]   [2015]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] locking: Introduce smp_cond_acquire()
On Mon, Nov 02, 2015 at 10:08:24AM -0800, Linus Torvalds wrote:
> On Mon, Nov 2, 2015 at 5:29 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> > +#define smp_cond_acquire(cond) do { \
> > + while (!(cond)) \
> > + cpu_relax(); \
> > + smp_read_barrier_depends(); /* ctrl */ \
> > + smp_rmb(); /* ctrl + rmb := acquire */ \
> > +} while (0)
>
> This code makes absolutely no sense.
>
> smp_read_barrier_depends() is about a memory barrier where there is a
> data dependency between two accesses. The "depends" is very much about
> the data dependency, and very much about *nothing* else.

Paul wasn't so sure, which I think is why smp_read_barrier_depends()
is already used in, for example, READ_ONCE_CTRL:

http://lkml.kernel.org/r/20151007154003.GJ3910@linux.vnet.ibm.com

although I agree that this would pave the way for speculative stores on
Alpha and that seems like a heavy accusation to make.

> Your comment talks about control dependencies, but
> smp_read_barrier_depends() has absolutely nothing to do with a control
> dependency. In fact, it is explicitly a no-op on architectures like
> ARM and PowerPC that violate control dependencies.

In this case, control dependencies are only referring to READ -> WRITE
ordering, so they are honoured by ARM and PowerPC.

Will


\
 
 \ /
  Last update: 2015-11-02 20:01    [W:0.453 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site