From patchwork Mon Oct 23 21:07:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 116869 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5082593qgn; Mon, 23 Oct 2017 14:08:15 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RD8iTQd2LCmGcBpx23FB9E8UKaWHBu6UEb0duUGQApo5BLswbESyZ3vOXArZfBHh0exRSy X-Received: by 10.98.12.212 with SMTP id 81mr14497881pfm.88.1508792894864; Mon, 23 Oct 2017 14:08:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508792894; cv=none; d=google.com; s=arc-20160816; b=b1EbXTZFwQkxPSZ+/AiNHixJ8NACeWq3gOpWZP7kXX3Tmjyz80doC2MW0WaBmmjWvS qk+zRsx/mN7cuqvmwsim3uP3HrBVpwi0UxFiPXehz7ueSSYAbzGkIhOzg0dk1DlcirB5 iyUiXWIhhDkHdv8eiAIwflQQjOKdinaM+zmIFQs7cL3fT1XLeV7SWeQhXkMKigihbhO4 CMnSza2ORRvxc0mEqgFvS6iDQqVhtzEekPp4MJ5FBhC7krwrqZLOc5J7mYnzrfiXZZvS le0GJME0pncXhTwGKHBuN123RaykPvBdv9JB835L49Y4fEC6SVkWp72+r82V49U1U3lY 1A+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=AM0mjrwImMMMZsiVOp3aWoO5w5NYK9rWhBqX7Z/m9Es=; b=owNGg9YXvoNWXdTsFfyG2bjuW2P9zHg57c+LwEosrhA22uVtLdH32adQ/u/dYsw92d j8/o3Csqmr1143Z3HUeBbz6039mFWasnFTv23T0XIrP6KYLDOHDd9tljVBmeCaOIrGNd FoVQF51tW/3UtPEGOeb3r8D5GCsYHQ/7KCy9GVmCzf0ic2txohxpcyJNTw4aSt6lV+gy l9uifwZHd6e7s3slXd4PyJRUZnHiRECHYPkA+n7X7RKx5C18LSZOVTHNFrEm1JpKmgrs gDCJYDdbgt/35Ju6X3M8p4DM2HTE6sBRQbviV1YaS2M6uHdJf1shHWk0jleHiPgDrh5R D1yw== 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 7si5348266pgd.489.2017.10.23.14.08.14; Mon, 23 Oct 2017 14:08:14 -0700 (PDT) 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 S932191AbdJWVIN (ORCPT + 27 others); Mon, 23 Oct 2017 17:08:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52890 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751443AbdJWVHl (ORCPT ); Mon, 23 Oct 2017 17:07:41 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9NL7JYG100997 for ; Mon, 23 Oct 2017 17:07:40 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dskdjv63c-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 23 Oct 2017 17:07:40 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Oct 2017 17:07:39 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 23 Oct 2017 17:07:35 -0400 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 v9NL7YmO41025648; Mon, 23 Oct 2017 21:07:34 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A52DB2060; Mon, 23 Oct 2017 17:04:49 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.80.218.156]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 20E39B2056; Mon, 23 Oct 2017 17:04:49 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id D3DDA16C414E; Mon, 23 Oct 2017 14:07:33 -0700 (PDT) From: "Paul E. McKenney" To: mingo@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, will.deacon@arm.com, mark.rutland@arm.com, snitzer@redhat.com, thor.thayer@linux.intel.com, viro@zeniv.linux.org.uk, davem@davemloft.net, shuah@kernel.org, mpe@ellerman.id.au, tj@kernel.org, torvalds@linux-foundation.org, "Paul E. McKenney" Subject: [PATCH 13/19] rcutorture: formal: Prepare for ACCESS_ONCE() removal Date: Mon, 23 Oct 2017 14:07:23 -0700 X-Mailer: git-send-email 2.5.2 In-Reply-To: <20171023210408.GA2930@linux.vnet.ibm.com> References: <20171023210408.GA2930@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102321-0052-0000-0000-00000275FAAC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007941; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00935454; UDB=6.00471299; IPR=6.00715720; BA=6.00005656; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017676; XFM=3.00000015; UTC=2017-10-23 21:07:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102321-0053-0000-0000-000052690723 Message-Id: <1508792849-3115-13-git-send-email-paulmck@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-23_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710230296 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland For several reasons, it is desirable to use {READ,WRITE}_ONCE() in preference to ACCESS_ONCE(), and new code is expected to use one of the former. So far, there's been no reason to change most existing uses of ACCESS_ONCE(), as these aren't currently harmful. However, for some features it is necessary to instrument reads and writes separately, which is not possible with ACCESS_ONCE(). This distinction is critical to correct operation. The bulk of the kernel code can be transformed via Coccinelle to use {READ,WRITE}_ONCE(), though this only modifies users of ACCESS_ONCE(), and not the implementation itself. As such, it has the potential to break homebrew ACCESS_ONCE() macros seen in some user code in the kernel tree (e.g. the virtio code, as fixed in commit ea9156fb3b71d9f7). To avoid fragility if/when that transformation occurs, this patch reworks the definitions of {READ,WRITE}_ONCE() in the rcutorture formal tests, and removes the unused ACCESS_ONCE() helper. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Paul E. McKenney --- tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.5.2 diff --git a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h index 6687acc08e6d..cc27b9ebcf20 100644 --- a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h +++ b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h @@ -34,8 +34,7 @@ #define rs_smp_mb() do {} while (0) #endif -#define ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x)) -#define READ_ONCE(x) ACCESS_ONCE(x) -#define WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val)) +#define READ_ONCE(x) (*(volatile typeof(x) *) &(x)) +#define WRITE_ONCE(x) ((*(volatile typeof(x) *) &(x)) = (val)) #endif