[PATCH 0/5] migration/cpr: support vhost-vsock devices

Andrey Drobyshev posted 5 patches 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260612165110.431376-1-andrey.drobyshev@virtuozzo.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
There is a newer version of this series
hw/virtio/vhost-backend.c         |  6 ++
hw/virtio/vhost-vsock-pci.c       |  5 --
hw/virtio/vhost-vsock.c           | 42 ++++++++++++--
hw/virtio/vhost.c                 | 33 +++++++++++
include/hw/virtio/vhost-backend.h |  1 +
include/hw/virtio/vhost-vsock.h   |  6 ++
include/hw/virtio/vhost.h         |  1 +
migration/migration.c             | 96 ++++++++++++++++++++++++-------
8 files changed, 157 insertions(+), 33 deletions(-)
[PATCH 0/5] migration/cpr: support vhost-vsock devices
Posted by Andrey Drobyshev 1 month, 1 week ago
Host<-->guest connections via vsock sockets aren't yet supported for
live update / CPR-style migration.  This series adds such support.

It's based on the vhost-related basis submitted earlier by Steve, Ben
and Mark at [0].  Patches 1-3 are rework of this submission, adjusted to
the latest master branch and with respect to Fabiano's review comments.

Essentially we want the host<-->guest connection to survive the CPR
migration.  For that to happen, we preserve the vhost FD and issue
VHOST_RESET_OWNER ioctl on the source side before the VHOST_SET_OWNER is
issued on the target.

VHOST_RESET_OWNER is currently not supported by the Linux vsock driver.
We've implemented this support and there's a kernel series complementary
to this one.

I've tested this (patched QEMU + patched kernel) approximately as follows:

  * Run listener in the guest:
  socat -u VSOCK-LISTEN:9999 - >/tmp/recv.bin

  * Run data transfer from host to guest:
  socat -u FILE:/root/bigfile.bin VSOCK-CONNECT:CID:9999

  * Perform CPR migration during transfer (either cpr-exec or cpr-transfer)
  * Check that file hash sum matches

[0] https://lore.kernel.org/qemu-devel/20260128-cpr-tap-v4-0-48e334d4216b@akamai.com

Andrey Drobyshev (5):
  migration: emit SETUP notification before CPR
  migration: stop VM earlier for CPR
  vhost: reset vhost devices for CPR
  vhost-vsock: preserve vhost FD during CPR
  vhost-vsock: don't reset connections during CPR

 hw/virtio/vhost-backend.c         |  6 ++
 hw/virtio/vhost-vsock-pci.c       |  5 --
 hw/virtio/vhost-vsock.c           | 42 ++++++++++++--
 hw/virtio/vhost.c                 | 33 +++++++++++
 include/hw/virtio/vhost-backend.h |  1 +
 include/hw/virtio/vhost-vsock.h   |  6 ++
 include/hw/virtio/vhost.h         |  1 +
 migration/migration.c             | 96 ++++++++++++++++++++++++-------
 8 files changed, 157 insertions(+), 33 deletions(-)

-- 
2.47.1
Re: [PATCH 0/5] migration/cpr: support vhost-vsock devices
Posted by Maciej S. Szmigiero 1 month ago
On 12.06.2026 18:51, Andrey Drobyshev wrote:
> Host<-->guest connections via vsock sockets aren't yet supported for
> live update / CPR-style migration.  This series adds such support.
> 
> It's based on the vhost-related basis submitted earlier by Steve, Ben
> and Mark at [0].  Patches 1-3 are rework of this submission, adjusted to
> the latest master branch and with respect to Fabiano's review comments.
> 
> Essentially we want the host<-->guest connection to survive the CPR
> migration.  For that to happen, we preserve the vhost FD and issue
> VHOST_RESET_OWNER ioctl on the source side before the VHOST_SET_OWNER is
> issued on the target.
> 
> VHOST_RESET_OWNER is currently not supported by the Linux vsock driver.
> We've implemented this support and there's a kernel series complementary
> to this one.

I think we normally wait with merging QEMU support for a proposed kernel
feature until that feature is actually in kernel.

Thanks,
Maciej
Re: [PATCH 0/5] migration/cpr: support vhost-vsock devices
Posted by Andrey Drobyshev 1 month, 1 week ago
On 6/12/26 7:51 PM, Andrey Drobyshev wrote:
> Host<-->guest connections via vsock sockets aren't yet supported for
> live update / CPR-style migration.  This series adds such support.
> 
> It's based on the vhost-related basis submitted earlier by Steve, Ben
> and Mark at [0].  Patches 1-3 are rework of this submission, adjusted to
> the latest master branch and with respect to Fabiano's review comments.
> 
> Essentially we want the host<-->guest connection to survive the CPR
> migration.  For that to happen, we preserve the vhost FD and issue
> VHOST_RESET_OWNER ioctl on the source side before the VHOST_SET_OWNER is
> issued on the target.
> 
> VHOST_RESET_OWNER is currently not supported by the Linux vsock driver.
> We've implemented this support and there's a kernel series complementary
> to this one.
>
> [...]
>
Here's the complementary kernel series adding support for VHOST_RESET_OWNER:

https://lore.kernel.org/virtualization/20260612165718.433546-1-andrey.drobyshev@virtuozzo.com