[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/45] vhost-vdpa: make notifiers _init()/_uninit() symmetric
From: |
Michael S. Tsirkin |
Subject: |
[PULL 18/45] vhost-vdpa: make notifiers _init()/_uninit() symmetric |
Date: |
Fri, 4 Mar 2022 08:39:42 -0500 |
From: Laurent Vivier <lvivier@redhat.com>
vhost_vdpa_host_notifiers_init() initializes queue notifiers
for queues "dev->vq_index" to queue "dev->vq_index + dev->nvqs",
whereas vhost_vdpa_host_notifiers_uninit() uninitializes the
same notifiers for queue "0" to queue "dev->nvqs".
This asymmetry seems buggy, fix that by using dev->vq_index
as the base for both.
Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
Cc: jasowang@redhat.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20220211161309.1385839-1-lvivier@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/vhost-vdpa.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 11f696468d..6c67d5f034 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -395,15 +395,6 @@ static void vhost_vdpa_host_notifier_uninit(struct
vhost_dev *dev,
}
}
-static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- vhost_vdpa_host_notifier_uninit(dev, i);
- }
-}
-
static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int
queue_index)
{
size_t page_size = qemu_real_host_page_size;
@@ -443,6 +434,15 @@ err:
return -1;
}
+static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n)
+{
+ int i;
+
+ for (i = dev->vq_index; i < dev->vq_index + n; i++) {
+ vhost_vdpa_host_notifier_uninit(dev, i);
+ }
+}
+
static void vhost_vdpa_host_notifiers_init(struct vhost_dev *dev)
{
int i;
@@ -456,7 +456,7 @@ static void vhost_vdpa_host_notifiers_init(struct vhost_dev
*dev)
return;
err:
- vhost_vdpa_host_notifiers_uninit(dev, i);
+ vhost_vdpa_host_notifiers_uninit(dev, i - dev->vq_index);
return;
}
--
MST
- [PULL 10/45] vhost-user: fix VirtQ notifier cleanup, (continued)
- [PULL 10/45] vhost-user: fix VirtQ notifier cleanup, Michael S. Tsirkin, 2022/03/04
- [PULL 11/45] virtio: fix the condition for iommu_platform not supported, Michael S. Tsirkin, 2022/03/04
- [PULL 12/45] hw/vhost-user-i2c: Add support for VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, Michael S. Tsirkin, 2022/03/04
- [PULL 13/45] tests/qtest/libqos/pci: Introduce pio_limit, Michael S. Tsirkin, 2022/03/04
- [PULL 14/45] tests/qtest/libqos: Skip hotplug tests if pci root bus is not hotpluggable, Michael S. Tsirkin, 2022/03/04
- [PULL 15/45] tests/qtest/vhost-user-blk-test: Temporary hack to get tests passing on aarch64, Michael S. Tsirkin, 2022/03/04
- [PULL 16/45] tests/qtest/libqos: Add generic pci host bridge in arm-virt machine, Michael S. Tsirkin, 2022/03/04
- [PULL 17/45] hw/virtio: vdpa: Fix leak of host-notifier memory-region, Michael S. Tsirkin, 2022/03/04
- [PULL 18/45] vhost-vdpa: make notifiers _init()/_uninit() symmetric,
Michael S. Tsirkin <=
- [PULL 19/45] intel_iommu: support snoop control, Michael S. Tsirkin, 2022/03/04
- [PULL 20/45] hw/i386: Improve bounds checking in OVMF table parsing, Michael S. Tsirkin, 2022/03/04
- [PULL 21/45] hw/i386: Replace magic number with field length calculation, Michael S. Tsirkin, 2022/03/04
- [PULL 22/45] virtio-iommu: Default to bypass during boot, Michael S. Tsirkin, 2022/03/04
- [PULL 23/45] virtio-iommu: Support bypass domain, Michael S. Tsirkin, 2022/03/04
- [PULL 24/45] tests/qtest/virtio-iommu-test: Check bypass config, Michael S. Tsirkin, 2022/03/04
- [PULL 25/45] hw/i386/pc_piix: Mark the machine types from version 1.4 to 1.7 as deprecated, Michael S. Tsirkin, 2022/03/04
- [PULL 26/45] hw/pci-bridge/pxb: Fix missing swizzle, Michael S. Tsirkin, 2022/03/04
- [PULL 27/45] virtio-net: Unlimit tx queue size if peer is vdpa, Michael S. Tsirkin, 2022/03/04
- [PULL 28/45] pcie: Add support for Single Root I/O Virtualization (SR/IOV), Michael S. Tsirkin, 2022/03/04