[PATCH QEMU 0/3] provide a smooth upgrade solution for multi-queues disk

~hyman posted 3 patches 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/169122184935.7839.16786323109706183366-0@git.sr.ht
Maintainers: Raphael Norwitz <raphael.norwitz@nutanix.com>, "Michael S. Tsirkin" <mst@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
hw/block/vhost-user-blk.c          |  1 +
hw/block/virtio-blk.c              |  1 +
hw/scsi/vhost-scsi.c               |  2 ++
hw/scsi/vhost-user-scsi.c          |  2 ++
hw/scsi/virtio-scsi.c              |  2 ++
hw/virtio/vhost-scsi-pci.c         | 11 +++++++++--
hw/virtio/vhost-user-blk-pci.c     |  9 ++++++++-
hw/virtio/vhost-user-scsi-pci.c    | 11 +++++++++--
hw/virtio/virtio-blk-pci.c         |  9 ++++++++-
hw/virtio/virtio-scsi-pci.c        | 11 +++++++++--
include/hw/virtio/vhost-user-blk.h |  5 +++++
include/hw/virtio/virtio-blk.h     |  5 +++++
include/hw/virtio/virtio-scsi.h    |  5 +++++
13 files changed, 66 insertions(+), 8 deletions(-)
[PATCH QEMU 0/3] provide a smooth upgrade solution for multi-queues disk
Posted by ~hyman 9 months ago
A 1:1 virtqueue:vCPU mapping implementation for virtio-*-pci disk
introduced since qemu >= 5.2.0, which improves IO performance
remarkably. To enjoy this feature for exiting running VMs without
service interruption, the common solution is to migrate VMs from the
lower version of the hypervisor to the upgraded hypervisor, then wait
for the next cold reboot of the VM to enable this feature. That's the
way "discard" and "write-zeroes" features work.

As to multi-queues disk allocation automatically, it's a little
different because the destination will allocate queues to match the
number of vCPUs automatically by default in the case of live migration,
and the VMs on the source side remain 1 queue by default, which results
in migration failure due to loading disk VMState incorrectly on the
destination side. This issue requires Qemu to provide a hint that shows
multi-queues disk allocation is automatically supported, and this allows
upper APPs, e.g., libvirt, to recognize the hypervisor's capability of
this. And upper APPs can ensure to allocate the same num-queues on the
destination side in case of migration failure.

To fix the issue, we introduce the auto-num-queues property for
virtio-*-pci as a solution, which would be probed by APPs, e.g., libvirt
by querying the device properties of QEMU. When launching live
migration, libvirt will send the auto-num-queues property as a migration
cookie to the destination, and thus the destination knows if the source
side supports auto-num-queues. If not, the destination would switch off
by building the command line with "auto-num-queues=off" when preparing
the incoming VM process. The following patches of libvirt show how it
roughly works:
https://github.com/newfriday/libvirt/commit/ce2bae2e1a6821afeb80756dc01f3680f525e506
https://github.com/newfriday/libvirt/commit/f546972b009458c88148fe079544db7e9e1f43c3
https://github.com/newfriday/libvirt/commit/5ee19c8646fdb4d87ab8b93f287c20925268ce83

The smooth upgrade solution requires the introduction of the auto-num-
queues property on the QEMU side, which is what the patch set does. I'm
hoping for comments about the series.

Please review, thanks.
Yong

Hyman Huang(黄勇) (3):
  virtio-scsi-pci: introduce auto-num-queues property
  virtio-blk-pci: introduce auto-num-queues property
  vhost-user-blk-pci: introduce auto-num-queues property

 hw/block/vhost-user-blk.c          |  1 +
 hw/block/virtio-blk.c              |  1 +
 hw/scsi/vhost-scsi.c               |  2 ++
 hw/scsi/vhost-user-scsi.c          |  2 ++
 hw/scsi/virtio-scsi.c              |  2 ++
 hw/virtio/vhost-scsi-pci.c         | 11 +++++++++--
 hw/virtio/vhost-user-blk-pci.c     |  9 ++++++++-
 hw/virtio/vhost-user-scsi-pci.c    | 11 +++++++++--
 hw/virtio/virtio-blk-pci.c         |  9 ++++++++-
 hw/virtio/virtio-scsi-pci.c        | 11 +++++++++--
 include/hw/virtio/vhost-user-blk.h |  5 +++++
 include/hw/virtio/virtio-blk.h     |  5 +++++
 include/hw/virtio/virtio-scsi.h    |  5 +++++
 13 files changed, 66 insertions(+), 8 deletions(-)

-- 
2.38.5