RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1160504 - guest can not show usb device after adding some usb controllers and redirdevs.
Summary: guest can not show usb device after adding some usb controllers and redirdevs.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Gerd Hoffmann
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1164695 1165478 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-05 03:04 UTC by Song Wang
Modified: 2015-09-21 13:26 UTC (History)
16 users (show)

Fixed In Version: qemu-kvm-rhev-2.1.2-11.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 09:57:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
QEMU log (5.70 KB, text/plain)
2014-11-07 05:20 UTC, Song Wang
no flags Details
Libvirtd log (5.26 MB, text/plain)
2014-11-07 05:21 UTC, Song Wang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0624 0 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2015-03-05 14:37:36 UTC

Description Song Wang 2014-11-05 03:04:18 UTC
Description of problem:
guest can not show usb device after adding some usb controllers and redirdevs.

Version-Release number of selected component (if applicable):
libvirt-1.2.8-5.el7.x86_64
qemu-kvm-rhev-2.1.2-5.el7.x86_64
kernel-3.10.0-195.el7.x86_64
guest : rhel7.0

How reproducible:
100%

Steps to Reproduce:

Scenario 1:
When xml contain the following usb controllers and redirdevs, guest can not show usb device.

1.[root@localhost songwang]# lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 17ef:6019 Lenovo 
Bus 003 Device 003: ID 04b3:3025 IBM Corp. NetVista Full Width Keyboard
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 154b:6001 PNY    <---usb

2.[root@localhost ~]# virsh dumpxml aa
...
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb0'/>
      <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='usb0'/>
      <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='usb0'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
...
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <address bus='1' device='4'/>
      </source>
      <alias name='hostdev0'/>
    </hostdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir0'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir1'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir2'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir3'/>
    </redirdev>
...
3.[root@localhost songwang]# virsh start aa
Domain aa started

[root@localhost songwang]# ps aux |grep qemu
qemu     16698 86.4  2.2 1824432 174924 ?      Sl   10:22   0:08 /usr/libexec/qemu-kvm -name aa -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 2,maxcpus=4,sockets=4,cores=1,threads=1 -uuid 23d19d5a-ee01-4a2b-bec9-948fca512c00 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/aa.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -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 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/mnt/r7.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:4c:dd:e2,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3 -device usb-host,hostbus=1,hostaddr=7,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -msg timestamp=on
root     16785  0.0  0.0 112640   960 pts/2    S+   10:22   0:00 grep --color=auto qemu


4.check usb device in guest
login in guest
#lsusb
can not find usb device

5.[root@localhost songwang]# virsh destroy aa
Domain aa destroyed

6.usb device can be found in host machine after destroying aa

Scenario 2:
When xml use default usb controller, guest can not show usb device.
1.[root@localhost songwang]# lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 17ef:6019 Lenovo 
Bus 003 Device 003: ID 04b3:3025 IBM Corp. NetVista Full Width Keyboard
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 154b:6001 PNY   <---

2.[root@localhost ~]# virsh dumpxml aa
...
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
...
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <address bus='1' device='4'/>
      </source>
      <alias name='hostdev0'/>
    </hostdev>
...
3.[root@localhost songwang]# virsh start aa
Domain aa started

4.[root@localhost songwang]# ps aux |grep qemu
qemu     16128 43.2  3.3 3170020 261980 ?      Sl   10:18   0:12 /usr/libexec/qemu-kvm -name aa -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 2,maxcpus=4,sockets=4,cores=1,threads=1 -uuid 23d19d5a-ee01-4a2b-bec9-948fca512c00 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/aa.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/mnt/r7.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:4c:dd:e2,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device usb-host,hostbus=1,hostaddr=7,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -msg timestamp=on
root     16236  0.0  0.0 112640   960 pts/2    S+   10:18   0:00 grep --color=auto qemu


5.check usb device in guest
login in guest
#lsusb
can not find usb device

6.[root@localhost songwang]# virsh destroy aa
Domain aa destroyed

7.usb device can be found in host machine after destroying aa


Actual results:
as steps

Expected results:
guest can show the usb device 

Additional info:
For qemu-kvm-rhev-2.1.2-5.el7.x86_64, two scenarios can reproduce the issue.
For qemu-kvm-1.5.3-77.el7.x86_64, guest can show usb device in the scenarios.

Maybe it should be added successfully but can not show in guest .

Comment 2 Song Wang 2014-11-05 10:00:36 UTC
When I upgrade qemu-kvm-rhev to  qemu-kvm-rhev-2.1.2-6.el7.x86_64
,the bug also does exist.

Comment 3 Gerd Hoffmann 2014-11-05 13:16:09 UTC
> Bus 001 Device 004: ID 154b:6001 PNY    <---usb

Bus 1 address 4.

>     <hostdev mode='subsystem' type='usb' managed='no'>
>       <source>
>         <address bus='1' device='4'/>
>       </source>
>       <alias name='hostdev0'/>
>     </hostdev>

Likewise.

> [root@localhost songwang]# ps aux |grep qemu
[ ... ]
> -device usb-host,hostbus=1,hostaddr=7,id=hostdev0

Bus 1 address 7.  Huh?

Looks like libvirt messed something up here.

Comment 4 Ján Tomko 2014-11-05 16:40:37 UTC
That's strange and I can't reproduce it with those devices in domain XML.

Could you please attach the full domain XML, debug logs from libvirtd (log_level=1 in /etc/libvirt/libvirtd.conf) and the QEMU log for the machine from /var/log/libvirt/qemu/?

Comment 5 Song Wang 2014-11-07 02:09:37 UTC
(In reply to Gerd Hoffmann from comment #3)
> > Bus 001 Device 004: ID 154b:6001 PNY    <---usb
> 
> Bus 1 address 4.
> 
> >     <hostdev mode='subsystem' type='usb' managed='no'>
> >       <source>
> >         <address bus='1' device='4'/>
> >       </source>
> >       <alias name='hostdev0'/>
> >     </hostdev>
> 
> Likewise.
> 
> > [root@localhost songwang]# ps aux |grep qemu
> [ ... ]
> > -device usb-host,hostbus=1,hostaddr=7,id=hostdev0
> 
> Bus 1 address 7.  Huh?
> 
> Looks like libvirt messed something up here.

I'm so sorry to make you misunderstand for the  messages. Libvirt shows messages without error.Maybe it is my fault because I have done the test some times so that I copied the code not corresponding to the xml.I am so sorry for that!

Comment 6 Song Wang 2014-11-07 05:18:45 UTC
(In reply to Jan Tomko from comment #4)
> That's strange and I can't reproduce it with those devices in domain XML.
> 
> Could you please attach the full domain XML, debug logs from libvirtd
> (log_level=1 in /etc/libvirt/libvirtd.conf) and the QEMU log for the machine
> from /var/log/libvirt/qemu/?

libvirt-1.2.8-5.el7.x86_64
qemu-kvm-rhev-2.1.2-6.el7.x86_64
kernel-3.10.0-195.el7.x86_64


1.[root@localhost songwang]# lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 17ef:6019 Lenovo 
Bus 003 Device 003: ID 04b3:3025 IBM Corp. NetVista Full Width Keyboard
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 154b:6001 PNY      <----usb

2.[root@localhost ~]# virsh dumpxml aa
<domain type='kvm'>
  <name>aa</name>
  <uuid>23d19d5a-ee01-4a2b-bec9-948fca512c00</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static' current='2'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/r7.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <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'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:4c:dd:e2'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <address bus='1' device='3'/>
      </source>
    </hostdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

3.[root@localhost ~]# ps aux |grep qemu-kvm
qemu      6927 20.8  3.4 3611544 270544 ?      Sl   10:31   0:13 /usr/libexec/qemu-kvm -name aa -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 2,maxcpus=4,sockets=4,cores=1,threads=1 -uuid 23d19d5a-ee01-4a2b-bec9-948fca512c00 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/aa.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -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 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/var/lib/libvirt/images/r7.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:4c:dd:e2,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3 -device usb-host,hostbus=1,hostaddr=3,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -msg timestamp=on

4.check usb device in guest
login in guest
#lsusb
Bus 001 Device 002: ID:0627:0001 Adomax Technology Co., Ltd
Bus 004 Device 002: ID:0409:55aa NEC Corp. Hub
Bus 001 Device 001: ID:1d6b:0002 Linux Foudation 2.0 root hub
Bus 002 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub
Bus 003 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub
Bus 004 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub

I can not find usb device

Comment 7 Song Wang 2014-11-07 05:20:18 UTC
Created attachment 954777 [details]
QEMU log

Comment 8 Song Wang 2014-11-07 05:21:33 UTC
Created attachment 954778 [details]
Libvirtd log

Comment 9 Gerd Hoffmann 2014-11-07 09:00:49 UTC
what happens if you remove one of the four usbredir devices?

Comment 10 Song Wang 2014-11-07 09:33:58 UTC
when I only remove one of the four usbredir devices in xml 

login in guest, then guest can show the usb device correctly.
#lsusb
Bus 001 Device 002: ID:0627:0001 Adomax Technology Co., Ltd
Bus 001 Device 003: ID:154b:6001 PNY
Bus 001 Device 001: ID:1d6b:0002 Linux Foudation 2.0 root hub
Bus 002 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub
Bus 003 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub
Bus 004 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub

Comment 11 Song Wang 2014-11-07 09:43:15 UTC
(In reply to Gerd Hoffmann from comment #9)
> what happens if you remove one of the four usbredir devices?

additional info :

Scenario 1:
 " <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
"
when I only remove this in xml 

login in guest, then guest can show the usb device correctly.
#lsusb
Bus 001 Device 002: ID:0627:0001 Adomax Technology Co., Ltd
Bus 001 Device 003: ID:154b:6001 PNY
Bus 001 Device 001: ID:1d6b:0002 Linux Foudation 2.0 root hub
Bus 002 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub
Bus 003 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub


Scenario 2:
" <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
"
when I only remove this in xml 

login in guest, then guest can't show the usb device correctly.
#lsusb
Bus 001 Device 002: ID:0627:0001 Adomax Technology Co., Ltd
Bus 003 Device 002: ID:0409:55aa NEC Corp. Hub
Bus 001 Device 001: ID:1d6b:0002 Linux Foudation 2.0 root hub
Bus 002 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub
Bus 003 Device 001: ID:1d6b:0001 Linux Foudation 1.1 root hub

Comment 12 Gerd Hoffmann 2014-11-07 13:45:42 UTC
Your "PHY" device most likely requires USB2 then, and due to your configuration it isn't connected to a usb2 capable port.

There are 6 root ports @ ehci.  usb2 works with them.  The usb hub emulated by qemu (device 3:2) supports usb1 only though.

With 4 redir devices one port is taken by the usb tablet, four ports by the redir devices.  Then qemu goes plug a usn-hub into the sixth port to avoid running out of ports, and the usb-host device is plugged into the hub.  So it ends up on a port which doesn't support usb2.

What you can do about it?

(1) use less usb-redir devices.

(2) explicitly assign devices to ports, using
    <address type='usb' bus='0' port='$nr'/>
    With $nr between 1 and 6 (with ehci).
    In that case qemu will not auto-plug usb hubs.

Unlike with pci devices libvirt doesn't auto-generate address tags for usb devices.  Maybe that should be fixed.

Comment 13 Ronen Hod 2014-11-09 10:16:42 UTC
(In reply to Gerd Hoffmann from comment #12)
> Your "PHY" device most likely requires USB2 then, and due to your
> configuration it isn't connected to a usb2 capable port.

Can QEMU detect the issue?

Comment 14 Song Wang 2014-11-10 02:11:52 UTC
(In reply to Gerd Hoffmann from comment #12)
> Your "PHY" device most likely requires USB2 then, and due to your
> configuration it isn't connected to a usb2 capable port.
> 
> There are 6 root ports @ ehci.  usb2 works with them.  The usb hub emulated
> by qemu (device 3:2) supports usb1 only though.
> 
> With 4 redir devices one port is taken by the usb tablet, four ports by the
> redir devices.  Then qemu goes plug a usn-hub into the sixth port to avoid
> running out of ports, and the usb-host device is plugged into the hub.  So
> it ends up on a port which doesn't support usb2.
> 
> What you can do about it?
> 
> (1) use less usb-redir devices.
> 
> (2) explicitly assign devices to ports, using
>     <address type='usb' bus='0' port='$nr'/>
>     With $nr between 1 and 6 (with ehci).
>     In that case qemu will not auto-plug usb hubs.
> 
> Unlike with pci devices libvirt doesn't auto-generate address tags for usb
> devices.  Maybe that should be fixed.

Thanks for your answer to solve the problem! if users don't know the rules when setting up the parameters like the xml,they will meet the same problem .Maybe qemu also should detect the issue to show error messages for the user to know the error.

Comment 15 Song Wang 2014-11-10 02:25:00 UTC
addional info:
I run the test in the same machine.For qemu-kvm-1.5.3-77.el7.x86_64, the problem doesn't exist.

Comment 16 Gerd Hoffmann 2014-11-10 09:31:44 UTC
(In reply to Song Wang from comment #15)
> addional info:
> I run the test in the same machine.For qemu-kvm-1.5.3-77.el7.x86_64, the
> problem doesn't exist.

Oh, *that* is surprising.

Can you attach 'lspci -t' from both host and guest (running 1.5.3) please?

What kind of device is this?

Comment 17 Song Wang 2014-11-10 10:08:52 UTC
(In reply to Gerd Hoffmann from comment #16)
> (In reply to Song Wang from comment #15)
> > addional info:
> > I run the test in the same machine.For qemu-kvm-1.5.3-77.el7.x86_64, the
> > problem doesn't exist.
> 
> Oh, *that* is surprising.
> 
> Can you attach 'lspci -t' from both host and guest (running 1.5.3) please?
> 
> What kind of device is this?
Run the test as bug shows,then:
USB device
host:
[root@host1 songwang]# lspci -t
-[0000:00]-+-00.0
           +-02.0
           +-14.0
           +-16.0
           +-16.3
           +-19.0
           +-1a.0
           +-1b.0
           +-1d.0
           +-1e.0-[01]--
           +-1f.0
           +-1f.2
           \-1f.3

guest:
#lspci -t
-[0000:00]-+-00.0
           +-01.0
           +-01.1
           +-01.3
           +-02.0
           +-03.0
           +-04.0
           +-05.0
           +-05.1
           +-05.2
           +-05.7
           +-07.0
           \-08.0

Comment 18 Gerd Hoffmann 2014-11-10 10:20:48 UTC
(In reply to Song Wang from comment #17)
> (In reply to Gerd Hoffmann from comment #16)

> [root@host1 songwang]# lspci -t
> -[0000:00]-+-00.0

Oops.  I've meant "lsusb -t", sorry.

Comment 19 Song Wang 2014-11-11 02:09:37 UTC
(In reply to Gerd Hoffmann from comment #18)
> (In reply to Song Wang from comment #17)
> > (In reply to Gerd Hoffmann from comment #16)
> 
> > [root@host1 songwang]# lspci -t
> > -[0000:00]-+-00.0
> 
> Oops.  I've meant "lsusb -t", sorry.

host:
[root@host1 songwang]# lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 2: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 3: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
        |__ Port 2: Dev 14, If 0, Class=Mass Storage, Driver=usb-storage, 480M

guest:
[root@oolong ~]# lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/8p, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 480M

Comment 20 Gerd Hoffmann 2014-11-13 10:03:07 UTC
http://patchwork.ozlabs.org/patch/410003/

Comment 21 Gerd Hoffmann 2014-11-18 13:09:47 UTC
patch posted.

Comment 22 Gerd Hoffmann 2014-11-19 10:47:23 UTC
test builds: http://people.redhat.com/ghoffman/bz1160504/

Comment 23 Miroslav Rezanina 2014-11-21 09:46:16 UTC
Fix included in qemu-kvm-rhev-2.1.2-11.el7

Comment 25 Gerd Hoffmann 2014-11-27 10:11:19 UTC
*** Bug 1165478 has been marked as a duplicate of this bug. ***

Comment 26 Jun Li 2014-12-04 06:03:49 UTC
Reproduce:
Version of components:
qemu-kvm-rhev-2.1.2-7.el7.x86_64


1, On the host:
# lsusb
...
Bus 001 Device 008: ID 1516:6221 CompUSA
...

2, Boot guest and use above usb stick via "usb-host". Cli as followings(The same with comment 6):
# /usr/libexec/qemu-kvm -name aa -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 2,maxcpus=4,sockets=4,cores=1,threads=1 -uuid 23d19d5a-ee01-4a2b-bec9-948fca512c00 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/aa.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -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 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/root/sn-r7.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=25,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:4c:dd:e2,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -spice port=5901,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3 -device usb-host,hostbus=1,hostaddr=8,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -monitor stdio -boot menu=on

3, After guest boot up, check the usb stick inside guest, can not find this usb stick.

As above show, this bz has been reproduced.
==============
Verfiy:
Version of components:
qemu-kvm-rhev-2.1.2-14.el7.x86_64

steps and command line just as above show, after step3, can use this usb stick inside guest correctly.

As above show, this bz has been verified. 
==============

So set this bz with verify. Any issue, please correct me.

Comment 28 errata-xmlrpc 2015-03-05 09:57:16 UTC
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://rhn.redhat.com/errata/RHSA-2015-0624.html

Comment 29 Gerd Hoffmann 2015-09-21 13:26:56 UTC
*** Bug 1164695 has been marked as a duplicate of this bug. ***


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