From patchwork Thu Nov 24 10:25:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 83849 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp65606qgi; Thu, 24 Nov 2016 02:26:26 -0800 (PST) X-Received: by 10.99.126.6 with SMTP id z6mr2930751pgc.182.1479983185932; Thu, 24 Nov 2016 02:26:25 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d83si38746058pfd.152.2016.11.24.02.26.25; Thu, 24 Nov 2016 02:26:25 -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 S938758AbcKXK0L (ORCPT + 25 others); Thu, 24 Nov 2016 05:26:11 -0500 Received: from foss.arm.com ([217.140.101.70]:47014 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936175AbcKXKZk (ORCPT ); Thu, 24 Nov 2016 05:25:40 -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 A15EC1515; Thu, 24 Nov 2016 02:25:39 -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 E40403F318; Thu, 24 Nov 2016 02:25:37 -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 2/3] vringh: kill off ACCESS_ONCE() Date: Thu, 24 Nov 2016 10:25:13 +0000 Message-Id: <1479983114-17190-3-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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Despite living under drivers/ vringh.c is also used as part of the userspace virtio tools. Before we can kill off the ACCESS_ONCE()definition in the tools, we must convert vringh.c to use {READ,WRITE}_ONCE(). This patch does so, along with the required include of for the relevant definitions. The userspace tools provide their own definitions in their own . Signed-off-by: Mark Rutland Cc: Jason Wang Cc: Michael S. Tsirkin Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org Cc: virtualization@lists.linux-foundation.org --- drivers/vhost/vringh.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.7.4 Reviewed-by: Christian Borntraeger Reviewed-by: Cornelia Huck diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 3bb02c6..bb8971f 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -3,6 +3,7 @@ * * Since these may be in userspace, we use (inline) accessors. */ +#include #include #include #include @@ -820,13 +821,13 @@ EXPORT_SYMBOL(vringh_need_notify_user); static inline int getu16_kern(const struct vringh *vrh, u16 *val, const __virtio16 *p) { - *val = vringh16_to_cpu(vrh, ACCESS_ONCE(*p)); + *val = vringh16_to_cpu(vrh, READ_ONCE(*p)); return 0; } static inline int putu16_kern(const struct vringh *vrh, __virtio16 *p, u16 val) { - ACCESS_ONCE(*p) = cpu_to_vringh16(vrh, val); + WRITE_ONCE(*p, cpu_to_vringh16(vrh, val)); return 0; }