Bug 1552127
Summary: | qemu-kvm cannot find USB bus | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Radek Duda <rduda> | ||||||
Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> | ||||||
Status: | CLOSED ERRATA | QA Contact: | lijuan men <lmen> | ||||||
Severity: | high | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 7.6 | CC: | bsanford, bugs, dyuan, jdenemar, jiyan, lmen, michal.skrivanek, mprivozn, mtessun, rduda, spower, xuzhang | ||||||
Target Milestone: | pre-dev-freeze | Keywords: | Regression, TestBlocker, Upstream | ||||||
Target Release: | 7.6 | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | libvirt-4.3.0-1.el7 | Doc Type: | If docs needed, set a value | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | |||||||||
: | 1552611 (view as bug list) | Environment: | |||||||
Last Closed: | 2018-10-30 09:53:14 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | Virt | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 1552611 | ||||||||
Attachments: |
|
Created attachment 1404857 [details]
vdsm log after VM starts
Seems the USB companion controller's masterbus is not generated correctly? Why does it use alias.0? Yes, this is a libvirt bug. I recall posting some patches for this on the upstream but don't recall their fate right now. Anwyay, I'll look into this. For QE or anybody else willing to reproduce this: Just try to start domain with the following USB controller: <controller type='usb' index='0' model='ich9-uhci2'> <alias name='ua-ble'/> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/> </controller> Just for housekeeping sake: what is the reason you need to set user alias for this device (which can't be hotplugged anyway)? Because I'm thinking about a fix where I forbid it. I do not know. This is the default behaviour of rhv4.2 (In reply to Michal Privoznik from comment #5) > Just for housekeeping sake: what is the reason you need to set user alias > for this device (which can't be hotplugged anyway)? Because I'm thinking > about a fix where I forbid it. it's a generic code for all devices. why forbid? it's not particularly interesting and we can likely easily disable that for usb controllers, but why creating inconsistency in libvirt? (In reply to Michal Skrivanek from comment #7) > (In reply to Michal Privoznik from comment #5) > > Just for housekeeping sake: what is the reason you need to set user alias > > for this device (which can't be hotplugged anyway)? Because I'm thinking > > about a fix where I forbid it. > > it's a generic code for all devices. why forbid? it's not particularly > interesting and we can likely easily disable that for usb controllers, but > why creating inconsistency in libvirt? Forbid because these aliases are what QEMU sees. I mean, aliases as exposed by libvirt are directly passed to QEMU. And for some devices aliases have special meaning - like in this case, where alias also represents bus the controller is plugged to. And QEMU has these joined devices where we cannot really set them on per device basis (although they are represented separately on the command line). (In reply to Michal Privoznik from comment #9) > Forbid because these aliases are what QEMU sees. I mean, aliases as exposed > by libvirt are directly passed to QEMU. And for some devices aliases have > special meaning - like in this case, where alias also represents bus the > controller is plugged to. And QEMU has these joined devices where we cannot > really set them on per device basis (although they are represented > separately on the command line). okay, can you please specify which other devices would behave like that? Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2018-March/msg00466.html (In reply to Michal Skrivanek from comment #10) > (In reply to Michal Privoznik from comment #9) > > > Forbid because these aliases are what QEMU sees. I mean, aliases as exposed > > by libvirt are directly passed to QEMU. And for some devices aliases have > > special meaning - like in this case, where alias also represents bus the > > controller is plugged to. And QEMU has these joined devices where we cannot > > really set them on per device basis (although they are represented > > separately on the command line). > > okay, can you please specify which other devices would behave like that? USB controllers are the only ones which come to my mind. ok, that's easy enough to skip After update libvirt 3.9.0-13 to libvirt 3.9.0-14 on host I can start VM with USB support now. (In reply to Radek Duda from comment #14) > After update libvirt 3.9.0-13 to libvirt 3.9.0-14 on host > I can start VM with USB support now. Sorry for confusion .. I tried now several times today to launch VM with usb support enabled and it seems libvirt 3.9.0-14 have no impact on the bug. Reproducibility is not 100% but around 95%. Hi, Michal. I have tried several scenarios in pure libvirt. Version: kernel-3.10.0-860.el7.x86_64 qemu-kvm-rhev-2.10.0-21.el7.x86_64 libvirt-3.9.0-14.virtcov.el7.x86_64 Scenarios: S1: Configure alias for 'ich9-ehci1' model # virsh domstate test1 shut off # virsh dumpxml test1 |grep "usb" -A5 <controller type='usb' index='0' model='ich9-ehci1'> <alias name='ua-ble'/> **** <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> # virsh start test1 error: Failed to start domain test1 error: internal error: process exited while connecting to monitor: i.0,addr=0x7 -msg timestamp=on 2018-03-13T03:52:15.377611Z qemu-kvm: -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5: USB bus 'usb.0' not found S2: Configure alias for 'ich9-uhci1' model # virsh domstate test1 shut off [root@intel-e31225-8-2 ~]# virsh dumpxml test1 |grep "usb" -A5 <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <alias name='ua-ble'/> **** <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> # virsh start test1 error: Failed to start domain test1 error: internal error: process exited while connecting to monitor: 2018-03-13T03:53:04.572620Z qemu-kvm: -device ich9-usb-uhci1,masterbus=ua-ble.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5: USB bus 'ua-ble.0' not found S3: Configure alias for 'ich9-uhci2' model # virsh domstate test1 shut off # virsh dumpxml test1 |grep "usb" -A5 <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <alias name='ua-ble'/> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> # virsh start test1 error: Failed to start domain test1 error: internal error: process exited while connecting to monitor: 2018-03-13T03:54:57.294238Z qemu-kvm: -device ich9-usb-uhci2,masterbus=ua-ble.0,firstport=2,bus=pci.0,addr=0x5.0x1: USB bus 'ua-ble.0' not found S4: Configure alias for 'ich9-uhci3' model # virsh domstate test1 shut off # virsh dumpxml test1 |grep usb -A5 <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <alias name='ua-ble'/> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> # virsh start test1 error: Failed to start domain test1 error: internal error: process exited while connecting to monitor: 2018-03-13T03:56:09.135343Z qemu-kvm: -device ich9-usb-uhci3,masterbus=ua-ble.0,firstport=4,bus=pci.0,addr=0x5.0x2: USB bus 'ua-ble.0' not found S5: Configure alias for all models # virsh domstate test1 shut off # virsh dumpxml test1 |grep usb -A5 <controller type='usb' index='0' model='ich9-ehci1'> <alias name='ua-usb1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <alias name='ua-usb2'/> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <alias name='ua-usb3'/> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <alias name='ua-usb4'/> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> # virsh start test1 error: Failed to start domain test1 error: internal error: qemu unexpectedly closed the monitor: 2018-03-13T03:57:17.817761Z qemu-kvm: -device ich9-usb-uhci1,masterbus=ua-usb2.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5: USB bus 'ua-usb2.0' not found In the test scenarios above, guest can not start. I am not sure whether it is same with the issue in RHV. And I can also reproduce the issue in RHV. Version: libvirt-3.9.0-14.virtcov.el7.x86_64 vdsm-4.20.20-1.el7ev.x86_64 qemu-kvm-rhev-2.10.0-21.el7.x86_64 kernel-3.10.0-860.el7.x86_64 Qemu Log: # cat /var/log/libvirt/qemu/vm.log 2018-03-13T03:47:18.909782Z qemu-kvm: -device ich9-usb-uhci3,masterbus=ua-5d0ddb79-fed6-465b-807d-839018b74f0a.0,firstport=4,bus=pci.0,addr=0x5.0x2: USB bus 'ua-5d0ddb79-fed6-465b-807d-839018b74f0a.0' not found 2018-03-13 03:47:19.175+0000: shutting down, reason=failed At last, I wonder whether the scenarios above is same with the issue in RHV, if so, maybe this issue has been found in Bug 1434451. Could you please help to check it? thanks in advance. https://bugzilla.redhat.com/show_bug.cgi?id=1434451#c31 Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2018-March/msg00963.html In my testing it fixes issues found in comment 16. Aaand I've just pushed the patch upstream: commit b133fac356324c3c7992a9cb07c1b5d9eea1e2eb Author: Michal Privoznik <mprivozn> AuthorDate: Fri Mar 16 15:53:32 2018 +0100 Commit: Michal Privoznik <mprivozn> CommitDate: Fri Mar 16 16:37:14 2018 +0100 qemu: Build usb controller command line more wisely https://bugzilla.redhat.com/show_bug.cgi?id=1552127 When building command line for USB controllers we have to do more than just put controller's alias onto the command line. QEMU has concept of these joined USB controllers. For instance ehci and uhci controllers need to create the same USB bus. To achieve that the slave controller needs to refer the master controller. This worked until we've introduced user aliases because both master and slave had the same alias. With user aliases slave can have different alias than master. Therefore, when generating command line for slave we need to look up the master's alias. Signed-off-by: Michal Privoznik <mprivozn> v4.1.0-192-gb133fac356 verify the bug version: libvirt-4.5.0-2.el7.x86_64 scenario1:Configure alias for 'ich9-ehci1' model <controller type='usb' index='0' model='ich9-ehci1'> *** <alias name='ua-usb1'/>*** <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> [root@localhost ~]# virsh destroy test;virsh start test Domain test destroyed Domain test started [root@localhost ~]# ps -ef | grep test | grep usb -device ich9-usb-ehci1,id=ua-usb1,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=ua-usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=ua-usb1.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=ua-usb1.0,firstport=4,bus=pci.0,addr=0x5.0x2 scenario2:Configure alias for 'ich9-uhci1' model <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> ***<alias name='ua-usb2'/>*** <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> [root@localhost ~]# virsh destroy test;virsh start test Domain test destroyed Domain test started [root@localhost ~]# ps -ef | grep test | grep usb -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 scenario3: Configure alias for all models <controller type='usb' index='0' model='ich9-ehci1'> *** <alias name='ua-usb1'/>*** <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> *** <alias name='ua-usb2'/>*** <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> *** <alias name='ua-usb3'/>*** <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> *** <alias name='ua-usb4'/>*** <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/> </controller> [root@localhost ~]# virsh destroy test;virsh start test Domain test destroyed Domain test started [root@localhost ~]# ps -ef | grep test | grep usb -device ich9-usb-ehci1,id=ua-usb1,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=ua-usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=ua-usb1.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=ua-usb1.0,firstport=4,bus=pci.0,addr=0x5.0x2 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:3113 |
Created attachment 1404856 [details] qemu.log after vm starts Description of problem: VM with USB support enabled cannot be launched. Version-Release number of selected component (if applicable): host (rhel7.5): vdsm-4.20.20-1.el7ev.x86_64 qemu-kvm-rhev-2.9.0-16.el7_4.14.x86_64 libvirt-client-3.9.0-13.el7.x86_64 engine (rhel7.5) rhv4.2.2.2-0.1.el7 ovirt-engine-4.2.2.2-0.1.el7.noarch How reproducible: always Steps to Reproduce: 1.create some VM in rhv with usb support enabled 2.run VM 3. Actual results: VM is shut down immediatelly after start. In qemu log appears error: 2018-03-06T14:32:36.783360Z qemu-kvm: -device ich9-usb-uhci2,masterbus=ua-b17203da-8498-48ae-9b4e-71e6757fcd68.0,firstport=2,bus=pci.0,addr=0x7.0x1: USB bus 'ua-b17203da-8498-48ae-9b4e-71e6757fcd68.0' not found Expected results: VM is running Additional info: It worked ok before vdsm and ovirt-engine update