Michael, On Fri, Feb 8, 2019 at 12:34 PM Marc-André Lureau <marcandre.lur...@redhat.com> wrote: > > 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.
Could you look at that proposal? thanks > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > 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 289dbd9e6d..7fa52d2f47 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 2ea1e50ab7..58b1684156 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 > > -- Marc-André Lureau