From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932088AbcI3JAq (ORCPT ); Fri, 30 Sep 2016 05:00:46 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:34149 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043AbcI3JAh (ORCPT ); Fri, 30 Sep 2016 05:00:37 -0400 Date: Fri, 30 Sep 2016 11:00:30 +0200 From: Peter Zijlstra To: "Paul E. McKenney" , gg@twins.programming.kicks-ass.net Cc: Will Deacon , linux-kernel@vger.kernel.org, mingo@kernel.org, dhowells@redhat.com, stern@rowland.harvard.edu Subject: Re: [PATCH locking/Documentation 1/2] Add note of release-acquire store vulnerability Message-ID: <20160930090030.GF5016@twins.programming.kicks-ass.net> References: <20160929155401.GA5097@linux.vnet.ibm.com> <20160929155817.GB5016@twins.programming.kicks-ass.net> <20160929160307.GT13862@arm.com> <20160929164353.GX14933@linux.vnet.ibm.com> <20160929171036.GV13862@arm.com> <20160929172322.GZ14933@linux.vnet.ibm.com> <20160929180444.GA22882@linux.vnet.ibm.com> <20160929181015.GB22882@linux.vnet.ibm.com> <20160929184439.GD5016@twins.programming.kicks-ass.net> <20160929191858.GD14933@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160929191858.GD14933@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 29, 2016 at 12:18:58PM -0700, Paul E. McKenney wrote: > On Thu, Sep 29, 2016 at 08:44:39PM +0200, Peter Zijlstra wrote: > > On Thu, Sep 29, 2016 at 11:10:15AM -0700, Paul E. McKenney wrote: > > > > > > > > > > P0(int *x, int *y) > > > > > { > > > > > WRITE_ONCE(*x, 1); > > > > > smp_wmb(); > > > > > smp_store_release(y, 1); > > > > > } > > > > > > > > > > P1(int *y) > > > > > { > > > > > WRITE_ONCE(*y, 2); > > > > > } > > > > > > > > > > P2(int *x, int *y) > > > > > { > > > > > r1 = smp_load_acquire(y); > > > > > r2 = READ_ONCE(*x); > > > > > } > > > > > > > > > > Both ARM and powerpc allow the "after the dust settles" outcome (r1=2 && > > > > > r2=0), as does the current version of the early prototype Linux-kernel > > > > > > > > And the above needs to be (r1!=2 || r2 != 0)... Sigh! > > > > > > Make that (y==2 && r1==2 && r2 == 0). > > > > > > Any further bids? ;-) > > > > Isn't that the trivial P1,P2,P0 order again? > > I don't believe so. Wouldn't the final P0 would leave y==1? Ah, indeed. I was forgetting to 'execute' P0 entirely.