Bug 1006894 - Inconsistent behavior while autoassigning usb ports
Summary: Inconsistent behavior while autoassigning usb ports
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-11 13:16 UTC by Lukáš Doktor
Modified: 2014-06-16 12:02 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-04 09:06:30 UTC
Type: Bug


Attachments (Terms of Use)

Description Lukáš Doktor 2013-09-11 13:16:05 UTC
Description of problem:
Hi guys, I found another inconsistency, which confuses me. When I add usb-bus and than plug some devices into this bus without specifying port it assigns them incrementally (1, 2, 3, 4, 5, ...). Anyway when I remove the device and than try to add them again, it assigns them in the different manner. (from what I've seen it's the opposite order of the removed devices).

I'd like to ask if this is something we intend to unify or if I should just always assign port and not trust qemu to do it incrementally?

Version-Release number of selected component (if applicable):
qemu-kvm-1.4.2-7.fc19.x86_64


How reproducible:
Always


Steps to Reproduce (UHCI):
1. echo -e "device_add usb-tablet,bus=uhci.0,id=aa\ndevice_add usb-tablet,bus=uhci.0,id=bb,port=2\ndevice_del aa\ndevice_del bb\ndevice_add usb-tablet,bus=uhci.0,id=aa\ndevice_add usb-tablet,bus=uhci.0,id=bb,port=2" | qemu-kvm -nodefaults -monitor stdio     -device ich9-usb-uhci1,id=uhci
2. echo -e "device_add usb-tablet,bus=uhci.0,id=aa\ndevice_add usb-tablet,bus=uhci.0,id=bb,port=2\ndevice_del bb\ndevice_del aa\ndevice_add usb-tablet,bus=uhci.0,id=aa\ndevice_add usb-tablet,bus=uhci.0,id=bb,port=2" | qemu-kvm -nodefaults -monitor stdio     -device ich9-usb-uhci1,id=uhci


Actual results:
Step 1 passes (adds 2 devices, removes them and add them again in the same order)
Step 2 fails (adds 2 devices, removes them and while adding them again it assigns the last port first)


Steps to Reproduce (EHCI):
1. echo -e "device_add usb-tablet,bus=ehci.0,id=aa\ndevice_add usb-tablet,bus=ehci.0,id=bb\ndevice_add usb-tablet,bus=ehci.0,id=cc\ndevice_add usb-tablet,bus=ehci.0,id=dd\ndevice_add usb-tablet,bus=ehci.0,id=ee\ndevice_add usb-tablet,bus=ehci.0,id=ff,port=6\ndevice_del aa\ndevice_del bb\ndevice_del cc\ndevice_del dd\ndevice_del ee\ndevice_del ff\ndevice_add usb-tablet,bus=ehci.0,id=aa\ndevice_add usb-tablet,bus=ehci.0,id=bb\ndevice_add usb-tablet,bus=ehci.0,id=cc\ndevice_add usb-tablet,bus=ehci.0,id=dd\ndevice_add usb-tablet,bus=ehci.0,id=ee\ndevice_add usb-tablet,bus=ehci.0,id=ff,port=6" | qemu-kvm -nodefaults -monitor stdio     -device usb-ehci,id=ehci
2. echo -e "device_add usb-tablet,bus=ehci.0,id=aa\ndevice_add usb-tablet,bus=ehci.0,id=bb\ndevice_add usb-tablet,bus=ehci.0,id=cc\ndevice_add usb-tablet,bus=ehci.0,id=dd\ndevice_add usb-tablet,bus=ehci.0,id=ee\ndevice_add usb-tablet,bus=ehci.0,id=ff,port=6\ndevice_del ff\ndevice_del ee\ndevice_del dd\ndevice_del cc\ndevice_del bb\ndevice_del aa\ndevice_add usb-tablet,bus=ehci.0,id=aa\ndevice_add usb-tablet,bus=ehci.0,id=bb\ndevice_add usb-tablet,bus=ehci.0,id=cc\ndevice_add usb-tablet,bus=ehci.0,id=dd\ndevice_add usb-tablet,bus=ehci.0,id=ee\ndevice_add usb-tablet,bus=ehci.0,id=ff,port=6" | qemu-kvm -nodefaults -monitor stdio     -device usb-ehci,id=ehci


Actual results:
Step 1 passes (adds 6 devices, removes them and add them again in the same order)
Step 2 fails (adds 6 devices, removes them and while adding them again it assigns the last port first)


Expected results:
usb port should assigns the port incrementally (or am I wrong?). Why does it matter where from I remove the device?


Additional info:
The only difference between step 1 and step 2 are reversed order of device_del.

Comment 1 Cole Robinson 2013-10-31 20:53:45 UTC
Hans, Gerd, care to weigh in?(In reply to Lukas Doktor from comment #0)
> Description of problem:
> Hi guys, I found another inconsistency, which confuses me. When I add
> usb-bus and than plug some devices into this bus without specifying port it
> assigns them incrementally (1, 2, 3, 4, 5, ...). Anyway when I remove the
> device and than try to add them again, it assigns them in the different
> manner. (from what I've seen it's the opposite order of the removed devices).
> 
> I'd like to ask if this is something we intend to unify or if I should just
> always assign port and not trust qemu to do it incrementally?

Hans, Gerd, care to weigh in?

Comment 2 Gerd Hoffmann 2013-11-04 09:06:30 UTC
If you want a specific port assigning, just explicitly say so.


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