Received: by 10.223.185.116 with SMTP id b49csp1053255wrg; Wed, 21 Feb 2018 11:15:16 -0800 (PST) X-Google-Smtp-Source: AH8x226ACA/GhL6AQgL6Aqx7JZK1UclnBWThm5m32uIWSgP0gJyUKE0fK4kh3TU1P4RsDzjjpLzm X-Received: by 10.99.96.73 with SMTP id u70mr3401099pgb.199.1519240516130; Wed, 21 Feb 2018 11:15:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519240516; cv=none; d=google.com; s=arc-20160816; b=bX1VKg1r7SUgFdcYIGiCllZgmrChCvthWYTEnGw9FqyEl8j4fPmSiPgUSHp6HAHrX4 CIx9RV9o2HvIHLAUqKERfLgVkta3U21cpHvW15C+Nrl+F1VNeQDE6543F+cCXJgF50hl ST4cdMof3Qw3BII/EczQ/UB3ynwzWIZAERr0AULVeVxqcOxMhiSq1G8KR+0eSAaFR3qr +gwkszpzkG/YvWenWJAW83JxL5s+pBMl30HbPmttYvenW+c5iWSQOiTuMUZgHg7MhDhH HzAoKAncNh5M3T5c8VncDm+WqnfNusD97VKsAx4lpMShnaH8Qt9D7RkSOtn9Lb5htQrY +uhw== 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:arc-authentication-results; bh=0WcvHK+aKNyFAPU4Kj605BHC3BvFFGX2X1C53SA/HMs=; b=PuRysqKrgJt7SSCnG64JgpP0uSGjvYgFl9CU94xrySbczmX2vhUq32GoITRrLosnNI UFGptI0CZdg287kXlCmFmNeINDqm4zF1XjU37OCud8TTcc1hzWAmGf5ysXUo4PYy8/0R 2Pm2u266ULCfkWSbX41xu+bn3HH7SOFlpcCcn2QsjjtZbssUoRly6orWSN/0eTVR9ByT lMmA5QYSwGZgs/H5CtJ6AFnsS3bA4d3QLgT0rqHyyf8ttXkZGgWroCCNPZeNgXRd7U+U dd42Oa5IV3Wox2zxpNGRXbGeQfXY8a7lXeqnGjavnJoRQrTey84x8cVl4PlrSzGtgesT cNqw== 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 v1-v6si20023ply.489.2018.02.21.11.15.01; Wed, 21 Feb 2018 11:15:16 -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 S933578AbeBUSOE (ORCPT + 99 others); Wed, 21 Feb 2018 13:14:04 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43328 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755127AbeBUSOD (ORCPT ); Wed, 21 Feb 2018 13:14:03 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1LIDhrF079973 for ; Wed, 21 Feb 2018 13:14:02 -0500 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g9b1q8kn3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 21 Feb 2018 13:13:54 -0500 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Feb 2018 13:13:51 -0500 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 21 Feb 2018 13:13:46 -0500 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1LIDkpN38404320; Wed, 21 Feb 2018 18:13:46 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7F04B204D; Wed, 21 Feb 2018 14:16:04 -0500 (EST) Received: from paulmck-ThinkPad-W541 (unknown [9.85.154.79]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 65D17B2052; Wed, 21 Feb 2018 14:16:04 -0500 (EST) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 365B716C1B29; Wed, 21 Feb 2018 10:14:10 -0800 (PST) Date: Wed, 21 Feb 2018 10:14:10 -0800 From: "Paul E. McKenney" To: Andrea Parri Cc: Alan Stern , Akira Yokosawa , Kernel development list , mingo@kernel.org, Will Deacon , peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, Jade Alglave , Luc Maranget , Patrick Bellasi Subject: Re: [PATCH] tools/memory-model: update: remove rb-dep, smp_read_barrier_depends, and lockless_dereference Reply-To: paulmck@linux.vnet.ibm.com References: <20180221160602.GD3617@linux.vnet.ibm.com> <20180221175857.GA23000@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180221175857.GA23000@andrea> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18022118-0056-0000-0000-00000421B08F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008571; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00993061; UDB=6.00504567; IPR=6.00772405; MB=3.00019675; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-21 18:13:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022118-0057-0000-0000-00000863B63C Message-Id: <20180221181410.GL3617@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-21_06:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802210219 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 06:58:57PM +0100, Andrea Parri wrote: > On Wed, Feb 21, 2018 at 12:15:56PM -0500, Alan Stern wrote: > > Commit bf28ae562744 ("tools/memory-model: Remove rb-dep, > > smp_read_barrier_depends, and lockless_dereference") was accidentally > > merged too early, while it was still in RFC form. This patch adds in > > the missing pieces. > > > > Akira pointed out some typos in the original patch, and he noted that > > cheatsheet.txt should be updated to indicate how unsuccessful RMW > > operations relate to address dependencies. > > > > Andrea pointed out that the macro for rcu_dereference() in linux.def > > should now use the "once" annotation instead of "deref". He also > > suggested that the comments should mention commit 5a8897cc7631 > > ("locking/atomics/alpha: Add smp_read_barrier_depends() to > > _release()/_relaxed() atomics") as an important precursor, and he > > contributed commit cb13b424e986 ("locking/xchg/alpha: Add > > unconditional memory barrier to cmpxchg()"), another prerequisite. > > > > Signed-off-by: Alan Stern > > Suggested-by: Akira Yokosawa > > Suggested-by: Andrea Parri > > Fixes: bf28ae562744 ("tools/memory-model: Remove rb-dep, smp_read_barrier_depends, and lockless_dereference") > > Acked-by: Andrea Parri Applied, thank you! Thanx, Paul > Thanks, > Andrea > > > > > > --- > > > > tools/memory-model/Documentation/cheatsheet.txt | 6 +++--- > > tools/memory-model/Documentation/explanation.txt | 4 ++-- > > tools/memory-model/linux-kernel.def | 2 +- > > 3 files changed, 6 insertions(+), 6 deletions(-) > > > > Index: usb-4.x/tools/memory-model/Documentation/cheatsheet.txt > > =================================================================== > > --- usb-4.x.orig/tools/memory-model/Documentation/cheatsheet.txt > > +++ usb-4.x/tools/memory-model/Documentation/cheatsheet.txt > > @@ -1,11 +1,11 @@ > > Prior Operation Subsequent Operation > > --------------- --------------------------- > > C Self R W RWM Self R W DR DW RMW SV > > - __ ---- - - --- ---- - - -- -- --- -- > > + -- ---- - - --- ---- - - -- -- --- -- > > > > Store, e.g., WRITE_ONCE() Y Y > > -Load, e.g., READ_ONCE() Y Y Y > > -Unsuccessful RMW operation Y Y Y > > +Load, e.g., READ_ONCE() Y Y Y Y > > +Unsuccessful RMW operation Y Y Y Y > > rcu_dereference() Y Y Y Y > > Successful *_acquire() R Y Y Y Y Y Y > > Successful *_release() C Y Y Y W Y > > Index: usb-4.x/tools/memory-model/Documentation/explanation.txt > > =================================================================== > > --- usb-4.x.orig/tools/memory-model/Documentation/explanation.txt > > +++ usb-4.x/tools/memory-model/Documentation/explanation.txt > > @@ -826,7 +826,7 @@ A-cumulative; they only affect the propa > > executed on C before the fence (i.e., those which precede the fence in > > program order). > > > > -read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have > > +read_read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have > > other properties which we discuss later. > > > > > > @@ -1138,7 +1138,7 @@ final effect is that even though the two > > program order, it appears that they aren't. > > > > This could not have happened if the local cache had processed the > > -incoming stores in FIFO order. In constrast, other architectures > > +incoming stores in FIFO order. By contrast, other architectures > > maintain at least the appearance of FIFO order. > > > > In practice, this difficulty is solved by inserting a special fence > > Index: usb-4.x/tools/memory-model/linux-kernel.def > > =================================================================== > > --- usb-4.x.orig/tools/memory-model/linux-kernel.def > > +++ usb-4.x/tools/memory-model/linux-kernel.def > > @@ -13,7 +13,7 @@ WRITE_ONCE(X,V) { __store{once}(X,V); } > > smp_store_release(X,V) { __store{release}(*X,V); } > > smp_load_acquire(X) __load{acquire}(*X) > > rcu_assign_pointer(X,V) { __store{release}(X,V); } > > -rcu_dereference(X) __load{deref}(X) > > +rcu_dereference(X) __load{once}(X) > > > > // Fences > > smp_mb() { __fence{mb} ; } > > >