All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [QEMU HCI-8.0 PATCH v2 00/13] usb-host: support CPR migration
@ 2026-09-04 19:04 Andrey Drobyshev
  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
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 19:04 UTC (permalink / raw)
  To: svt-core; +Cc: andrey.drobyshev, den

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-09-04 19:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 19:04 [QEMU HCI-8.0 PATCH v2 00/13] usb-host: support CPR migration Andrey Drobyshev
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.