[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V4 18/25] vhost: reset vhost devices upon cprsave
From: |
Steve Sistare |
Subject: |
[PATCH V4 18/25] vhost: reset vhost devices upon cprsave |
Date: |
Tue, 6 Jul 2021 09:45:49 -0700 |
A vhost device is implicitly preserved across re-exec because its fd is not
closed, and the value of the fd is specified on the command line for the
new qemu to find. However, new qemu issues an VHOST_RESET_OWNER ioctl,
which fails because the device already has an owner. To fix, reset the
owner prior to exec.
Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
hw/virtio/vhost.c | 11 +++++++++++
include/hw/virtio/vhost.h | 1 +
migration/cpr.c | 1 +
3 files changed, 13 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index e2163a0..8c0c9c3 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1820,6 +1820,17 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice
*vdev)
hdev->vdev = NULL;
}
+void vhost_dev_reset_all(void)
+{
+ struct vhost_dev *dev;
+
+ QLIST_FOREACH(dev, &vhost_devices, entry) {
+ if (dev->vhost_ops->vhost_reset_device(dev) < 0) {
+ VHOST_OPS_DEBUG("vhost_reset_device failed");
+ }
+ }
+}
+
int vhost_net_set_backend(struct vhost_dev *hdev,
struct vhost_vring_file *file)
{
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 4a8bc75..71704d4 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -106,6 +106,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
void vhost_dev_cleanup(struct vhost_dev *hdev);
int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
+void vhost_dev_reset_all(void);
int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
diff --git a/migration/cpr.c b/migration/cpr.c
index 578466c..6333988 100644
--- a/migration/cpr.c
+++ b/migration/cpr.c
@@ -142,6 +142,7 @@ void cprexec(strList *args, Error **errp)
return;
}
walkenv(FD_PREFIX, preserve_fd, 0);
+ vhost_dev_reset_all();
qemu_system_exec_request(args);
}
--
1.8.3.1
- [PATCH V4 08/25] vl: add helper to request re-exec, (continued)
- [PATCH V4 08/25] vl: add helper to request re-exec, Steve Sistare, 2021/07/06
- [PATCH V4 09/25] string to strList, Steve Sistare, 2021/07/06
- [PATCH V4 10/25] util: env var helpers, Steve Sistare, 2021/07/06
- [PATCH V4 12/25] cpr: QMP interfaces for restart, Steve Sistare, 2021/07/06
- [PATCH V4 11/25] cpr: restart mode, Steve Sistare, 2021/07/06
- [PATCH V4 13/25] cpr: HMP interfaces for restart, Steve Sistare, 2021/07/06
- [PATCH V4 14/25] pci: export functions for cpr, Steve Sistare, 2021/07/06
- [PATCH V4 15/25] vfio-pci: refactor for cpr, Steve Sistare, 2021/07/06
- [PATCH V4 17/25] vfio-pci: cpr part 2, Steve Sistare, 2021/07/06
- [PATCH V4 19/25] hostmem-memfd: cpr support, Steve Sistare, 2021/07/06
- [PATCH V4 18/25] vhost: reset vhost devices upon cprsave,
Steve Sistare <=
- [PATCH V4 21/25] chardev: cpr for simple devices, Steve Sistare, 2021/07/06
- [PATCH V4 20/25] chardev: cpr framework, Steve Sistare, 2021/07/06
- [PATCH V4 22/25] chardev: cpr for pty, Steve Sistare, 2021/07/06
- [PATCH V4 23/25] chardev: cpr for sockets, Steve Sistare, 2021/07/06
- [PATCH V4 25/25] simplify savevm, Steve Sistare, 2021/07/06
- [PATCH V4 24/25] cpr: only-cpr-capable option, Steve Sistare, 2021/07/06
- [PATCH V4 04/25] cpr: HMP interfaces for reboot, Steve Sistare, 2021/07/06
- [PATCH V4 16/25] vfio-pci: cpr part 1, Steve Sistare, 2021/07/06
- Re: [PATCH V4 00/25] Live Update, Marc-André Lureau, 2021/07/07