[PATCH v2 0/4] vhost-user-blk: fix compatibility with older qemu versions

Alexandr Moshkov posted 4 patches 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260311084728.751169-1-dtalexundeer@yandex-team.ru
Maintainers: "Gonglei (Arei)" <arei.gonglei@huawei.com>, zhenwei pi <zhenwei.pi@linux.dev>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Raphael Norwitz <rnorwitz@nvidia.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Jason Wang <jasowang@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>, "Alex Bennée" <alex.bennee@linaro.org>, Stefan Hajnoczi <stefanha@redhat.com>, Milan Zamazal <mzamazal@redhat.com>
There is a newer version of this series
backends/cryptodev-vhost.c     |  2 +-
backends/vhost-user.c          |  2 +-
docs/interop/vhost-user.rst    |  8 +++-----
hw/block/vhost-user-blk.c      | 32 +++++++++++++++++++++++++-------
hw/net/vhost_net.c             |  9 +++++----
hw/scsi/vhost-scsi-common.c    |  2 +-
hw/virtio/vdpa-dev.c           |  2 +-
hw/virtio/vhost-user-base.c    |  2 +-
hw/virtio/vhost-user-fs.c      |  2 +-
hw/virtio/vhost-user-scmi.c    |  2 +-
hw/virtio/vhost-user.c         |  3 +--
hw/virtio/vhost-vsock-common.c |  2 +-
hw/virtio/vhost.c              | 24 +++++++++++++++---------
include/hw/virtio/vhost-user.h |  1 -
include/hw/virtio/vhost.h      |  7 +++++--
15 files changed, 62 insertions(+), 38 deletions(-)
[PATCH v2 0/4] vhost-user-blk: fix compatibility with older qemu versions
Posted by Alexandr Moshkov 1 month ago
v1 -> v2:
- reorganize commits: make refactor commits first, then core semantic change
- add additional pre_save check for inflight migration possibility

---

This is a small continuation of my series about inflight migration for vhost-user-blk.

This series is designed to solve the problem of compatibility with older versions of qemu, where this feature has not yet been introduced (for example, if we want to downgrade versions due to some problems).

In the current version for vhost-user-blk, this feature is enabled using the parameter and further migration of the inflight region will depend on whether the vhost-user has accepted the new protocol feature or not. This creates an inconvenient dependency, because there is no way to disable this feature without reconnecting to the backend.
This series slightly changes the semantics of the introduced protocol feature VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT. Enabling this feature adds a new parameter for GET_VRING_BASE message - skip_drain, which allows to control drain in-flight requests on the backend.

Thus, user can enable or disable inflight-migration param for vhost-user-blk to maintain compatibility with older versions of QEMU.

Alexandr Moshkov (4):
  vhost-user.rst: fix typo
  vhost-user: add skip_drain param to do_vhost_virtqueue_stop
  vhost-user-blk: move inflight_needed higher
  vhost-user: add skip_drain param to GET_VRING_BASE

 backends/cryptodev-vhost.c     |  2 +-
 backends/vhost-user.c          |  2 +-
 docs/interop/vhost-user.rst    |  8 +++-----
 hw/block/vhost-user-blk.c      | 32 +++++++++++++++++++++++++-------
 hw/net/vhost_net.c             |  9 +++++----
 hw/scsi/vhost-scsi-common.c    |  2 +-
 hw/virtio/vdpa-dev.c           |  2 +-
 hw/virtio/vhost-user-base.c    |  2 +-
 hw/virtio/vhost-user-fs.c      |  2 +-
 hw/virtio/vhost-user-scmi.c    |  2 +-
 hw/virtio/vhost-user.c         |  3 +--
 hw/virtio/vhost-vsock-common.c |  2 +-
 hw/virtio/vhost.c              | 24 +++++++++++++++---------
 include/hw/virtio/vhost-user.h |  1 -
 include/hw/virtio/vhost.h      |  7 +++++--
 15 files changed, 62 insertions(+), 38 deletions(-)

-- 
2.34.1
Re: [PATCH v2 0/4] vhost-user-blk: fix compatibility with older qemu versions
Posted by Stefan Hajnoczi 2 weeks, 2 days ago
On Wed, Mar 11, 2026 at 01:47:24PM +0500, Alexandr Moshkov wrote:
> v1 -> v2:
> - reorganize commits: make refactor commits first, then core semantic change
> - add additional pre_save check for inflight migration possibility
> 
> ---
> 
> This is a small continuation of my series about inflight migration for vhost-user-blk.
> 
> This series is designed to solve the problem of compatibility with older versions of qemu, where this feature has not yet been introduced (for example, if we want to downgrade versions due to some problems).
> 
> In the current version for vhost-user-blk, this feature is enabled using the parameter and further migration of the inflight region will depend on whether the vhost-user has accepted the new protocol feature or not. This creates an inconvenient dependency, because there is no way to disable this feature without reconnecting to the backend.
> This series slightly changes the semantics of the introduced protocol feature VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT. Enabling this feature adds a new parameter for GET_VRING_BASE message - skip_drain, which allows to control drain in-flight requests on the backend.
> 
> Thus, user can enable or disable inflight-migration param for vhost-user-blk to maintain compatibility with older versions of QEMU.

Can you describe what the user needs to do in more detail?

While the patch series introduces a way to tell the vhost-user back-end
whether or not to use inflight migration at runtime, I don't see a way
for the user to enable/disable inflight migration at runtime in QEMU. So
how does the user migrate back to an old QEMU if the current VM was
launched with inflight-migration=on?

Stefan
Re: [PATCH v2 0/4] vhost-user-blk: fix compatibility with older qemu versions
Posted by Alexandr Moshkov 2 weeks, 1 day ago
On 3/26/26 20:55, Stefan Hajnoczi wrote:
> On Wed, Mar 11, 2026 at 01:47:24PM +0500, Alexandr Moshkov wrote:
>> v1 -> v2:
>> - reorganize commits: make refactor commits first, then core semantic change
>> - add additional pre_save check for inflight migration possibility
>>
>> ---
>>
>> This is a small continuation of my series about inflight migration for vhost-user-blk.
>>
>> This series is designed to solve the problem of compatibility with older versions of qemu, where this feature has not yet been introduced (for example, if we want to downgrade versions due to some problems).
>>
>> In the current version for vhost-user-blk, this feature is enabled using the parameter and further migration of the inflight region will depend on whether the vhost-user has accepted the new protocol feature or not. This creates an inconvenient dependency, because there is no way to disable this feature without reconnecting to the backend.
>> This series slightly changes the semantics of the introduced protocol feature VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT. Enabling this feature adds a new parameter for GET_VRING_BASE message - skip_drain, which allows to control drain in-flight requests on the backend.
>>
>> Thus, user can enable or disable inflight-migration param for vhost-user-blk to maintain compatibility with older versions of QEMU.
> Can you describe what the user needs to do in more detail?
>
> While the patch series introduces a way to tell the vhost-user back-end
> whether or not to use inflight migration at runtime, I don't see a way
> for the user to enable/disable inflight migration at runtime in QEMU. So
> how does the user migrate back to an old QEMU if the current VM was
> launched with inflight-migration=on?
>
> Stefan

The idea was that the inflight-migration parameter can be turned off in 
runtime via qom-set. Thiswill setthe 
parameterskip_drain=falseinvhost_user_blk_stop(),thenGET_VRING_BASEwill 
be sentwiththe parametersetto 0,andthe backendserver 
willoperateaccordingto the oldscenario(waitfor the drain).

However, Ihave nowdiscoveredthatI cannotsetthe parameterdueto:

```
{'error': {'class': 'GenericError', 'desc': "Attempt to set property 
'inflight-migration' on anonymous device (type 'vhost-user-blk') after 
it was realized"}}
```
So, I'll fix that too :)
Re: [PATCH v2 0/4] vhost-user-blk: fix compatibility with older qemu versions
Posted by Alexandr Moshkov 2 weeks, 5 days ago
Ping)

On 3/11/26 13:47, Alexandr Moshkov wrote:
> v1 -> v2:
> - reorganize commits: make refactor commits first, then core semantic change
> - add additional pre_save check for inflight migration possibility
>
> ---
>
> This is a small continuation of my series about inflight migration for vhost-user-blk.
>
> This series is designed to solve the problem of compatibility with older versions of qemu, where this feature has not yet been introduced (for example, if we want to downgrade versions due to some problems).
>
> In the current version for vhost-user-blk, this feature is enabled using the parameter and further migration of the inflight region will depend on whether the vhost-user has accepted the new protocol feature or not. This creates an inconvenient dependency, because there is no way to disable this feature without reconnecting to the backend.
> This series slightly changes the semantics of the introduced protocol feature VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT. Enabling this feature adds a new parameter for GET_VRING_BASE message - skip_drain, which allows to control drain in-flight requests on the backend.
>
> Thus, user can enable or disable inflight-migration param for vhost-user-blk to maintain compatibility with older versions of QEMU.
>
> Alexandr Moshkov (4):
>    vhost-user.rst: fix typo
>    vhost-user: add skip_drain param to do_vhost_virtqueue_stop
>    vhost-user-blk: move inflight_needed higher
>    vhost-user: add skip_drain param to GET_VRING_BASE
>
>   backends/cryptodev-vhost.c     |  2 +-
>   backends/vhost-user.c          |  2 +-
>   docs/interop/vhost-user.rst    |  8 +++-----
>   hw/block/vhost-user-blk.c      | 32 +++++++++++++++++++++++++-------
>   hw/net/vhost_net.c             |  9 +++++----
>   hw/scsi/vhost-scsi-common.c    |  2 +-
>   hw/virtio/vdpa-dev.c           |  2 +-
>   hw/virtio/vhost-user-base.c    |  2 +-
>   hw/virtio/vhost-user-fs.c      |  2 +-
>   hw/virtio/vhost-user-scmi.c    |  2 +-
>   hw/virtio/vhost-user.c         |  3 +--
>   hw/virtio/vhost-vsock-common.c |  2 +-
>   hw/virtio/vhost.c              | 24 +++++++++++++++---------
>   include/hw/virtio/vhost-user.h |  1 -
>   include/hw/virtio/vhost.h      |  7 +++++--
>   15 files changed, 62 insertions(+), 38 deletions(-)
>