On Wed, 6 Nov 2024 at 14:21, Stefano Garzarella <sgarz...@redhat.com> wrote:
> I think we should call that functions in the reverse order, so just add them 
> in the error path, as we already do for other calls.
===
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index a70b7422b5..f168e1f02a 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -2153,14 +2153,16 @@ int vhost_dev_start(struct vhost_dev *hdev,
VirtIODevice *vdev, bool vrings)
             struct vhost_virtqueue *vq = hdev->vqs + i;
             r = vhost_device_iotlb_miss(hdev, vq->used_phys, true);
             if (r) {
-                VHOST_OPS_DEBUG(r, "vhost_device_iotlb_miss failed");
-                goto fail_start;
+                goto fail_iotlb;
             }
         }
     }
     vhost_start_config_intr(hdev);
     return 0;
+fail_iotlb:
+    hdev->vhost_ops->vhost_set_iotlb_callback(hdev, false);
 fail_start:
+    hdev->vhost_ops->vhost_dev_start(hdev, false);
     if (vrings) {
         vhost_dev_set_vring_enable(hdev, false);
     }
===

* Is this okay?

* Looking at the vhost_vdpa_dev_start(), when it is called with
'started=false' parameter, it calls the vdpa_suspend, vdpa_stop etc.
functions. ie. probably other ->vhost_dev_start() and
->vhost_set_iotlb_callback() functions need to take appropriate action
when called with 'started/enabled=false' parameter.

Thank you.
---
  - Prasad


Reply via email to