Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp55821imp; Tue, 19 Feb 2019 18:03:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IbSZ8VjVUimB1e5HhKYFpXW+gKadUeqzk0zHI7D+0vdT1w9xu5SIV56LT5x+/PUQmPGuOXL X-Received: by 2002:a62:be0b:: with SMTP id l11mr33151465pff.52.1550628217608; Tue, 19 Feb 2019 18:03:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550628217; cv=none; d=google.com; s=arc-20160816; b=U3N0CsrUrFIY/25QjcBtIjbb1uLskqU8w89laBwkz+//rHkF0uU6NRcDce3DB4slki qqsSFtlyAV/3mmsxWwFTEhWunmgqGqLX/1KpFWw0ZK6Ox+dVMDrVLQKC1j6m2VFlXXuQ OqVUm0silZScBdsQZIBC4+LBvV5Q29Rc0Oaoe0RLOTPkvlEOJRNv6HZev/UMDZ6VpKp1 cON14sjierQWTF7b/8b7/DnYReArJDft5FIpmCGiXpm0tAhk/fKnvwt0h1nzVwdNMUyp w875YdtCUCh5ouxcvA2DoxdePXqheqj8zPSI+ZT0+ZEE/RJ3VI8CflUKwpfDObXZ5p7t XWEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=UmkC93O34y/jD5wReKvss8xcx3j16L3n/XDJ35ctF1Q=; b=sy3NbMIdlnntjBRmYCx37NrKNkgsBE06Z2dcrVMF4CP9cFGOLQKXx0KyZBlLs4NlBT s5fB3iZQKDjxMvQEruCk0Piols5Sh9qgdMIoxyRmLx8rCeYVpVGPnEntCx7moQRBUmKC h7lqQRXmkrvdfV3NEU2PiAP9Zbe5S+wzLq+AX26mXqdkYCM7ncEGhTyH5u85H0Dh3May ed8pFVIsxhq4IgD71SzDPsalobN7NaflNIMeXKWJsWIM0wZ42ivqwx68fK9Wfuo+Eg3n WJPV1F2J3k1VOCNu3SjESpAo9sQ7XE3SknjtePb3T4znqOrOGwr1Hvk0Ucy8tRYSxcXy Pfpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si9207798pll.75.2019.02.19.18.03.21; Tue, 19 Feb 2019 18:03:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729851AbfBTCB0 (ORCPT + 99 others); Tue, 19 Feb 2019 21:01:26 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56188 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726262AbfBTCB0 (ORCPT ); Tue, 19 Feb 2019 21:01:26 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1K1xrQZ117078 for ; Tue, 19 Feb 2019 21:01:25 -0500 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qrrtf2r0e-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 19 Feb 2019 21:01:25 -0500 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Feb 2019 02:01:23 -0000 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 20 Feb 2019 02:01:19 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1K21INC12910816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Feb 2019 02:01:18 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0644DB2064; Wed, 20 Feb 2019 02:01:18 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ADE94B205F; Wed, 20 Feb 2019 02:01:17 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.140.94]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 20 Feb 2019 02:01:17 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 5370916C63E4; Tue, 19 Feb 2019 18:01:17 -0800 (PST) Date: Tue, 19 Feb 2019 18:01:17 -0800 From: "Paul E. McKenney" To: Andrea Parri Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Alan Stern , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig Subject: Re: [RFC PATCH] tools/memory-model: Remove (dep ; rfi) from ppo Reply-To: paulmck@linux.ibm.com References: <1550617057-4911-1-git-send-email-andrea.parri@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1550617057-4911-1-git-send-email-andrea.parri@amarulasolutions.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 19022002-0072-0000-0000-000003FC6CBB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010629; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000281; SDB=6.01163562; UDB=6.00607551; IPR=6.00944144; MB=3.00025662; MTD=3.00000008; XFM=3.00000015; UTC=2019-02-20 02:01:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19022002-0073-0000-0000-00004B3C6F9B Message-Id: <20190220020117.GD11787@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-20_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902200012 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 19, 2019 at 11:57:37PM +0100, Andrea Parri wrote: > Remove this subtle (and, AFAICT, unused) ordering: we can add it back, > if necessary, but let us not encourage people to rely on this thing. > > For example, the following "exists" clause can be satisfied with this > change: > > C dep-rfi > > { } > > P0(int *x, int *y) > { > WRITE_ONCE(*x, 1); > smp_store_release(y, 1); > } > > P1(int *x, int *y, int *z) > { > int r0; > int r1; > int r2; > > r0 = READ_ONCE(*y); > WRITE_ONCE(*z, r0); > r1 = smp_load_acquire(z); > r2 = READ_ONCE(*x); > } > > exists (1:r0=1 /\ 1:r2=0) Any objections? If I don't hear any in a couple days, I will apply this. Thanx, Paul > Signed-off-by: Andrea Parri > Cc: Alan Stern > Cc: Will Deacon > Cc: Peter Zijlstra > Cc: Boqun Feng > Cc: Nicholas Piggin > Cc: David Howells > Cc: Jade Alglave > Cc: Luc Maranget > Cc: "Paul E. McKenney" > Cc: Akira Yokosawa > Cc: Daniel Lustig > --- > tools/memory-model/Documentation/explanation.txt | 28 ------------------------ > tools/memory-model/linux-kernel.cat | 2 +- > 2 files changed, 1 insertion(+), 29 deletions(-) > > diff --git a/tools/memory-model/Documentation/explanation.txt b/tools/memory-model/Documentation/explanation.txt > index 68caa9a976d0c..965e11744d090 100644 > --- a/tools/memory-model/Documentation/explanation.txt > +++ b/tools/memory-model/Documentation/explanation.txt > @@ -1019,34 +1019,6 @@ section for more details). The kernel includes a workaround for this > problem when the loads come from READ_ONCE(), and therefore the LKMM > includes address dependencies to loads in the ppo relation. > > -On the other hand, dependencies can indirectly affect the ordering of > -two loads. This happens when there is a dependency from a load to a > -store and a second, po-later load reads from that store: > - > - R ->dep W ->rfi R', > - > -where the dep link can be either an address or a data dependency. In > -this situation we know it is possible for the CPU to execute R' before > -W, because it can forward the value that W will store to R'. But it > -cannot execute R' before R, because it cannot forward the value before > -it knows what that value is, or that W and R' do access the same > -location. However, if there is merely a control dependency between R > -and W then the CPU can speculatively forward W to R' before executing > -R; if the speculation turns out to be wrong then the CPU merely has to > -restart or abandon R'. > - > -(In theory, a CPU might forward a store to a load when it runs across > -an address dependency like this: > - > - r1 = READ_ONCE(ptr); > - WRITE_ONCE(*r1, 17); > - r2 = READ_ONCE(*r1); > - > -because it could tell that the store and the second load access the > -same location even before it knows what the location's address is. > -However, none of the architectures supported by the Linux kernel do > -this.) > - > Two memory accesses of the same location must always be executed in > program order if the second access is a store. Thus, if we have > > diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat > index 8dcb37835b613..6b9e3bb4e397f 100644 > --- a/tools/memory-model/linux-kernel.cat > +++ b/tools/memory-model/linux-kernel.cat > @@ -62,7 +62,7 @@ let dep = addr | data > let rwdep = (dep | ctrl) ; [W] > let overwrite = co | fr > let to-w = rwdep | (overwrite & int) > -let to-r = addr | (dep ; rfi) > +let to-r = addr ; [R] > let fence = strong-fence | wmb | po-rel | rmb | acq-po > let ppo = to-r | to-w | fence | (po-unlock-rf-lock-po & int) > > -- > 2.7.4 >