Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 824535

Summary: Remote-Viewer: USB-Redirection Tests: Can't Use Webcam on a Windows Guest
Product: Red Hat Enterprise Linux 6 Reporter: Vimal Patel <vipatel>
Component: usbredirAssignee: Daniel Berrangé <berrange>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3CC: cfergeau, dallan, dblechte, dyasny, hdegoede, pvine
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-01 18:15:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Log of lsusb -v With Logitech WebCam attached.
none
USB log with Logitech Webcam attached none

Description Vimal Patel 2012-05-23 17:24:08 UTC
Description of problem:
While testing USB-Redirection of a WebCam for a Windows Guest (Both Windows XP 32, and Windows 7 64), the WebCam is not usable on the guest after connecting using remote-viewer.  

The Error that shows up on the terminal is (This happens when any type of playback from the webcam is attempted): 
(remote-viewer: 8730): GSpice-CRITICAL **: usbredirhost error: submitting iso transfer on ep 81: -1, stopping stream.
libusb:error [submit_iso_transfer] submiturb failed error -1 errno=28


Version-Release number of selected component (if applicable):
Testing RHEL 6.3 (RHEL6.3-20120509.1) - Client & Host

How reproducible:
Reproduced it on both XP and Windows 7 using 2 different webcams.


Steps to Reproduce:
Client & Host are on the Same machine (RHEL 6.3)
It's not possible to set up USB redirection right now using virt-manager, that's why place following configuration into your guest domain xml file:

    "sudo virsh edit  $GUEST_NAME" on host machine.
    enter above the "</devices>" line following:

<controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x2'/>
    </controller>
    <redirdev bus='usb' type='spicevmc'>  
      <address type='usb' bus='0' port='3'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='4'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='5'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='6'/>
    </redirdev>

The guest is brought up using VirtManager:
/usr/libexec/qemu-kvm -S -M rhel6.3.0 -enable-kvm -m 2048 -smp 1,sockets=1,cores=1,threads=1 -name WinXP -uuid e9451697-df7f-544c-5cef-aef7a2982ea6 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/WinXP.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -no-shutdown -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x8.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x8 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x8.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x8.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/home/test/images/WindowsXP.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/home/test/Desktop/RHEV-toolsSetup_3.0_37.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=22,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:ea:a9:1b,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -device usb-tablet,id=input0 -spice port=5901,addr=0.0.0.0,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -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,bus=usb.0,port=3 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2,bus=usb.0,port=5 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3,bus=usb.0,port=6 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5


Client:
1.  remote-viewer spice:.//$HOST?port=$PORT.
2.  connect usb webcam
3.  Attempt to use it.
  
Actual results:
The WebCam is detected; however, nothing gets displayed and remote viewer errors show up on the terminal

Expected results:
The WebCam is detected and Video/Images are captured from the guests using the usb webcam.

Additional info:

Software Versions on Client/Host:
spice-gtk-0.11-9.el6.x86_64
spice-server-0.10.1-7.el6.x86_64
spice-usb-share-4.9-9.el6.x86_64
spice-xpi-2.7-19.el6.x86_64
spice-gtk-python-0.11-9.el6.x86_64
spice-glib-0.11-9.el6.x86_64
spice-client-0.8.2-15.el6.x86_64
spice-vdagent-0.8.1-3.el6.x86_64
kmod-kspiceusb-rhel60-4.9-14.el6.x86_64
usbredir-0.4.3-1.el6.x86_64
qemu-kvm-0.12.1.2-2.292.el6.x86_64
qemu-kvm-0.12.1.2-2.292.el6.x86_64
kmod-kspiceusb-rhel60-4.9-14.el6.x86_64
xorg-x11-drv-qxl-0.0.14-13.el6_2.x86_64
virt-viewer-0.5.2-8.el6.x86_64
libvirt-client-0.9.10-18.el6.x86_64
libvirt-python-0.9.10-18.el6.x86_64
libvirt-0.9.10-18.el6.x86_64

Comment 3 Hans de Goede 2012-05-24 15:04:25 UTC
Hi,

(In reply to comment #0)
> Description of problem:
> While testing USB-Redirection of a WebCam for a Windows Guest (Both Windows
> XP 32, and Windows 7 64), the WebCam is not usable on the guest after
> connecting using remote-viewer.  
> 
> The Error that shows up on the terminal is (This happens when any type of
> playback from the webcam is attempted): 
> (remote-viewer: 8730): GSpice-CRITICAL **: usbredirhost error: submitting
> iso transfer on ep 81: -1, stopping stream.
> libusb:error [submit_iso_transfer] submiturb failed error -1 errno=28

errno = 28 is ENOSPC, this means that there is not enough free / available USB bandwidth. Normally when the OS (which does bandwidth management) reports this error to a driver, the driver will try to fallback to a lower bandwidth setting.  But with virtualization the guest OS is not aware of any non redirected USB users, so this does not work.

Possible reasons for not having enough bandwidth is:
1) Using a USB 1 device in a USB 2 hub
2) Having multiple USB 1 devices on the same bus

Please try plugging the webcam directly into the machine (so don't use a hub), and to not have any
other devices on the same bus. lsusb on the client will show you which devices share the same bus.

Regards,

Hans

Comment 5 Vimal Patel 2012-05-24 21:42:35 UTC
Hi Hans,

I was doing all my usb testing with the same ports, and all my other USB tests passed successfully.  Looking at what you suggested, I looked at what I had on my system, 2 buses, and I was connecting both onto the same bus.  My wireless keyboard/mouse reciever was a usb 2.0 device (bus 1) and the usb webcam was a 1.1 device on (bus 2).

So, I switched the USB 1.1 webcam to be on a bus by itself, and the client did see the webcam and I was able to see the what the webcam was currently capturing.  Taking pictures worked fine, and displaying the current capture worked fine, but when I selected Record, I would get a similiar error:

Windows XP:
(remote-viewer: 2414): GSpice-CRITICAL **: usbredirhost error: submitting
iso transfer on ep 83: -1, stopping stream.
libusb:error [submit_iso_transfer] submiturb failed error -1 errno=28

So the difference from before is the line number of the error changed from 8730 to 2414, and ep 81 to ep 83.  

Windows 7:
Same behavior a different line for the error

(remote-viewer:4474): GSpice-CRITICAL **: usbredirhost error: submitting
iso transfer on ep 81: -1, stopping stream.
libusb:error [submit_iso_transfer] submiturb failed error -1 errno=28

If I tried it the other way, webcam on bus2 and keyboard/mouse receiver on bus1, the whole system reboots (client/host).

(And again, I had no issue with testing any other usb devices: optical drive, smart card reader, mouse, keyboard, headset)
-Vimal

Comment 6 Vimal Patel 2012-05-25 13:34:37 UTC
I tried it again webcam on bus2 (by itself) and the keyboard/mouse receiver on bus1.  Right when I plug in the webcam the vm freezes and reboots (100% reproducible).  I have looked for coredumps (don't see any).  I will look take a look into the logs to see what information I can find.  I tried other usb devices with the same setup and a headset also got the machine to reboot (but a mass storage device worked fine).

Comment 7 Hans de Goede 2012-05-25 15:34:15 UTC
Can you please do an "lsusb -v > log" with the webcam in question plugged in, and attach the generated log file here? Thanks, Hans.

Comment 8 Vimal Patel 2012-05-25 15:58:33 UTC
Created attachment 586896 [details]
Log of lsusb -v With Logitech WebCam attached.

Comment 9 Hans de Goede 2012-05-25 19:14:26 UTC
Thanks for the log, but the webcam does not show in there. Can you please plug the webcam into the client machine without using usb-redir, regenerate the log file, and attach the new log file?

Comment 10 Vimal Patel 2012-05-29 12:39:03 UTC
Created attachment 587397 [details]
USB log with Logitech Webcam attached

Comment 11 Vimal Patel 2012-06-01 15:39:44 UTC
Tested again with an updated version of spice-server (spice-server-0.10.1-10.el6.x86_64).  The machine rebooting is not seen anymore.  The webcam works when it is by itself, except for when recording is attempted, then seeing the same errors: GSpice-CRITICAL **: usbredirhost error: submitting
iso transfer on ep 81: -1, stopping stream.
libusb:error [submit_iso_transfer] submiturb failed error -1 errno=28, and the client/host froze.

The only log I could find:
/var/log/libvirt/libvirtd.log:

2012-05-31 17:48:31.414+0000: 2794: info : libvirt version: 0.9.10, package: 18.el6 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2012-05-09-04:01:41, hs20-bc2-5.build.redhat.com)
2012-05-31 17:48:31.414+0000: 2794: warning : virKeepAliveTimer:182 : No response from client 0xfc14f0 after 5 keepalive messages in 30 secon

Comment 12 Hans de Goede 2012-06-01 18:15:52 UTC
Looking at yuor lsusb output yoo're testing with an sandy bridge machine. sandy bridge chipsets no longer have the standard usb setup of an EHCI controller with UHCI companion controllers. Instead they only have an EHCI controller and a build in USB-2 HUB for USB-1 compatiblity.

This means that you're in essence using the USB-1 webcam you're testing with through a USB-2 hub. And unfortunately the Linux kernel USB scheduling code cannot handle USB-1 isochronous traffic running over a USB-2 hub very well.

When you're trying to record, windows presumably also tries to start an audio stream from the webcam's mic. 

This causes 2 isoc streams to be active at the same time, and the Linux kernel EHCI driver USB scheduling code runs out of bandwidth while trying to schedule the 2nd stream. This causes a errno=28 error on the Linux client side, which gets translated to an IO-error to the guest OS, at which point the guest hangs,
so we have 2 problems here:
1) The guest hangs on an UI error -> cannotfix
2) The Linux kernel EHCI driver USB scheduling code is suboptimal, you could try opening a bug against the kernel for this, but chances of getting this fixed are pretty low, as this has been known for a very long time now ...

Given that neither issue is a usbredir bug I'm going to close this as notabug, which should be interpreted as not an usbredir bug. It does trigger a known kernel issue, for which you could file a new bug against the kernel if you want...