Bug 871839

Summary: qemu-kvm: assertion failed in vmstate_register_with_alias_id()
Product: [Fedora] Fedora Reporter: Andrew Travneff <travneff>
Component: qemuAssignee: Fedora Virtualization Maintainers <virt-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: amit.shah, berrange, cfergeau, crobinso, dwmw2, itamar, knoel, kraxel, pbonzini, rjones, scottt.tw, travneff, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-02 09:58:43 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
crash backtrace none

Description Andrew Travneff 2012-10-31 10:10:56 EDT
Created attachment 636143 [details]
crash backtrace

qemu-kvm died when launched with following cmdline:

# qemu-kvm -M pc -enable-kvm -m 768 -boot c -hda /dev/sdb -smp 2 -sdl -net none \
  -usb                                              \
  -device usb-ehci,id=ehci                          \
  -device usb-host,bus=usb.0,hostbus=1,hostport=3   \
  -device usb-host,bus=ehci.0,hostbus=2,hostport=3

*** EHCI support is under development ***
qemu-kvm: savevm.c:1300: vmstate_register_with_alias_id: Assertion `!se->compat || se->instance_id == 0' failed.

I'm trying to pass USB device by physical port as described here:

The crash is absent if qemu is launched without usb.0 device. However, the target isn't reached too--passed device is absent in guest with no errors except ehci development state warning.

SW versions:
Comment 1 Cole Robinson 2013-04-01 18:30:45 EDT
Hmm, I think that example from the docs is wrong. -device usb-ehci doesn't appear to set up usb.0 bus, just ehci.0. Granted that assertion is ugly, but upstream qemu.git has a nicer error:

qemu-system-x86_64: -device usb-host,bus=usb.0,hostbus=1,hostport=3: Bus 'usb.0' not found

Gerd, what's missing here?
Comment 2 Gerd Hoffmann 2013-04-02 06:17:29 EDT
Indeed, the default usb bus name was changed from 'usb.0' to 'usb-bus.0' at some point, and the docs where not updated accordingly.  I'll send a patch upstream to update the docs.
Comment 3 Cole Robinson 2013-04-02 09:58:43 EDT
Thanks Gerd.

While the assertion isn't exactly friendly, it isn't a big deal for F17, so just closing as UPSTREAM where the docs will soon be fixed.
Comment 4 Andrew Travneff 2013-04-04 12:43:16 EDT
Just in case, I replaced 'usb.0' to 'usb-bus.0' and now qemu launches fine, but the passed device still isn't passed to guest. Just two root hubs (1.1 and 2.0) are present there.


qemu-kvm -M pc -enable-kvm -m 768 -boot d -cdrom /mnt/sw/pmagic.iso -smp 2 -sdl -net none \
  -usb                                              \
  -device usb-ehci,id=ehci                          \
  -device usb-host,bus=usb-bus.0,hostbus=1,hostport=2   \
  -device usb-host,bus=ehci.0,hostbus=2,hostport=2


T:  Bus=02 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 17 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=8564 ProdID=1000 Rev= 1.00
S:  Manufacturer=JetFlash
S:  Product=Mass Storage Device
S:  SerialNumber=LWN98399
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

  Topology as shown by usbview:

EHCI host controller -> high-speed hub -> device

  USB controllers:

$ lspci -nn | grep USB
00:1a.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 [8086:1c2d] (rev 04)
00:1d.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 [8086:1c26] (rev 04)

  SW versions:
kernel 3.8.5-201.fc18.x86_64
Comment 5 Gerd Hoffmann 2013-04-05 03:45:47 EDT
hostport=2 is probably the hub not the device.  What does 'info usbhost' (qemu monitor) print?  Or 'lsusb -t' on the host?
Comment 6 Andrew Travneff 2013-04-05 06:49:31 EDT
(In reply to comment #5)
Thanks for the hint! I've tried to specify the hub previously (like hostport=1.2), but haven't succeeded. Now seems like the problem was the wrong port number: I used hostport=2 ('Port=02' from /sys/kernel/debug/usb/devices) but 'lsusb -t' shows number 3 for the same device ('Port 3: Dev 14, If 0, Class=Mass Storage, Driver=usbfs, 480M').

Summarizing, device appeared in the guest with 'hostport=1.3'.

Both the topology and port numbering points are good things to mention in the doc too, as for me.