[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171129195839.jqys2iwsdshpk4rk@hirez.programming.kicks-ass.net>
Date: Wed, 29 Nov 2017 20:58:39 +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 Wed, Nov 29, 2017 at 11:04:53AM -0800, Daniel Lustig wrote:
> "MP+wmb+xchg-acq" (or some such)
>
> {}
>
> P0(int *x, int *y)
> {
> WRITE_ONCE(*x, 1);
> smp_wmb();
> WRITE_ONCE(*y, 1);
> }
>
> P1(int *x, int *y)
> {
> r1 = atomic_xchg_relaxed(y, 2);
> r2 = smp_load_acquire(y);
Oh, I wasn't careful enough reading; these are both y.
And then Alan raises a good point in that RmW have dependencies.
Much tricker than I initially thought.
> r3 = READ_ONCE(*x);
> }
>
> exists (1:r1=1 /\ 1:r2=2 /\ 1:r3=0)
Powered by blists - more mailing lists