[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171128094440.z32ieyh72xt64jhw@hirez.programming.kicks-ass.net>
Date: Tue, 28 Nov 2017 10:44:40 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Daniel Lustig <dlustig@...dia.com>
Cc: Alan Stern <stern@...land.harvard.edu>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Andrea Parri <parri.andrea@...il.com>,
Luc Maranget <luc.maranget@...ia.fr>,
Jade Alglave <j.alglave@....ac.uk>,
Boqun Feng <boqun.feng@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
Will Deacon <will.deacon@....com>,
David Howells <dhowells@...hat.com>,
Palmer Dabbelt <palmer@...belt.com>,
Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: 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.
Powered by blists - more mailing lists