Bug 871839 - qemu-kvm: assertion failed in vmstate_register_with_alias_id()
Summary: qemu-kvm: assertion failed in vmstate_register_with_alias_id()
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 17
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-31 14:10 UTC by Andrew
Modified: 2013-04-05 10:49 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-02 13:58:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
crash backtrace (5.07 KB, text/plain)
2012-10-31 14:10 UTC, Andrew
no flags Details

Description Andrew 2012-10-31 14:10:56 UTC
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:
http://www.kraxel.org/cgit/qemu/tree/docs/usb2.txt

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:
kernel-3.6.3-1.fc17.x86_64
qemu-kvm-1.0.1-2.fc17.x86_64

Comment 1 Cole Robinson 2013-04-01 22:30:45 UTC
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 10:17:29 UTC
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 13:58:43 UTC
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 2013-04-04 16:43:16 UTC
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.

  Command:

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


  Device:

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
qemu-kvm-1.2.2-6.fc18.x86_64

Comment 5 Gerd Hoffmann 2013-04-05 07:45:47 UTC
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 2013-04-05 10:49:31 UTC
(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.


Note You need to log in before you can comment on or make changes to this bug.