[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 12/12] RFC: add explicit can_migrate to vhost_use
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v2 12/12] RFC: add explicit can_migrate to vhost_user_backend_dev_init() |
Date: |
Thu, 7 Feb 2019 17:54:49 +0100 |
In general, there is not much support for migrating a vhost-user slave
process. Many virtio devices however implement vmsd, and the
vhost-user instances (as child objects) may be migrated.
Since there is no other support at this point, the slave is assumed to
be state less (outside of VM state), or using a migration method
outside of qemu migration stream.
Since this is not well specified, add a common blocker for the
VhostUserBackend users (vhost-user-input and upcoming gpu will use
it).
RFC since I am not sure that's what Michael had in mind when
requesting such blocker.
Signed-off-by: Marc-André Lureau <address@hidden>
---
include/sysemu/vhost-user-backend.h | 2 +-
backends/vhost-user.c | 7 ++++++-
hw/input/vhost-user-input.c | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/sysemu/vhost-user-backend.h
b/include/sysemu/vhost-user-backend.h
index 60f811cae7..feb331288f 100644
--- a/include/sysemu/vhost-user-backend.h
+++ b/include/sysemu/vhost-user-backend.h
@@ -53,7 +53,7 @@ struct VhostUserBackend {
};
int vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,
- unsigned nvqs, Error **errp);
+ unsigned nvqs, bool can_migrate, Error **errp);
void vhost_user_backend_start(VhostUserBackend *b);
void vhost_user_backend_stop(VhostUserBackend *b);
diff --git a/backends/vhost-user.c b/backends/vhost-user.c
index bf39c0751d..4e0af8952a 100644
--- a/backends/vhost-user.c
+++ b/backends/vhost-user.c
@@ -30,7 +30,7 @@ ioeventfd_enabled(void)
int
vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,
- unsigned nvqs, Error **errp)
+ unsigned nvqs, bool can_migrate, Error **errp)
{
int ret;
@@ -49,6 +49,11 @@ vhost_user_backend_dev_init(VhostUserBackend *b,
VirtIODevice *vdev,
b->dev.nvqs = nvqs;
b->dev.vqs = g_new(struct vhost_virtqueue, nvqs);
+ if (!can_migrate && !b->dev.migration_blocker) {
+ error_setg(&b->dev.migration_blocker,
+ "Migration disabled: vhost-user device can't migrate");
+ }
+
ret = vhost_dev_init(&b->dev, &b->vhost_user, VHOST_BACKEND_TYPE_USER, 0);
if (ret < 0) {
error_setg_errno(errp, -ret, "vhost initialization failed");
diff --git a/hw/input/vhost-user-input.c b/hw/input/vhost-user-input.c
index ef1b23a8b2..360a2ff618 100644
--- a/hw/input/vhost-user-input.c
+++ b/hw/input/vhost-user-input.c
@@ -24,7 +24,7 @@ static void vhost_input_realize(DeviceState *dev, Error
**errp)
return;
}
- if (vhost_user_backend_dev_init(vhi->vhost, vdev, 2, errp) == -1) {
+ if (vhost_user_backend_dev_init(vhi->vhost, vdev, 2, false, errp) == -1) {
return;
}
--
2.20.1.519.g8feddda32c
- Re: [Qemu-devel] [PATCH v2 05/12] Add vhost-user-backend, (continued)
[Qemu-devel] [PATCH v2 06/12] vhost-user: split vhost_user_read(), Marc-André Lureau, 2019/02/07
[Qemu-devel] [PATCH v2 07/12] vhost-user: add vhost_user_input_get_config(), Marc-André Lureau, 2019/02/07
[Qemu-devel] [PATCH v2 09/12] libvhost-user: add vu_queue_unpop(), Marc-André Lureau, 2019/02/07
[Qemu-devel] [PATCH v2 08/12] libvhost-user-glib: export vug_source_new(), Marc-André Lureau, 2019/02/07
[Qemu-devel] [PATCH v2 10/12] Add vhost-user-input-pci, Marc-André Lureau, 2019/02/07
[Qemu-devel] [PATCH v2 11/12] contrib: add vhost-user-input, Marc-André Lureau, 2019/02/07
[Qemu-devel] [PATCH v2 12/12] RFC: add explicit can_migrate to vhost_user_backend_dev_init(),
Marc-André Lureau <=