]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
vringh: kill off ACCESS_ONCE()
authorMark Rutland <mark.rutland@arm.com>
Thu, 24 Nov 2016 10:25:13 +0000 (10:25 +0000)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 15 Dec 2016 22:13:36 +0000 (00:13 +0200)
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
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
drivers/vhost/vringh.c

index 3bb02c60a2f5fe85a4d38e5d884b66f03b8756e9..bb8971f2a634bc478a97c672ebde8e7d7c7da3cc 100644 (file)
@@ -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;
 }