[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 03/27] vhost: Move log resize/put to vhost_dev_set_log
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH 03/27] vhost: Move log resize/put to vhost_dev_set_log |
Date: |
Fri, 20 Nov 2020 19:50:41 +0100 |
Software assisted live migration does not allocate vhost log.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 2adb2718c1..9cbd52a7f1 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -828,6 +828,10 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool
enable_log)
int r, i, idx;
hwaddr addr;
+ if (enable_log) {
+ vhost_dev_log_resize(dev, vhost_get_log_size(dev));
+ }
+
r = vhost_dev_set_features(dev, enable_log);
if (r < 0) {
goto err_features;
@@ -850,6 +854,10 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool
enable_log)
goto err_vq;
}
}
+
+ if (!enable_log) {
+ vhost_log_put(dev, false);
+ }
return 0;
err_vq:
for (; i >= 0; --i) {
@@ -877,22 +885,8 @@ static int vhost_migration_log(MemoryListener *listener,
return 0;
}
- r = 0;
- if (!enable) {
- r = device_cb(dev, false);
- if (r < 0) {
- goto check_dev_state;
- }
- vhost_log_put(dev, false);
- } else {
- vhost_dev_log_resize(dev, vhost_get_log_size(dev));
- r = device_cb(dev, true);
- if (r < 0) {
- goto check_dev_state;
- }
- }
+ r = device_cb(dev, enable);
-check_dev_state:
dev->log_enabled = enable;
/*
* vhost-user-* devices could change their state during log
--
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 <=
- [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, 2020/11/20
- [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