From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
To: svt-core@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org
Subject: [QEMU HCI-8.0 PATCH v2 00/13] usb-host: support CPR migration
Date: Fri, 4 Sep 2026 22:04:30 +0300 [thread overview]
Message-ID: <20260904190443.795902-1-andrey.drobyshev@virtuozzo.com> (raw)
Significant rework from v1, adding cpr-transfer support, as well as
support for ISO devices.
Tested in L2 VM. I.e. L1 VM is launched with a bunch of emulated usb
devices, which are later passed to L2 VM using usb-host driver.
Namely, for L1:
1. USB disk (USB_ENDPOINT_XFER_CONTROL + USB_ENDPOINT_XFER_BULK):
<disk type='file' device='disk' model='usb-storage'>
<driver name='qemu' type='raw'/>
<source file='/vz/usbdrive.img'/>
<backingStore/>
<target dev='sdu' bus='usb' removable='on'/>
<address type='usb' bus='0' port='1'/>
</disk>
2. CCID smartcard (USB_ENDPOINT_XFER_CONTROL + USB_ENDPOINT_XFER_BULK +
USB_ENDPOINT_XFER_INT):
<smartcard mode='host-certificates'>
<certificate>cert1</certificate>
<certificate>cert2</certificate>
<certificate>cert3</certificate>
<database>/vz/pki</database>
<address type='ccid' controller='0' slot='0'/>
</smartcard>
3. USB sound card (USB_ENDPOINT_XFER_CONTROL + USB_ENDPOINT_XFER_ISOC):
<sound model='usb'>
<address type='usb' bus='0' port='3'/>
</sound>
Then in L1:
# lsusb
...
Bus 001 Device 002: ID 08e6:4433 Gemalto (was Gemplus) GemPC433-Swap
Bus 001 Device 003: ID 46f4:0002 QEMU QEMU USB Audio
Bus 002 Device 002: ID 46f4:0001 QEMU QEMU USB HARDDRIVE
And then when launching L2 VM:
Disk:
-device qemu-xhci,id=xhci \
-device usb-host,hostdevice=/dev/bus/usb/002/002,id=hostdev0,bus=xhci.0
Smartcard:
-device qemu-xhci,id=xhci \
-device usb-host,hostdevice=/dev/bus/usb/001/002,id=hostdev1,bus=xhci.0
Sound card:
-device qemu-xhci,id=xhci \
-device usb-host,hostdevice=/dev/bus/usb/001/003,id=hostdev2,bus=xhci.0
Finally, each device was under load during multiple consecutive CPR
requests. That's how they were stress-tested approximately:
Disk:
dd if=/root/pat of=/dev/sda bs=1M count=4 oflag=direct conv=fsync
dd if=/dev/sda of=/root/back bs=1M count=4 iflag=direct
cmp /root/pat /root/back
Card (power the card, read its ATR over CCID, byte-compare):
opensc-tool -a | tr -d ' :' | grep -q <PREDEFINED KEY>
Audio:
aplay -D hw:0,0 -f S16_LE -r 48000 -c 2 -t raw /dev/zero
# check that hw_ptr is advancing in /proc/asound/card0/pcm0p/sub0/status
Stress-testing was also performed under ASan + UBsan.
Andrey Drobyshev (13):
migration/cpr: fix use-after-free in cpr_delete_fd()
usb-host: don't leak hostdev FD on open failure #VSTOR-137800
usb-host: add migration blocker for CPR modes #VSTOR-137800
usb-host: preserve hostdev FD during CPR migration #VSTOR-137800
usb-host: factor out usb_host_reap_xfers() #VSTOR-137800
usb-host: drain in-flight URBs across CPR #VSTOR-137800
usb-host: re-issue drained URBs if CPR is aborted #VSTOR-137800
usb-host: skip product-string read on CPR incoming #VSTOR-137800
usb-host: hand off the device across cpr-transfer #VSTOR-137800
usb: migrate the interface altsetting #VSTOR-137800
usb-host: reconfigure endpoints on CPR incoming #VSTOR-137800
hcd-xhci: resync isochronous endpoints after CPR #VSTOR-137800
usb-host: make CPR migration blocker conditional #VSTOR-137800
hw/usb/bus.c | 36 +++++
hw/usb/hcd-xhci.c | 18 +++
hw/usb/host-libusb.c | 375 +++++++++++++++++++++++++++++++++++++++++--
migration/cpr.c | 3 +-
4 files changed, 418 insertions(+), 14 deletions(-)
--
2.47.1
next reply other threads:[~2026-09-04 19:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 19:04 Andrey Drobyshev [this message]
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 01/13] migration/cpr: fix use-after-free in cpr_delete_fd() Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 02/13] usb-host: don't leak hostdev FD on open failure #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 03/13] usb-host: add migration blocker for CPR modes #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 04/13] usb-host: preserve hostdev FD during CPR migration #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 05/13] usb-host: factor out usb_host_reap_xfers() #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 06/13] usb-host: drain in-flight URBs across CPR #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 07/13] usb-host: re-issue drained URBs if CPR is aborted #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 08/13] usb-host: skip product-string read on CPR incoming #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 09/13] usb-host: hand off the device across cpr-transfer #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 10/13] usb: migrate the interface altsetting #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 11/13] usb-host: reconfigure endpoints on CPR incoming #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 12/13] hcd-xhci: resync isochronous endpoints after CPR #VSTOR-137800 Andrey Drobyshev
2026-09-04 19:04 ` [QEMU HCI-8.0 PATCH v2 13/13] usb-host: make CPR migration blocker conditional #VSTOR-137800 Andrey Drobyshev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260904190443.795902-1-andrey.drobyshev@virtuozzo.com \
--to=andrey.drobyshev@virtuozzo.com \
--cc=den@openvz.org \
--cc=svt-core@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox