[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/24] vdpa: Add device migration blocker
From: |
Jason Wang |
Subject: |
[PULL 19/24] vdpa: Add device migration blocker |
Date: |
Tue, 19 Jul 2022 21:16:32 +0800 |
From: Eugenio Pérez <eperezma@redhat.com>
Since the vhost-vdpa device is exposing _F_LOG, adding a migration blocker if
it uses CVQ.
However, qemu is able to migrate simple devices with no CVQ as long as
they use SVQ. To allow it, add a placeholder error to vhost_vdpa, and
only add to vhost_dev when used. vhost_dev machinery place the migration
blocker if needed.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/virtio/vhost-vdpa.c | 15 +++++++++++++++
include/hw/virtio/vhost-vdpa.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index beaaa70..291cd19 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)) {
+ return false;
+ }
+ }
+
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,10 @@ err:
vhost_svq_stop(svq);
}
+ if (v->migration_blocker) {
+ migrate_del_blocker(v->migration_blocker);
+ }
+
return false;
}
@@ -1083,6 +1095,9 @@ static bool vhost_vdpa_svqs_stop(struct vhost_dev *dev)
}
}
+ if (v->migration_blocker) {
+ migrate_del_blocker(v->migration_blocker);
+ }
return true;
}
diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
index 1111d85..d10a893 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;
--
2.7.4
- [PULL 08/24] vhost: Decouple vhost_svq_add from VirtQueueElement, (continued)
- [PULL 08/24] vhost: Decouple vhost_svq_add from VirtQueueElement, Jason Wang, 2022/07/19
- [PULL 09/24] vhost: Add SVQDescState, Jason Wang, 2022/07/19
- [PULL 10/24] vhost: Track number of descs in SVQDescState, Jason Wang, 2022/07/19
- [PULL 12/24] vhost: Expose vhost_svq_add, Jason Wang, 2022/07/19
- [PULL 13/24] vhost: add vhost_svq_poll, Jason Wang, 2022/07/19
- [PULL 11/24] vhost: add vhost_svq_push_elem, Jason Wang, 2022/07/19
- [PULL 15/24] vdpa: Export vhost_vdpa_dma_map and unmap calls, Jason Wang, 2022/07/19
- [PULL 14/24] vhost: Add svq avail_handler callback, Jason Wang, 2022/07/19
- [PULL 16/24] vdpa: manual forward CVQ buffers, Jason Wang, 2022/07/19
- [PULL 17/24] vdpa: Buffer CVQ support on shadow virtqueue, Jason Wang, 2022/07/19
- [PULL 19/24] vdpa: Add device migration blocker,
Jason Wang <=
- [PULL 18/24] vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs, Jason Wang, 2022/07/19
- [PULL 20/24] vdpa: Add x-svq to NetdevVhostVDPAOptions, Jason Wang, 2022/07/19
- [PULL 22/24] net/colo: Fix a "double free" crash to clear the conn_list, Jason Wang, 2022/07/19
- [PULL 24/24] net/colo.c: fix segmentation fault when packet is not parsed correctly, Jason Wang, 2022/07/19
- [PULL 21/24] softmmu/runstate.c: add RunStateTransition support form COLO to PRELAUNCH, Jason Wang, 2022/07/19
- [PULL 23/24] net/colo.c: No need to track conn_list for filter-rewriter, Jason Wang, 2022/07/19
- Re: [PULL 00/24] Net Patches, Peter Maydell, 2022/07/19