[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V7 23/29] vhost: reset vhost devices for cpr
From: |
Steve Sistare |
Subject: |
[PATCH V7 23/29] vhost: reset vhost devices for cpr |
Date: |
Wed, 22 Dec 2021 11:05:28 -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 | 2 ++
3 files changed, 14 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 20913cf..35d0836 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1853,6 +1853,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 58a73e7..d436eba 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -114,6 +114,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 cee82cf..4229c17 100644
--- a/migration/cpr.c
+++ b/migration/cpr.c
@@ -8,6 +8,7 @@
#include "qemu/osdep.h"
#include "exec/memory.h"
#include "hw/vfio/vfio-common.h"
+#include "hw/virtio/vhost.h"
#include "io/channel-buffer.h"
#include "io/channel-file.h"
#include "migration.h"
@@ -109,6 +110,7 @@ void qmp_cpr_exec(strList *args, Error **errp)
if (cpr_state_save(errp)) {
return;
}
+ vhost_dev_reset_all();
qemu_system_exec_request(args);
}
--
1.8.3.1
- [PATCH V7 19/29] vfio-pci: cpr part 1 (fd and dma), (continued)
- [PATCH V7 19/29] vfio-pci: cpr part 1 (fd and dma), Steve Sistare, 2021/12/22
- [PATCH V7 16/29] hostmem-memfd: cpr for memory-backend-memfd, Steve Sistare, 2021/12/22
- [PATCH V7 14/29] cpr: restart mode, Steve Sistare, 2021/12/22
- [PATCH V7 18/29] vfio-pci: refactor for cpr, Steve Sistare, 2021/12/22
- [PATCH V7 25/29] chardev: cpr framework, Steve Sistare, 2021/12/22
- [PATCH V7 26/29] chardev: cpr for simple devices, Steve Sistare, 2021/12/22
- [PATCH V7 29/29] cpr: only-cpr-capable option, Steve Sistare, 2021/12/22
- [PATCH V7 21/29] vfio-pci: cpr part 3 (intx), Steve Sistare, 2021/12/22
- [PATCH V7 22/29] vfio-pci: recover from unmap-all-vaddr failure, Steve Sistare, 2021/12/22
- [PATCH V7 24/29] loader: suppress rom_reset during cpr, Steve Sistare, 2021/12/22
- [PATCH V7 23/29] vhost: reset vhost devices for cpr,
Steve Sistare <=
- [PATCH V7 27/29] chardev: cpr for pty, Steve Sistare, 2021/12/22
- [PATCH V7 10/29] machine: memfd-alloc option, Steve Sistare, 2021/12/22
- [PATCH V7 08/29] memory: flat section iterator, Steve Sistare, 2021/12/22
- [PATCH V7 28/29] chardev: cpr for sockets, Steve Sistare, 2021/12/22