Re: [PATCH v5 5/5] vhost-user-blk: support inter-host inflight migration

Stefan Hajnoczi <[email protected]> Mon, 12 Jan 2026 13:19:17 -0500
Newsgroups dev.linux.lists.virtio-fs,org.nongnu.qemu-devel
Message-ID <20260112181917.GE462084@fedora>
On Mon, Jan 12, 2026 at 04:45:03PM +0500, Alexandr Moshkov wrote:
> During inter-host migration, waiting for disk requests to be drained
> in the vhost-user backend can incur significant downtime.
> 
> This can be avoided if QEMU migrates the inflight region in
> vhost-user-blk.
> Thus, during the qemu migration, with feature flag the vhost-user
> back-end can immediately stop vrings, so all in-flight requests will be
> migrated to another host.
> 
> Signed-off-by: Alexandr Moshkov <[email protected]>
> ---
>  hw/block/vhost-user-blk.c          | 28 ++++++++++++++++++++++++++++
>  include/hw/virtio/vhost-user-blk.h |  1 +
>  2 files changed, 29 insertions(+)
> 
> diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
> index a8fd90480a..5e44f6253c 100644
> --- a/hw/block/vhost-user-blk.c
> +++ b/hw/block/vhost-user-blk.c
> @@ -656,6 +656,28 @@ static struct vhost_dev *vhost_user_blk_get_vhost(VirtIODevice *vdev)
>      return &s->dev;
>  }
>  
> +static bool vhost_user_blk_inflight_needed(void *opaque)
> +{
> +    struct VHostUserBlk *s = opaque;
> +
> +    bool inflight_drain = vhost_dev_has_feature(&s->dev,
> +                        VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT);

VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT must only be negotiated
when inflight_migration is enabled. Otherwise the backend will use this
feature even though vhost_user_blk_inflight_needed() skips migrating the
in-flight region.
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmllOyUACgkQnKSrs4Gr
c8iujgf/bxbvIfcN+xw9Nboe/6p2dan4K/fTivT0186Z4jMVtyKtHH0h1MzBXzaW
+iNjZKslKLxgcMQiebhXCegC4skgot+yo7edZTR6les1wyDkWWonJ0IOEjTfW1w+
YweITzu8T/IEsgKA4fTiDnLU8oiqGgyTOEZSr4NmpisYh3ia6XvmQCa7MlrJT5tu
3b6eKEcOzKWQa69f3zapszsZ+r6mY2CRUq7i5h4fagt8qrZ9dqBPDC4GTVLcfHuJ
fneyGw6jZe6zA082AHzB5dslFLvH+kH1M1NmYYsq5VSBMja64HufJQHfFAj4W3KZ
vv03Gua765Zz5BInylMhvaRDG351cQ==
=Sllm
-----END PGP SIGNATURE-----