From patchwork Mon Nov 27 10:38:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 119666 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp55702qgn; Mon, 27 Nov 2017 02:38:46 -0800 (PST) X-Google-Smtp-Source: AGs4zMa5VM4eSp5oFn+Tfx5bY9uzcBeWq4oD2Wo4jxN2LuL2NF8nmMnnP0cOQdEkR0Rdd7in2+21 X-Received: by 10.84.174.4 with SMTP id q4mr3403394plb.207.1511779126134; Mon, 27 Nov 2017 02:38:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511779126; cv=none; d=google.com; s=arc-20160816; b=YAxsteWgu179/lDhjmNXo/gjt3iR4xOYqcKNj9EVVQI99P5QrWYZxJyKOiO59fyv4r PNS6YnPGgVRJbtJvr48VQcTVtdcdCpodnmQAefWGrYzvIWRe6ojAjpZfplnz4Iow064B I1+oHL7e00fIfQdYBc6z0dkobAe5IlKPRTJ9AJ5xAQXKXQP8q8EwXepbwBMvLgmeJFAY x394JCeCjtFqqWLqofahMhzRkRqVbtrSinLUSiwlDpwZEP2GYdvO5+1ukZ1+fpMPH1gK ccLB7avLjuJDwA/sH4JFEKhjnTG46usdjR65XF6hH9sM7RWV0qopxJyk5BaY/Bfw/79x GrKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=GGQBzAfqTcP3WwkFsdrOZ6f8XBo9P8PpG/GacMXu0Q8=; b=YjBkkUQ0GtX/Ip7kVmgAmhPB8l5rZ0tZ+7+YFk2OTfVdeBsxuUosSJQRpmukClES55 q/nrZNO+MhV6nN+rItSbzfQc3apkPXa94947ZkXguGqzkImBUbpPDVja09Z8FcVJGxgM Vuk/zTZFcV3L+KexfiFjL7jYQY+ewDxN34Runr9wdWbK32QqIY9AwecagGUUFWNgO0JB TuQjWOeXHeToCMRlCL+3jnYpaW3Amu5tXjYDTibJ6S1zPxidgcpJ6dMLdmtM20Gz7/67 OYQKU+JjqYrjyflliaOAhwO+rJVnQ9Wmp0tSMjJWL+802R2HpFSKAoaHiVqfwxkmxsBR wfLA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si22319572pgf.8.2017.11.27.02.38.45; Mon, 27 Nov 2017 02:38:46 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752069AbdK0Kin (ORCPT + 28 others); Mon, 27 Nov 2017 05:38:43 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:35790 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbdK0Kii (ORCPT ); Mon, 27 Nov 2017 05:38:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D0C3C164F; Mon, 27 Nov 2017 02:38:37 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 57B453F246; Mon, 27 Nov 2017 02:38:36 -0800 (PST) From: Mark Rutland To: linux-kernel@vger.kernel.org, mingo@redhat.com Cc: acme@redhat.com, apw@canonical.com, joe@perches.com, mark.rutland@arm.com, paulmck@linux.vnet.ibm.com, peterz@infradead.org Subject: [PATCH 3/4] compiler.h: remove ACCESS_ONCE() Date: Mon, 27 Nov 2017 10:38:23 +0000 Message-Id: <20171127103824.36526-4-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171127103824.36526-1-mark.rutland@arm.com> References: <20171127103824.36526-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are no longer any kernelspace uses of ACCESS_ONCE(), so we can remove the definition from . This patch removes the ACCESS_ONCE() definition, and updates comments which referred to it. At the same time, some inconsistent and redundant whitespace is removed from comments. Signed-off-by: Mark Rutland Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Joe Perches Cc: Paul E. McKenney Cc: Peter Zijlstra --- include/linux/compiler.h | 47 +++++++++++------------------------------------ 1 file changed, 11 insertions(+), 36 deletions(-) -- 2.11.0 diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 188ed9f65517..52e611ab9a6c 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -220,21 +220,21 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s /* * Prevent the compiler from merging or refetching reads or writes. The * compiler is also forbidden from reordering successive instances of - * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the - * compiler is aware of some particular ordering. One way to make the - * compiler aware of ordering is to put the two invocations of READ_ONCE, - * WRITE_ONCE or ACCESS_ONCE() in different C statements. + * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some + * particular ordering. One way to make the compiler aware of ordering is to + * put the two invocations of READ_ONCE or WRITE_ONCE in different C + * statements. * - * In contrast to ACCESS_ONCE these two macros will also work on aggregate - * data types like structs or unions. If the size of the accessed data - * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) - * READ_ONCE() and WRITE_ONCE() will fall back to memcpy(). There's at - * least two memcpy()s: one for the __builtin_memcpy() and then one for - * the macro doing the copy of variable - '__u' allocated on the stack. + * These two macros will also work on aggregate data types like structs or + * unions. If the size of the accessed data type exceeds the word size of + * the machine (e.g., 32 bits or 64 bits) READ_ONCE() and WRITE_ONCE() will + * fall back to memcpy(). There's at least two memcpy()s: one for the + * __builtin_memcpy() and then one for the macro doing the copy of variable + * - '__u' allocated on the stack. * * Their two major use cases are: (1) Mediating communication between * process-level code and irq/NMI handlers, all running on the same CPU, - * and (2) Ensuring that the compiler does not fold, spindle, or otherwise + * and (2) Ensuring that the compiler does not fold, spindle, or otherwise * mutilate accesses that either do not require ordering or that interact * with an explicit memory barrier or atomic instruction that provides the * required ordering. @@ -327,29 +327,4 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s compiletime_assert(__native_word(t), \ "Need native word sized stores/loads for atomicity.") -/* - * Prevent the compiler from merging or refetching accesses. The compiler - * is also forbidden from reordering successive instances of ACCESS_ONCE(), - * but only when the compiler is aware of some particular ordering. One way - * to make the compiler aware of ordering is to put the two invocations of - * ACCESS_ONCE() in different C statements. - * - * ACCESS_ONCE will only work on scalar types. For union types, ACCESS_ONCE - * on a union member will work as long as the size of the member matches the - * size of the union and the size is smaller than word size. - * - * The major use cases of ACCESS_ONCE used to be (1) Mediating communication - * between process-level code and irq/NMI handlers, all running on the same CPU, - * and (2) Ensuring that the compiler does not fold, spindle, or otherwise - * mutilate accesses that either do not require ordering or that interact - * with an explicit memory barrier or atomic instruction that provides the - * required ordering. - * - * If possible use READ_ONCE()/WRITE_ONCE() instead. - */ -#define __ACCESS_ONCE(x) ({ \ - __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ - (volatile typeof(x) *)&(x); }) -#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) - #endif /* __LINUX_COMPILER_H */