From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754950AbdJIUCd (ORCPT ); Mon, 9 Oct 2017 16:02:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38568 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754085AbdJIUCb (ORCPT ); Mon, 9 Oct 2017 16:02:31 -0400 Date: Mon, 9 Oct 2017 13:02:23 -0700 From: "Paul E. McKenney" To: Mark Rutland Cc: linux-kernel@vger.kernel.org, Davidlohr Bueso , Peter Zijlstra , Will Deacon , akpm@linux-foundation.org, benh@kernel.crashing.org, bp@alien8.de, davem@davemloft.net, fw@strlen.de, jiangshanlai@gmail.com, johannes.berg@intel.com, jonathanh@nvidia.com, kadlec@blackhole.kfki.hu, mchehab@kernel.org, mpe@ellerman.id.au, pablo@netfilter.org, paulus@samba.org, petr@vandrovec.name, sakari.ailus@linux.intel.com, shuah@kernel.org, snitzer@redhat.com, thierry.reding@gmail.com, thor.thayer@linux.intel.com, tj@kernel.org, viro@zeniv.linux.org.uk Subject: Re: [PATCH 00/13] Preparatory work to kill off ACCESS_ONCE() Reply-To: paulmck@linux.vnet.ibm.com References: <1507573730-8083-1-git-send-email-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1507573730-8083-1-git-send-email-mark.rutland@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17100920-0036-0000-0000-0000027912F0 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007869; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000235; SDB=6.00928771; UDB=6.00467441; IPR=6.00709042; BA=6.00005631; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017463; XFM=3.00000015; UTC=2017-10-09 20:02:29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17100920-0037-0000-0000-000042064F81 Message-Id: <20171009200223.GA27372@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-09_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710090290 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 09, 2017 at 07:28:37PM +0100, Mark Rutland wrote: > Hi all, > > There's a general want to kill off ACCESS_ONCE(), which is required to kill off > smp_read_barrier_depends(), and to support debug features which require > instrumenting reads and writes separately. > > Thanks to preparatory work by a number of people, it's largely possible to > script this with the Coccinelle patch below. However, this breaks a handful of > cases, and renders some comments stale. > > This series fixes up said cases, and comments. Where fixups have been made, > I've converted the entire file for consistency. The remaining code can be > converted by Coccinelle script, allowing for the subsequent removal of > ACCESS_ONCE(). > > I've pushed this series, complete with an example treewide conversion of > v4.14-rc4 to my core/access-once branch [1,2]. And this all that is left, aside from definitions and comments associated with those definitions. Cool! Feel free to pull this into your preparation series. Thanx, Paul ------------------------------------------------------------------------ commit ed940234966f4857e23dd5f16aa8f200fc85dac6 Author: Paul E. McKenney Date: Mon Oct 9 12:59:18 2017 -0700 treewide: Kill off remaining ACCESS_ONCE() This commit removes instances of ACCESS_ONCE() not located by Mark Rutland's coccinelle script, for example, those in complex macro definitions and those in comments. Removing ACCESS_ONCE() in favor of READ_ONCE() and WRITE_ONCE() provides tools such as KTSAN the read/write distinction that they need to better detect concurrency bugs. In addition, removing ACCESS_ONCE() is one necessary step towards removing special cases for DEC Alpha from the Linux-kernel memory model. Signed-off-by: Paul E. McKenney diff --git a/Documentation/filesystems/path-lookup.md b/Documentation/filesystems/path-lookup.md index 1b39e084a2b2..50ea32a51626 100644 --- a/Documentation/filesystems/path-lookup.md +++ b/Documentation/filesystems/path-lookup.md @@ -826,9 +826,9 @@ If the filesystem may need to revalidate dcache entries, then *is* passed the dentry but does not have access to the `inode` or the `seq` number from the `nameidata`, so it needs to be extra careful when accessing fields in the dentry. This "extra care" typically -involves using `ACCESS_ONCE()` or the newer [`READ_ONCE()`] to access -fields, and verifying the result is not NULL before using it. This -pattern can be see in `nfs_lookup_revalidate()`. +involves using [`READ_ONCE()`] to access fields, and verifying the +result is not NULL before using it. This pattern can be see in +`nfs_lookup_revalidate()`. A pair of patterns ------------------ diff --git a/mm/memory.c b/mm/memory.c index a728bed16c20..cae514e7dcfc 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3891,9 +3891,9 @@ static int handle_pte_fault(struct vm_fault *vmf) /* * some architectures can have larger ptes than wordsize, * e.g.ppc44x-defconfig has CONFIG_PTE_64BIT=y and - * CONFIG_32BIT=y, so READ_ONCE or ACCESS_ONCE cannot guarantee - * atomic accesses. The code below just needs a consistent - * view for the ifs and we later double check anyway with the + * CONFIG_32BIT=y, so READ_ONCE cannot guarantee atomic + * accesses. The code below just needs a consistent view + * for the ifs and we later double check anyway with the * ptl lock held. So here a barrier will do. */ barrier();