netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
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	[thread overview]
Message-ID: <1479983114-17190-3-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1479983114-17190-1-git-send-email-mark.rutland@arm.com>

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 <linux/compiler.h> for
the relevant definitions. The userspace tools provide their own definitions in
their own <linux/compiler.h>.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
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(-)

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 <linux/compiler.h>
 #include <linux/module.h>
 #include <linux/vringh.h>
 #include <linux/virtio_ring.h>
@@ -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;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2016-11-24 10:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24 10:25 [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE() Mark Rutland
2016-11-24 10:25 ` [PATCH 1/3] tools/virtio: fix READ_ONCE() Mark Rutland
2016-11-24 11:34   ` Cornelia Huck
2016-11-25  2:38   ` Jason Wang
2016-11-24 10:25 ` Mark Rutland [this message]
2016-11-24 11:10   ` [PATCH 2/3] vringh: kill off ACCESS_ONCE() Christian Borntraeger
2016-11-24 11:35   ` Cornelia Huck
2016-11-25  2:40   ` Jason Wang
2016-11-24 10:25 ` [PATCH 3/3] tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h Mark Rutland
2016-11-24 11:37   ` Cornelia Huck
2016-11-25  2:40   ` Jason Wang
2016-11-24 20:36 ` [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE() Michael S. Tsirkin
2016-11-25 11:22   ` Mark Rutland
2016-11-25 11:33     ` Christian Borntraeger
2016-11-25 12:23       ` Mark Rutland
2016-11-25 12:40         ` Peter Zijlstra
2016-11-25 12:44           ` Peter Zijlstra
2016-11-25 14:56             ` Boqun Feng
2016-11-25 15:21               ` Dmitry Vyukov
2016-11-25 16:10                 ` Mark Rutland
2016-11-25 16:17                   ` Peter Zijlstra
2016-11-25 16:32                     ` Mark Rutland
2016-11-25 16:49                     ` Christian Borntraeger
2016-11-25 17:28                       ` Mark Rutland
2016-11-25 17:42                         ` Peter Zijlstra
2016-11-25 18:46                         ` Christian Borntraeger
2016-11-25 21:08                       ` Michael S. Tsirkin
2016-11-25 21:45                         ` Christian Borntraeger
2016-11-25 17:28                     ` Dmitry Vyukov
2016-11-25 17:43                       ` Mark Rutland
2016-11-25 17:52                       ` Linus Torvalds
2016-11-25 18:07                         ` Mark Rutland
2016-11-25 18:47                           ` Linus Torvalds
2016-11-25 14:35           ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479983114-17190-3-git-send-email-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=dave@stgolabs.net \
    --cc=dbueso@suse.de \
    --cc=dvyukov@google.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).