[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/53] vdpa: stop all svq on device deletion
From: |
Michael S. Tsirkin |
Subject: |
[PULL 19/53] vdpa: stop all svq on device deletion |
Date: |
Thu, 2 Mar 2023 03:25:29 -0500 |
From: Eugenio Pérez <eperezma@redhat.com>
Not stopping them leave the device in a bad state when virtio-net
fronted device is unplugged with device_del monitor command.
This is not triggable in regular poweroff or qemu forces shutdown
because cleanup is called right after vhost_vdpa_dev_start(false). But
devices hot unplug does not call vdpa device cleanups. This lead to all
the vhost_vdpa devices without stop the SVQ but the last.
Fix it and clean the code, making it symmetric with
vhost_vdpa_svqs_start.
Fixes: dff4426fa656 ("vhost: Add Shadow VirtQueue kick forwarding capabilities")
Reported-by: Lei Yang <leiyang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230209170004.899472-1-eperezma@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
hw/virtio/vhost-vdpa.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 542e003101..df3a1e92ac 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -689,26 +689,11 @@ static int vhost_vdpa_get_device_id(struct vhost_dev *dev,
return ret;
}
-static void vhost_vdpa_reset_svq(struct vhost_vdpa *v)
-{
- if (!v->shadow_vqs_enabled) {
- return;
- }
-
- for (unsigned i = 0; i < v->shadow_vqs->len; ++i) {
- VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, i);
- vhost_svq_stop(svq);
- }
-}
-
static int vhost_vdpa_reset_device(struct vhost_dev *dev)
{
- struct vhost_vdpa *v = dev->opaque;
int ret;
uint8_t status = 0;
- vhost_vdpa_reset_svq(v);
-
ret = vhost_vdpa_call(dev, VHOST_VDPA_SET_STATUS, &status);
trace_vhost_vdpa_reset_device(dev, status);
return ret;
@@ -1100,6 +1085,8 @@ static void vhost_vdpa_svqs_stop(struct vhost_dev *dev)
for (unsigned i = 0; i < v->shadow_vqs->len; ++i) {
VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, i);
+
+ vhost_svq_stop(svq);
vhost_vdpa_svq_unmap_rings(dev, svq);
event_notifier_cleanup(&svq->hdev_kick);
--
MST
- [PULL 10/53] backends/vhost-user: remove the ioeventfd check, (continued)
- [PULL 10/53] backends/vhost-user: remove the ioeventfd check, Michael S. Tsirkin, 2023/03/02
- [PULL 12/53] vhost-user-i2c: Back up vqs before cleaning up vhost_dev, Michael S. Tsirkin, 2023/03/02
- [PULL 14/53] virtio-rng-pci: fix transitional migration compat for vectors, Michael S. Tsirkin, 2023/03/02
- [PULL 08/53] Revert "hw/i386: pass RNG seed via setup_data entry", Michael S. Tsirkin, 2023/03/02
- [PULL 15/53] hw/timer/hpet: Fix expiration time overflow, Michael S. Tsirkin, 2023/03/02
- [PULL 06/53] Revert "x86: use typedef for SetupData struct", Michael S. Tsirkin, 2023/03/02
- [PULL 18/53] vhost-user: Adopt new backend naming, Michael S. Tsirkin, 2023/03/02
- [PULL 19/53] vdpa: stop all svq on device deletion,
Michael S. Tsirkin <=
- [PULL 20/53] pci/shpc: set attention led to OFF on reset, Michael S. Tsirkin, 2023/03/02
- [PULL 21/53] pci/shpc: change shpc_get_status() return type to uint8_t, Michael S. Tsirkin, 2023/03/02
- [PULL 22/53] pci/shpc: shpc_slot_command(): handle PWRONLY -> ENABLED transition, Michael S. Tsirkin, 2023/03/02
- [PULL 23/53] pci/shpc: more generic handle hot-unplug in shpc_slot_command(), Michael S. Tsirkin, 2023/03/02
- [PULL 27/53] pcie_regs: drop duplicated indicator value macros, Michael S. Tsirkin, 2023/03/02
- [PULL 24/53] pci/shpc: pass PCIDevice pointer to shpc_slot_command(), Michael S. Tsirkin, 2023/03/02
- [PULL 25/53] pci/shpc: refactor shpc_device_plug_common(), Michael S. Tsirkin, 2023/03/02
- [PULL 26/53] pcie: pcie_cap_slot_write_config(): use correct macro, Michael S. Tsirkin, 2023/03/02
- [PULL 29/53] pcie: pcie_cap_slot_enable_power() use correct helper, Michael S. Tsirkin, 2023/03/02
- [PULL 28/53] pcie: drop unused PCIExpressIndicator, Michael S. Tsirkin, 2023/03/02