[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 18/19] vdpa: Add device migration blocker
From: |
Eugenio Pérez |
Subject: |
[PATCH v2 18/19] vdpa: Add device migration blocker |
Date: |
Thu, 14 Jul 2022 18:31:49 +0200 |
Since the vhost-vdpa device is exposing _F_LOG, adding a migration blocker if
it uses CVQ.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
include/hw/virtio/vhost-vdpa.h | 1 +
hw/virtio/vhost-vdpa.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
index 1111d85643..d10a89303e 100644
--- a/include/hw/virtio/vhost-vdpa.h
+++ b/include/hw/virtio/vhost-vdpa.h
@@ -35,6 +35,7 @@ typedef struct vhost_vdpa {
bool shadow_vqs_enabled;
/* IOVA mapping used by the Shadow Virtqueue */
VhostIOVATree *iova_tree;
+ Error *migration_blocker;
GPtrArray *shadow_vqs;
const VhostShadowVirtqueueOps *shadow_vq_ops;
void *shadow_vq_ops_opaque;
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index beaaa7049a..795ed5a049 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -20,6 +20,7 @@
#include "hw/virtio/vhost-shadow-virtqueue.h"
#include "hw/virtio/vhost-vdpa.h"
#include "exec/address-spaces.h"
+#include "migration/blocker.h"
#include "qemu/cutils.h"
#include "qemu/main-loop.h"
#include "cpu.h"
@@ -1022,6 +1023,13 @@ static bool vhost_vdpa_svqs_start(struct vhost_dev *dev)
return true;
}
+ if (v->migration_blocker) {
+ int r = migrate_add_blocker(v->migration_blocker, &err);
+ if (unlikely(r < 0)) {
+ goto err_migration_blocker;
+ }
+ }
+
for (i = 0; i < v->shadow_vqs->len; ++i) {
VirtQueue *vq = virtio_get_queue(dev->vdev, dev->vq_index + i);
VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, i);
@@ -1064,6 +1072,9 @@ err:
vhost_svq_stop(svq);
}
+err_migration_blocker:
+ error_reportf_err(err, "Cannot setup SVQ %u: ", i);
+
return false;
}
@@ -1083,6 +1094,9 @@ static bool vhost_vdpa_svqs_stop(struct vhost_dev *dev)
}
}
+ if (v->migration_blocker) {
+ migrate_del_blocker(v->migration_blocker);
+ }
return true;
}
--
2.31.1
- Re: [PATCH v2 15/19] vdpa: manual forward CVQ buffers, (continued)
[PATCH v2 11/19] vhost: Expose vhost_svq_add, Eugenio Pérez, 2022/07/14
[PATCH v2 16/19] vdpa: Buffer CVQ support on shadow virtqueue, Eugenio Pérez, 2022/07/14
[PATCH v2 17/19] vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs, Eugenio Pérez, 2022/07/14
[PATCH v2 10/19] vhost: add vhost_svq_push_elem, Eugenio Pérez, 2022/07/14
[PATCH v2 19/19] vdpa: Add x-svq to NetdevVhostVDPAOptions, Eugenio Pérez, 2022/07/14
[PATCH v2 18/19] vdpa: Add device migration blocker,
Eugenio Pérez <=
[PATCH v2 04/19] vhost: Reorder vhost_svq_kick, Eugenio Pérez, 2022/07/14