Received: by 10.223.185.116 with SMTP id b49csp1051611wrg; Wed, 21 Feb 2018 11:13:39 -0800 (PST) X-Google-Smtp-Source: AH8x225xQJzAJT/MlBAOmjG1hsn9S9g4gP7/ctKvfi3VRLDCulvbEl7Gokx292+aN4uYbBa31N/3 X-Received: by 2002:a17:902:8214:: with SMTP id x20-v6mr4006185pln.182.1519240419586; Wed, 21 Feb 2018 11:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519240419; cv=none; d=google.com; s=arc-20160816; b=stzQeuCU28slN6F9Ir2AniZ96FlvPvG/zoL009mAHx5XaZ+3dHpqQSLnOf/3QLHbSd ToPI9f69KwA6F7zaUQ+FJFNH353pqYKyr9YnwVsmamFjJw+S0emc6k24Z7nugezBosmg 4jWtqZ370ar1K5D9tPZUtq1taBf+z+EgR315BdYbFk/7eCGF6XUYUnrEenEoPexcon47 Tq/E97NmHskRI5oWphLLLhsbJm1joA1MPzpiTGwyompjgwkhKU4/unJpXO8IFEtnsnfO HZLl9pk0OAqAwcZ9dpqmSY3Y0sCbkvxMfk6mU1/yBjaJhde/XbiCa7WeLXxpz6fLKYaa a93Q== 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=TlPT+afB2WgKHHHkKg3BY1X2Qms1Q4f8JFCiN1RXbcI=; b=Qf7mJmc3HwJbaR/SXHmRgzQDSQpXS/Xa5i697LMBcNKjwcFsy9GljEkuXR2YXcrs8/ iS6UX3MppacI0C4tDmvulC5PSqh2YdWFvTbyiFluHdSKfyrpRc+X5rU/ucBZlpCia2my ZNqtWBZ8OoenSzqAVx7PR+uIydwyHmAqFZ2eNpfYB6gzocest0+aby+CXRG5CBbCm3bv 38HlrKu0bOWqdJjoaqL9FwGEGO+x5TQcEVCjjlOTmR98X5dh64I6VJQsGBh4A6on+Dcc Tpaz+GNPXj6th7XSvLgVYQ+lYxv7bnuBRFyiywESnhss9ZwsyQALBlT/gPHuEXmxK/Ba oCxw== 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 o64si64846pfb.346.2018.02.21.11.13.25; Wed, 21 Feb 2018 11:13:39 -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 S1755096AbeBUSAD (ORCPT + 99 others); Wed, 21 Feb 2018 13:00:03 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45978 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754135AbeBUSAB (ORCPT ); Wed, 21 Feb 2018 13:00:01 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1LHxkeI097010 for ; Wed, 21 Feb 2018 13:00:00 -0500 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g9cprjn17-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 21 Feb 2018 13:00:00 -0500 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Feb 2018 12:59:58 -0500 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 21 Feb 2018 12:59:53 -0500 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1LHxrRa52691102; Wed, 21 Feb 2018 17:59:53 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94EC6B2050; Wed, 21 Feb 2018 14:02:11 -0500 (EST) Received: from paulmck-ThinkPad-W541 (unknown [9.85.154.79]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 42B88B2046; Wed, 21 Feb 2018 14:02:11 -0500 (EST) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 89A7C16C1B29; Wed, 21 Feb 2018 10:00:16 -0800 (PST) Date: Wed, 21 Feb 2018 10:00:16 -0800 From: "Paul E. McKenney" To: Alan Stern Cc: Andrea Parri , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18022117-0036-0000-0000-000002C41160 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.00993056; UDB=6.00504564; IPR=6.00772401; MB=3.00019675; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-21 17:59:57 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022117-0037-0000-0000-0000436A53C9 Message-Id: <20180221180016.GK3617@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 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802210218 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 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") Queued, thank you! Thanx, Paul > --- > > 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} ; } >