[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 58/63] virtio: remove unnecessary thread fence while reading next
From: |
Michael S. Tsirkin |
Subject: |
[PULL 58/63] virtio: remove unnecessary thread fence while reading next descriptor |
Date: |
Wed, 4 Oct 2023 04:46:15 -0400 |
From: Ilya Maximets <i.maximets@ovn.org>
It was supposed to be a compiler barrier and it was a compiler barrier
initially called 'wmb' when virtio core support was introduced.
Later all the instances of 'wmb' were switched to smp_wmb to fix memory
ordering issues on non-x86 platforms. However, this one doesn't need
to be an actual barrier, as its only purpose was to ensure that the
value is not read twice.
And since commit aa570d6fb6bd ("virtio: combine the read of a descriptor")
there is no need for a barrier at all, since we're no longer reading
guest memory here, but accessing a local structure.
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Message-Id: <20230927140016.2317404-2-i.maximets@ovn.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2058b838e9..87e8f990c5 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1060,8 +1060,6 @@ static int virtqueue_split_read_next_desc(VirtIODevice
*vdev, VRingDesc *desc,
/* Check they're not leading us off end of descriptors. */
*next = desc->next;
- /* Make sure compiler knows to grab that: we don't want it changing! */
- smp_wmb();
if (*next >= max) {
virtio_error(vdev, "Desc next is %u", *next);
--
MST
- [PULL 61/63] hw/display: introduce virtio-dmabuf, (continued)
- [PULL 61/63] hw/display: introduce virtio-dmabuf, Michael S. Tsirkin, 2023/10/04
- [PULL 57/63] virtio: use shadow_avail_idx while checking number of heads, Michael S. Tsirkin, 2023/10/04
- [PULL 40/63] hw/i386/acpi-build: Determine SMI command port just once, Michael S. Tsirkin, 2023/10/04
- [PULL 46/63] hw/cxl: Add utility functions decoder interleave ways and target count., Michael S. Tsirkin, 2023/10/04
- [PULL 54/63] hw/i386/pc: improve physical address space bound check for 32-bit x86 systems, Michael S. Tsirkin, 2023/10/04
- [PULL 52/63] vdpa net: follow VirtIO initialization properly at cvq isolation probing, Michael S. Tsirkin, 2023/10/04
- [PULL 59/63] virtio: remove unused next argument from virtqueue_split_read_next_desc(), Michael S. Tsirkin, 2023/10/04
- [PULL 63/63] libvhost-user: handle shared_object msg, Michael S. Tsirkin, 2023/10/04
- [PULL 62/63] vhost-user: add shared_object msg, Michael S. Tsirkin, 2023/10/04
- [PULL 43/63] vdpa: fix gcc cvq_isolated uninitialized variable warning, Michael S. Tsirkin, 2023/10/04
- [PULL 58/63] virtio: remove unnecessary thread fence while reading next descriptor,
Michael S. Tsirkin <=
- Re: [PULL 00/63] virtio,pci: features, cleanups, Philippe Mathieu-Daudé, 2023/10/04
- Re: [PULL 00/63] virtio,pci: features, cleanups, Michael S. Tsirkin, 2023/10/04
- Re: [PULL 00/63] virtio,pci: features, cleanups, Michael S. Tsirkin, 2023/10/04
- Re: [PULL 00/63] virtio,pci: features, cleanups, Stefan Hajnoczi, 2023/10/04
- Re: [PULL 00/63] virtio,pci: features, cleanups, Michael S. Tsirkin, 2023/10/04
- Re: [PULL 00/63] virtio,pci: features, cleanups, Thomas Huth, 2023/10/04
- Re: [PULL 00/63] virtio,pci: features, cleanups, Michael S. Tsirkin, 2023/10/04
- Re: [PULL 00/63] virtio,pci: features, cleanups, Thomas Huth, 2023/10/05
- Re: [PULL 00/63] virtio,pci: features, cleanups, Stefan Hajnoczi, 2023/10/04