From patchwork Thu Nov 24 10:25:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 83847 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp65499qgi; Thu, 24 Nov 2016 02:25:58 -0800 (PST) X-Received: by 10.84.216.21 with SMTP id m21mr3746016pli.119.1479983158727; Thu, 24 Nov 2016 02:25:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si10113535plx.43.2016.11.24.02.25.58; Thu, 24 Nov 2016 02:25:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964927AbcKXKZo (ORCPT + 5 others); Thu, 24 Nov 2016 05:25:44 -0500 Received: from foss.arm.com ([217.140.101.70]:47034 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936218AbcKXKZm (ORCPT ); Thu, 24 Nov 2016 05:25:42 -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 20DA016; Thu, 24 Nov 2016 02:25:42 -0800 (PST) Received: from remoulade.cambridge.arm.com (flaeskesteg.cambridge.arm.com [10.1.27.175]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6553F3F318; Thu, 24 Nov 2016 02:25:40 -0800 (PST) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: dave@stgolabs.net, dbueso@suse.de, dvyukov@google.com, jasowang@redhat.com, kvm@vger.kernel.org, mark.rutland@arm.com, mst@redhat.com, netdev@vger.kernel.org, paulmck@linux.vnet.ibm.com, virtualization@lists.linux-foundation.org Subject: [PATCH 3/3] tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h Date: Thu, 24 Nov 2016 10:25:14 +0000 Message-Id: <1479983114-17190-4-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> References: <1479983114-17190-1-git-send-email-mark.rutland@arm.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org As a step towards killing off ACCESS_ONCE, use {READ,WRITE}_ONCE() for the virtio tools uaccess primitives, pulling these in from . With this done, we can kill off the now-unused ACCESS_ONCE() definition. Signed-off-by: Mark Rutland Cc: Jason Wang Cc: Michael S. Tsirkin Cc: linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org --- tools/virtio/linux/uaccess.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.7.4 Reviewed-by: Jason Wang diff --git a/tools/virtio/linux/uaccess.h b/tools/virtio/linux/uaccess.h index 0a578fe..fa05d01 100644 --- a/tools/virtio/linux/uaccess.h +++ b/tools/virtio/linux/uaccess.h @@ -1,8 +1,9 @@ #ifndef UACCESS_H #define UACCESS_H -extern void *__user_addr_min, *__user_addr_max; -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +#include + +extern void *__user_addr_min, *__user_addr_max; static inline void __chk_user_ptr(const volatile void *p, size_t size) { @@ -13,7 +14,7 @@ static inline void __chk_user_ptr(const volatile void *p, size_t size) ({ \ typeof(ptr) __pu_ptr = (ptr); \ __chk_user_ptr(__pu_ptr, sizeof(*__pu_ptr)); \ - ACCESS_ONCE(*(__pu_ptr)) = x; \ + WRITE_ONCE(*(__pu_ptr), x); \ 0; \ }) @@ -21,7 +22,7 @@ static inline void __chk_user_ptr(const volatile void *p, size_t size) ({ \ typeof(ptr) __pu_ptr = (ptr); \ __chk_user_ptr(__pu_ptr, sizeof(*__pu_ptr)); \ - x = ACCESS_ONCE(*(__pu_ptr)); \ + x = READ_ONCE(*(__pu_ptr)); \ 0; \ })