[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/13] vdpa: block migration if dev does not have _F_SUSPEND
From: |
Eugenio Pérez |
Subject: |
[PATCH 11/13] vdpa: block migration if dev does not have _F_SUSPEND |
Date: |
Fri, 3 Feb 2023 20:11:40 +0100 |
Next patches enable devices to be migrated even if vdpa netdev has not
been started with x-svq. However, not all devices are migratable, so we
need to block migration if we detect that.
Block vhost-vdpa device migration if it does not offer _F_SUSPEND and it
has not been started with x-svq.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-vdpa.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index b0d69df9e6..c01411af30 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -442,6 +442,27 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void
*opaque, Error **errp)
return 0;
}
+ /*
+ * If dev->shadow_vqs_enabled at initialization that means the device has
+ * been started with x-svq=on, so don't block migration
+ */
+ if (dev->migration_blocker == NULL && !v->shadow_vqs_enabled) {
+ uint64_t backend_features;
+
+ /* We don't have dev->backend_features yet */
+ ret = vhost_vdpa_call(dev, VHOST_GET_BACKEND_FEATURES,
+ &backend_features);
+ if (unlikely(ret)) {
+ error_setg_errno(errp, -ret, "Could not get backend features");
+ return ret;
+ }
+
+ if (!(backend_features & BIT_ULL(VHOST_BACKEND_F_SUSPEND))) {
+ error_setg(&dev->migration_blocker,
+ "vhost-vdpa backend lacks VHOST_BACKEND_F_SUSPEND feature.");
+ }
+ }
+
/*
* Similar to VFIO, we end up pinning all guest memory and have to
* disable discarding of RAM.
--
2.31.1
- [PATCH 05/13] vdpa: rewind at get_base, not set_base, (continued)
- [PATCH 05/13] vdpa: rewind at get_base, not set_base, Eugenio Pérez, 2023/02/03
- [PATCH 03/13] vdpa: add vhost_vdpa_suspend, Eugenio Pérez, 2023/02/03
- [PATCH 06/13] vdpa net: allow VHOST_F_LOG_ALL, Eugenio Pérez, 2023/02/03
- [PATCH 07/13] vdpa: add vdpa net migration state notifier, Eugenio Pérez, 2023/02/03
- [PATCH 02/13] vdpa: Negotiate _F_SUSPEND feature, Eugenio Pérez, 2023/02/03
- [PATCH 04/13] vdpa: move vhost reset after get vring base, Eugenio Pérez, 2023/02/03
- [PATCH 08/13] vdpa: disable RAM block discard only for the first device, Eugenio Pérez, 2023/02/03
- [PATCH 09/13] vdpa net: block migration if the device has CVQ, Eugenio Pérez, 2023/02/03
- [PATCH 01/13] vdpa net: move iova tree creation from init to start, Eugenio Pérez, 2023/02/03
- [PATCH 10/13] vdpa: block migration if device has unsupported features, Eugenio Pérez, 2023/02/03
- [PATCH 11/13] vdpa: block migration if dev does not have _F_SUSPEND,
Eugenio Pérez <=
- [PATCH 13/13] vdpa: return VHOST_F_LOG_ALL in vhost-vdpa devices, Eugenio Pérez, 2023/02/03
- [PATCH 12/13] vdpa: block migration if SVQ does not admit a feature, Eugenio Pérez, 2023/02/03