[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 08/27] vhost: Add a flag for software assisted Live Migration
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH 08/27] vhost: Add a flag for software assisted Live Migration |
Date: |
Fri, 20 Nov 2020 19:50:46 +0100 |
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
include/hw/virtio/vhost.h | 1 +
hw/virtio/vhost.c | 17 +++++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 93cc3f1ae3..ef920a8076 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -84,6 +84,7 @@ struct vhost_dev {
uint64_t backend_cap;
bool started;
bool log_enabled;
+ bool sw_lm_enabled;
uint64_t log_size;
VhostShadowVirtqueue *sw_lm_shadow_vq[2];
VirtIOHandleOutput sw_lm_vq_handler;
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index a55b684b5f..1d55e26d45 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -988,11 +988,16 @@ static int vhost_sw_live_migration_start(struct vhost_dev
*dev)
static int vhost_sw_live_migration_enable(struct vhost_dev *dev,
bool enable_lm)
{
+ int r;
+
if (enable_lm) {
- return vhost_sw_live_migration_start(dev);
+ r = vhost_sw_live_migration_start(dev);
} else {
- return vhost_sw_live_migration_stop(dev);
+ r = vhost_sw_live_migration_stop(dev);
}
+
+ dev->sw_lm_enabled = enable_lm;
+ return r;
}
static void vhost_sw_lm_global_start(MemoryListener *listener)
@@ -1466,6 +1471,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
hdev->log = NULL;
hdev->log_size = 0;
hdev->log_enabled = false;
+ hdev->sw_lm_enabled = false;
hdev->started = false;
memory_listener_register(&hdev->memory_listener, &address_space_memory);
QLIST_INSERT_HEAD(&vhost_devices, hdev, entry);
@@ -1571,6 +1577,13 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev,
VirtIODevice *vdev)
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
int i, r;
+ if (hdev->sw_lm_enabled) {
+ /* We've been called after migration is completed, so no need to
+ disable it again
+ */
+ return;
+ }
+
for (i = 0; i < hdev->nvqs; ++i) {
r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i,
false);
--
2.18.4
- [RFC PATCH 00/27] vDPA software assisted live migration, Eugenio Pérez, 2020/11/20
- [RFC PATCH 01/27] vhost: Add vhost_dev_can_log, Eugenio Pérez, 2020/11/20
- [RFC PATCH 02/27] vhost: Add device callback in vhost_migration_log, Eugenio Pérez, 2020/11/20
- [RFC PATCH 03/27] vhost: Move log resize/put to vhost_dev_set_log, Eugenio Pérez, 2020/11/20
- [RFC PATCH 04/27] vhost: add vhost_kernel_set_vring_enable, Eugenio Pérez, 2020/11/20
- [RFC PATCH 05/27] vhost: Add hdev->dev.sw_lm_vq_handler, Eugenio Pérez, 2020/11/20
- [RFC PATCH 06/27] virtio: Add virtio_queue_get_used_notify_split, Eugenio Pérez, 2020/11/20
- [RFC PATCH 07/27] vhost: Route guest->host notification through qemu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 08/27] vhost: Add a flag for software assisted Live Migration,
Eugenio Pérez <=
- [RFC PATCH 09/27] vhost: Route host->guest notification through qemu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 10/27] vhost: Allocate shadow vring, Eugenio Pérez, 2020/11/20
- [RFC PATCH 11/27] virtio: const-ify all virtio_tswap* functions, Eugenio Pérez, 2020/11/20
- [RFC PATCH 12/27] virtio: Add virtio_queue_full, Eugenio Pérez, 2020/11/20
- [RFC PATCH 13/27] vhost: Send buffers to device, Eugenio Pérez, 2020/11/20
- [RFC PATCH 14/27] virtio: Remove virtio_queue_get_used_notify_split, Eugenio Pérez, 2020/11/20
- [RFC PATCH 15/27] vhost: Do not invalidate signalled used, Eugenio Pérez, 2020/11/20
- [RFC PATCH 16/27] virtio: Expose virtqueue_alloc_element, Eugenio Pérez, 2020/11/20
- [RFC PATCH 17/27] vhost: add vhost_vring_set_notification_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 18/27] vhost: add vhost_vring_poll_rcu, Eugenio Pérez, 2020/11/20