lkml.org 
[lkml]   [2017]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Unlock-lock questions and the Linux Kernel Memory Model
On Mon, Nov 27, 2017 at 03:28:03PM -0800, Daniel Lustig wrote:
> On 11/27/2017 1:16 PM, Alan Stern wrote:> C rel-acq-write-ordering-3
> >
> > {}
> >
> > P0(int *x, int *s, int *y)
> > {
> > WRITE_ONCE(*x, 1);
> > smp_store_release(s, 1);
> > r1 = smp_load_acquire(s);
> > WRITE_ONCE(*y, 1);
> > }
> >
> > P1(int *x, int *y)
> > {
> > r2 = READ_ONCE(*y);
> > smp_rmb();
> > r3 = READ_ONCE(*x);
> > }
> >
> > exists (1:r2=1 /\ 1:r3=0)
> >
> <snip>
> >
> > And going to extremes...
>
> Sorry if I'm missing something obvious, but before going to extremes...
> what about this one?
>
> "SB+rel-acq" (or please rename if you have a different scheme)
>
> {}
>
> P0(int *x, int *s, int *y)
> {
> WRITE_ONCE(*x, 1);
> smp_store_release(s, 1);
> r1 = smp_load_acquire(s);
> r2 = READ_ONCE(*y);
> }

Yes, this one doesn't work on TSO and Power.

Ideally it would work for locks though, but that would mean mandating
RCsc lock implementations and currently Power is holding out on that.

\
 
 \ /
  Last update: 2017-11-28 10:45    [W:0.124 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site