[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V2 13/22] vhost: reset vhost devices upon cprsave
From: |
Steve Sistare |
Subject: |
[PATCH V2 13/22] vhost: reset vhost devices upon cprsave |
Date: |
Tue, 5 Jan 2021 07:42:01 -0800 |
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 1a1384e..42aa44c 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1764,6 +1764,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 767a95e..5fef8bd 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -105,6 +105,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 045ebc5..13c5d7c 100644
--- a/migration/cpr.c
+++ b/migration/cpr.c
@@ -135,6 +135,7 @@ void cprsave(const char *file, CprMode mode, Error **errp)
goto err;
}
walkenv(FD_PREFIX, preserve_fd, 0);
+ vhost_dev_reset_all();
setenv("QEMU_START_FREEZE", "", 1);
qemu_system_exec_request();
}
--
1.8.3.1
- [PATCH V2 18/22] chardev: cpr for sockets, (continued)
- [PATCH V2 18/22] chardev: cpr for sockets, Steve Sistare, 2021/01/05
- [PATCH V2 19/22] monitor: cpr support, Steve Sistare, 2021/01/05
- [PATCH V2 17/22] chardev: socket accept subroutine, Steve Sistare, 2021/01/05
- [PATCH V2 20/22] cpr: only-cpr-capable option, Steve Sistare, 2021/01/05
- [PATCH V2 22/22] simplify savevm, Steve Sistare, 2021/01/05
- [PATCH V2 14/22] chardev: cpr framework, Steve Sistare, 2021/01/05
- [PATCH V2 21/22] cpr: maintainers, Steve Sistare, 2021/01/05
- [PATCH V2 02/22] qemu_ram_volatile, Steve Sistare, 2021/01/05
- [PATCH V2 13/22] vhost: reset vhost devices upon cprsave,
Steve Sistare <=
- [PATCH V2 01/22] as_flat_walk, Steve Sistare, 2021/01/05
- [PATCH V2 11/22] vfio-pci: refactor for cpr, Steve Sistare, 2021/01/05
- [PATCH V2 15/22] chardev: cpr for simple devices, Steve Sistare, 2021/01/05