Bug 1268879

Summary: Camera stops work after remote-viewer re-connection [qemu-kvm]
Product: Red Hat Enterprise Linux 7 Reporter: Andrei Stepanov <astepano>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.2CC: astepano, cfergeau, chayang, djasa, hdegoede, huding, jinzhao, juzhang, knoel, mrezanin, rbalakri, victortoso, virt-maint, xfu, zhguo
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-106.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1273750 (view as bug list) Environment:
Last Closed: 2016-11-03 20:05:33 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:
Bug Depends On:    
Bug Blocks: 1268290, 1273750    
Attachments:
Description Flags
SPICE_DEBUG_LEVEL=5 for qemu-kvm
none
Clients lsusb
none
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=4
none
SPICE_DEBUG=1 for remote-viewer (1)
none
SPICE_DEBUG=1 for remote-viewer (2)
none
dmesg on guest with gspca_zc3xx
none
qemu-kvm for debug=4 usbredirchardev, gspca_zc3xx
none
virt-viewer log for gspca_zc3xx none

Description Andrei Stepanov 2015-10-05 14:04:27 UTC
Created attachment 1079975 [details]
SPICE_DEBUG_LEVEL=5  for qemu-kvm

Host is:
spice-server-0.12.4-9.el7.x86_64
qemu-kvm-1.5.3-86.el7.x86_64
kernel-3.10.0-229.el7.x86_64

Guest is:
virt-viewer-2.0-6.el7.x86_64

Client is:
RHEL 7.1


1. Run VM with:
/usr/libexec/qemu-kvm -m 1024 -spice port=$SRCPORT,disable-ticketing,addr=$SRCIPADDR,seamless-migration=on -vga qxl -device virtio-serial -chardev spicevmc,id=vdagent,name=vdagent,debug=0 -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -readconfig /etc/qemu-kvm/ich9-ehci-uhci.cfg  -chardev spicevmc,name=usbredir,id=usbredirchardev1  -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=3   $GUEST_IMAGE_PATH -monitor stdio -usb    -device intel-hda -device hda-duplex

2. Connect to guest.
$ remote-viewer spice://<hostip>:3000

3. Redirect camera from client to guest
remote-viewer -> File -> USB device selection -> Webcam C170

4. Use camera
Applications -> Sound & Video -> Cheese
Make sure camera works fine.

5. Close Cheese app.

6. Close remote-viwer.

7. Again connect to guest:
$ remote-viewer spice://<hostip>:3000

8. Redirect camera from client to guest
remote-viewer -> File -> USB device selection -> Webcam C170

9. Use camera
Cheese cannot use camera


lsusb on guest always prints:
$ lsusb
Bus 003 Device 002: ID 046d:082b Logitech, Inc. Webcam C170
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


dmesg on guest:
[    7.100977] input: spice vdagent tablet as /devices/virtual/input/input4
[   75.853177] usb 1-1: new high-speed USB device number 2 using ehci-pci
[   76.254016] usb 1-1: New USB device found, idVendor=046d, idProduct=082b
[   76.254019] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   76.254021] usb 1-1: Product: Webcam C170
[   76.254022] usb 1-1: Manufacturer:  
[   76.320736] Linux video capture interface: v2.00
[   76.393024] usbcore: registered new interface driver snd-usb-audio
[   76.399612] uvcvideo: Found UVC 1.00 device Webcam C170 (046d:082b)
[   76.413357] input: Webcam C170 as /devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0/input/input5
[   76.413574] usbcore: registered new interface driver uvcvideo
[   76.413575] USB Video Class driver (1.1.1)
[   82.288082] fuse init (API version 7.22)
[   82.300149] SELinux: initialized (dev fuse, type fuse), uses genfs_contexts
[   83.295838] Bluetooth: Core ver 2.16
[   83.295909] NET: Registered protocol family 31
[   83.295910] Bluetooth: HCI device and connection manager initialized
[   83.295916] Bluetooth: HCI socket layer initialized
[   83.295917] Bluetooth: L2CAP socket layer initialized
[   83.295920] Bluetooth: SCO socket layer initialized
[   83.334474] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   83.334477] Bluetooth: BNEP filters: protocol multicast
[   83.334485] Bluetooth: BNEP socket layer initialized
[   83.438945] input: spice vdagent tablet as /devices/virtual/input/input6
[  371.255161] usb 1-1: reset high-speed USB device number 2 using ehci-pci
[  379.050159] usb 1-1: USB disconnect, device number 2
[  400.371202] usb usb1-port1: cannot reset (err = -32)
[  400.371216] usb usb1-port1: cannot reset (err = -32)
[  400.371227] usb usb1-port1: cannot reset (err = -32)
[  400.371238] usb usb1-port1: cannot reset (err = -32)
[  400.371249] usb usb1-port1: cannot reset (err = -32)
[  400.371250] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  400.371286] usb usb1-port1: cannot reset (err = -32)
[  400.371298] usb usb1-port1: cannot reset (err = -32)
[  400.371308] usb usb1-port1: cannot reset (err = -32)
[  400.371319] usb usb1-port1: cannot reset (err = -32)
[  400.371330] usb usb1-port1: cannot reset (err = -32)
[  400.371332] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  400.371394] usb usb1-port1: cannot reset (err = -32)
[  400.371411] usb usb1-port1: cannot reset (err = -32)
[  400.371422] usb usb1-port1: cannot reset (err = -32)
[  400.371433] usb usb1-port1: cannot reset (err = -32)
[  400.371443] usb usb1-port1: cannot reset (err = -32)
[  400.371445] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  400.371478] usb usb1-port1: cannot reset (err = -32)
[  400.371489] usb usb1-port1: cannot reset (err = -32)
[  400.371500] usb usb1-port1: cannot reset (err = -32)
[  400.371510] usb usb1-port1: cannot reset (err = -32)
[  400.371521] usb usb1-port1: cannot reset (err = -32)
[  400.371523] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[  400.371550] usb usb1-port1: unable to enumerate USB device
[  400.595080] usb 3-1: new full-speed USB device number 2 using uhci_hcd
[  400.833015] usb 3-1: not running at top speed; connect to a high speed hub
[  400.939261] usb 3-1: New USB device found, idVendor=046d, idProduct=082b
[  400.939265] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  400.939267] usb 3-1: Product: Webcam C170
[  400.939268] usb 3-1: Manufacturer:  
[  400.946983] uvcvideo: Found UVC 1.00 device Webcam C170 (046d:082b)
[  400.963565] input: Webcam C170 as /devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1:1.0/input/input7
[  596.030133] usb 3-1: reset full-speed USB device number 2 using uhci_hcd


If I specify 2 `usb-redir' devices to qemu-kvm than I can use camera 2 times. On third connection to guest it stops work.

Comment 2 Victor Toso 2015-10-05 14:08:59 UTC
Thanks for the report, this is also being tracked upstream.
https://bugs.freedesktop.org/show_bug.cgi?id=90286

Comment 3 Andrei Stepanov 2015-10-05 14:23:29 UTC
The bug successfully reproduced on 7.1.z:
spice-server-0.12.4-9.el7_1.1.x86_64
qemu-kvm-1.5.3-86.el7_1.6.x86_64
kernel-3.10.0-229.14.1.el7.x86_64

Comment 4 Andrei Stepanov 2015-10-05 14:49:18 UTC
The bug successfully reproduced on RHEL-7.2-Snapshot-4.0
spice-server-0.12.4-15.el7.x86_64
qemu-kvm-1.5.3-104.el7.x86_64
kernel-3.10.0-320.el7.x86_64

Comment 5 Hans de Goede 2015-10-12 08:32:21 UTC
Ok, I've tried to reproduce this witha  RHEL-7.1 x86_64 guest on a fully up2date F-23 host and I could not reproduce this, so this seems be something RHEL-7.2 specific. I'll go and setup a RHEL-7.2 host now and I'll try to reproduce this there.

Comment 6 Christophe Fergeau 2015-10-12 10:18:49 UTC
This should be reproducible with f23 host/client, and a f22 VM (I just did)
Steps I followed:
- start VM
- log into GNOME
- redirect laptop webcam
- start cheese
  -> webcam works
- stop cheese
- unredirect laptop webcam
- redirect laptop webcam
- start cheese
  -> cheese shows a black screen with some error logs

Comment 7 Hans de Goede 2015-10-12 11:26:57 UTC
(In reply to Christophe Fergeau from comment #6)
> This should be reproducible with f23 host/client, and a f22 VM (I just did)
> Steps I followed:
> - start VM
> - log into GNOME
> - redirect laptop webcam
> - start cheese
>   -> webcam works
> - stop cheese
> - unredirect laptop webcam
> - redirect laptop webcam
> - start cheese
>   -> cheese shows a black screen with some error logs

Hmm, as said I cannot reproduce with a 7.1 guest (which is what the original reporter is using).

Are you using all pristine F-23 packages on the host, or have you build something from source ?

Are you using 32/64 bit on the host, and what about the client ?

What model webcam are you using ?

What sort of error messages are you getting in dmesg in the guest and on the client ?

Comment 8 Hans de Goede 2015-10-14 09:11:00 UTC
I've tried to reproduce this once more:

1) Using a rhel-7.2 host + client and rhel-7.1 guest as described in the problem description in bug 1268879, or using a rhel-7.1 guest on a Fedora-23 host + client.
2) I've tried 2 different high-end (high-bandwidth) usb-2.0 cameras a  Microsoft LifeCam Studio and a Logitech Webcam Pro 9000
3) I've tried plugging them into either an ehci or an xhci controller on the client side
4) I've tried either stop cheese, un-redirect, re-redirect and stop cheese, close remote-viewer, reconnect remote-viewer

But I cannot reproduce this, the redireted camera stays working fine in all of the above scenarios and various combinations thereof.

So I've several questions, which may hopefully help me reproduce this:

1) Are your host/client systems fully up2date? If not please update them and try to reproduce again
2) Have you build and installed anything from source, if so please replace this with distro packages and try again
3) How are you connecting the client to the host, are both running on the same machine, or ... ?
4) Is your host / client / guest a 64 bit or 32 bit machine / install (please answer for all 3)
5) What model webcam are you using ?
6) Is the webcam plugged into an usb-3 or usb-2 port? 
7) What sort of error messages are you getting in dmesg in the guest and on the client ? (please provide dmesg output for both)
8) How exactly are you starting the vm, through virt-manager, or ... ? Any special settings ?

Comment 9 Christophe Fergeau 2015-10-14 11:41:00 UTC
(In reply to Hans de Goede from comment #8)
> I've tried to reproduce this once more:
> 
> 1) Using a rhel-7.2 host + client and rhel-7.1 guest as described in the
> problem description in bug 1268879, or using a rhel-7.1 guest on a Fedora-23
> host + client.
> 2) I've tried 2 different high-end (high-bandwidth) usb-2.0 cameras a 
> Microsoft LifeCam Studio and a Logitech Webcam Pro 9000
> 3) I've tried plugging them into either an ehci or an xhci controller on the
> client side
> 4) I've tried either stop cheese, un-redirect, re-redirect and stop cheese,
> close remote-viewer, reconnect remote-viewer
> 
> But I cannot reproduce this, the redireted camera stays working fine in all
> of the above scenarios and various combinations thereof.
> 
> So I've several questions, which may hopefully help me reproduce this:
> 
> 1) Are your host/client systems fully up2date? If not please update them and
> try to reproduce again
> 2) Have you build and installed anything from source, if so please replace
> this with distro packages and try again

I've made sure client and host are up to date (and rebooted them as there were kernel updates), I'm only using distro packages. I've tried different hosts now (7.2, 6.7, f23). I haven't tested with a rhel7 guest though, but with f22 livecd guest and rhel6 guest

> 3) How are you connecting the client to the host, are both running on the
> same machine, or ... ?

I tried both, f23 client/host same machine, and f23 client/remote rhel7/rhel6 hosts (rhel7 on the local network, rhel6 remotely)

> 4) Is your host / client / guest a 64 bit or 32 bit machine / install
> (please answer for all 3)

64 bit installs for all 3

> 5) What model webcam are you using ?

Internal t440s webcam ID 04f2:b39a Chicony Electronics Co., Ltd

> 6) Is the webcam plugged into an usb-3 or usb-2 port? 

During redirection, I get messages such as
[ 2372.581086] usb 1-8: reset high-speed USB device number 4 using xhci_hcd
[ 2372.803747] uvcvideo: Found UVC 1.00 device Integrated Camera (04f2:b39a)
I assume xhci_hcd means USB3? Just let me know if I shoud check this differently.

> 7) What sort of error messages are you getting in dmesg in the guest and on
> the client ? (please provide dmesg output for both)

After redirecting the webcam the 2nd time, I'm getting:

+[  124.890119] usb usb1-port2: cannot reset (err = -32)
+[  124.890128] usb usb1-port2: cannot reset (err = -32)
+[  124.890133] usb usb1-port2: cannot reset (err = -32)
+[  124.890139] usb usb1-port2: cannot reset (err = -32)
+[  124.890144] usb usb1-port2: cannot reset (err = -32)
+[  124.890145] usb usb1-port2: Cannot enable. Maybe the USB cable is bad?
+[  124.890166] usb usb1-port2: cannot reset (err = -32)
+[  124.890171] usb usb1-port2: cannot reset (err = -32)
+[  124.890177] usb usb1-port2: cannot reset (err = -32)
+[  124.890182] usb usb1-port2: cannot reset (err = -32)
+[  124.890187] usb usb1-port2: cannot reset (err = -32)
+[  124.890188] usb usb1-port2: Cannot enable. Maybe the USB cable is bad?
+[  124.890204] usb usb1-port2: cannot reset (err = -32)
+[  124.890210] usb usb1-port2: cannot reset (err = -32)
+[  124.890215] usb usb1-port2: cannot reset (err = -32)
+[  124.890220] usb usb1-port2: cannot reset (err = -32)
+[  124.890226] usb usb1-port2: cannot reset (err = -32)
+[  124.890227] usb usb1-port2: Cannot enable. Maybe the USB cable is bad?
+[  124.890243] usb usb1-port2: cannot reset (err = -32)
+[  124.890248] usb usb1-port2: cannot reset (err = -32)
+[  124.890254] usb usb1-port2: cannot reset (err = -32)
+[  124.890259] usb usb1-port2: cannot reset (err = -32)
+[  124.890265] usb usb1-port2: cannot reset (err = -32)
+[  124.890265] usb usb1-port2: Cannot enable. Maybe the USB cable is bad?
+[  124.890280] usb usb1-port2: unable to enumerate USB device
+[  125.114074] usb 2-2: new full-speed USB device number 2 using uhci_hcd
+[  125.567058] usb 2-2: not running at top speed; connect to a high speed hub
+[  125.663514] usb 2-2: New USB device found, idVendor=04f2, idProduct=b39a
+[  125.663517] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
+[  125.663519] usb 2-2: Product: Integrated Camera
+[  125.663520] usb 2-2: Manufacturer: SunplusIT INC.
+[  125.672119] uvcvideo: Found UVC 1.00 device Integrated Camera (04f2:b39a)
+[  125.687751] input: Integrated Camera as /devices/pci0000:00/0000:00:06.0/usb2/2-2/2-2:1.0/input/input6



> 8) How exactly are you starting the vm, through virt-manager, or ... ? Any
> special settings ?

Yup, virt-manager, apart from SPICE, usbredirection and picking a USB2 controller, there should not be anyting special, I'll attach the XML config.

Comment 10 Christophe Fergeau 2015-10-14 11:42:09 UTC
NB: I can only test f23 client as this is the only machine I have a webcam on :( Maybe I should try a rhel7 VM with redirected webcam as a client..

Comment 11 Christophe Fergeau 2015-10-14 11:43:08 UTC
<domain type='kvm'>
  <name>fedora22-wor</name>
  <uuid>d1a0a38e-341e-46b0-a0c3-c2d9aa993fef</uuid>
  <title>Fedora 22 Workstation</title>
  <metadata>
    <boxes:gnome-boxes xmlns:boxes="https://wiki.gnome.org/Apps/Boxes">
      <os-state>installed</os-state>
      <os-id>http://fedoraproject.org/fedora/22</os-id>
      <media-id>http://fedoraproject.org/fedora/22:1</media-id>
      <media>/home/teuf/redhat/isos/Fedora-Live-Workstation-x86_64-22-3.iso</media>
    </boxes:gnome-boxes>
  </metadata>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Haswell-noTSX</model>
    <topology sockets='1' cores='2' threads='2'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/home/teuf/.local/share/gnome-boxes/images/fedora22-wor'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/home/teuf/redhat/isos/Fedora-Live-Workstation-x86_64-22-3.iso' startupPolicy='optional'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:bc:1f:43'/>
      <source bridge='virbr0'/>
      <target dev='tap0'/>
      <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>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
      <streaming mode='all'/>
    </graphics>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='16384' vgamem='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <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>
  <seclabel type='dynamic' model='selinux' relabel='yes'/>
</domain>

Comment 12 Hans de Goede 2015-10-14 13:07:37 UTC
Ok, so I've created a vm using your xml + a RHEL-7.1 disk-img. Still no luck in reproducing. My setup is all 64 bit too. One thing which I had to remove from your xml is the cpu match, as that is for haswell and my workstation has sandybridge. I doubt that will make a difference though.

The dmesg you posted is that from the client or the guest ?

Are you using remote-viewer or something else to connect to the vm ?

Comment 13 Andrei Stepanov 2015-10-14 14:17:00 UTC
Hans de Goede  my answers to you question are:

1) Are your host/client systems fully up2date? If not please update them and try to reproduce again

All: guest/client/host are RHEL-7.2-20151013.n.0

qemu-kvm-1.5.3-104.el7.x86_64
kernel-3.10.0-323.el7.x86_64
spice-server-0.12.4-15.el7.x86_64
xorg-x11-drv-qxl-0.1.1-18.el7.x86_64
spice-vdagent-0.14.0-10.el7.x86_64

2) Have you build and installed anything from source, if so please replace this with distro packages and try again

No. It is pristine RHEL7.2


3) How are you connecting the client to the host, are both running on the same machine, or ... ?

Two different real hardware machines.


4) Is your host / client / guest a 64 bit or 32 bit machine / install (please answer for all 3)

all are x86_64


5) What model webcam are you using ?

Logitech Webcam C170


6) Is the webcam plugged into an usb-3 or usb-2 port? 

See attached lsusb -v at client


7) What sort of error messages are you getting in dmesg in the guest and on the 
client ? (please provide dmesg output for both)

Report has this info. dmesg and debug info.


8) How exactly are you starting the vm, through virt-manager, or ... ? Any special settings ?

Have you read report? It is the first step.

Comment 14 Andrei Stepanov 2015-10-14 14:20:35 UTC
Created attachment 1082838 [details]
Clients lsusb

Comment 15 Christophe Fergeau 2015-10-14 15:47:47 UTC
(In reply to Hans de Goede from comment #12)
> Ok, so I've created a vm using your xml + a RHEL-7.1 disk-img. Still no luck
> in reproducing. My setup is all 64 bit too. One thing which I had to remove
> from your xml is the cpu match, as that is for haswell and my workstation
> has sandybridge. I doubt that will make a difference though.

I can give you access to VMs where I can reproduce, if you can't, this would eliminate host/VM configuration differences.

> 
> The dmesg you posted is that from the client or the guest ?

It was in the guest, I think I posted client dmesg previously, with nothing unusual in it.

> 
> Are you using remote-viewer or something else to connect to the vm ?

Yes and I made sure that I use the f23 binary.

Comment 16 Hans de Goede 2015-10-15 06:47:35 UTC
(In reply to Andrei Stepanov from comment #13)
> Hans de Goede  my answers to you question are:
>
> 1) Are your host/client systems fully up2date? If not please update them and
> try to reproduce again
> 
> All: guest/client/host are RHEL-7.2-20151013.n.0

Erm, in the orginal report you write:

"Guest is:
virt-viewer-2.0-6.el7.x86_64

Client is:
RHEL 7.1"

I've been assuming that you've client <-> guest swapped here and that you we're using a 7.1 guest, is that correct, or have you been using a 7.2 guest all the time ?

> 6) Is the webcam plugged into an usb-3 or usb-2 port? 
> 
> See attached lsusb -v at client

That does not give that info actually.

> 7) What sort of error messages are you getting in dmesg in the guest and on
> the 
> client ? (please provide dmesg output for both)
> 
> Report has this info. dmesg and debug info.

It does not have dmesg output on the client side, only from inside the guest.

> 8) How exactly are you starting the vm, through virt-manager, or ... ? Any
> special settings ?
> 
> Have you read report? It is the first step.

Yes I've read the report, but I was asking this info from both you and Christopher and I did not have it from Christopher. Please show some more respect to your co-workers.

Comment 17 Hans de Goede 2015-10-15 06:50:05 UTC
(In reply to Christophe Fergeau from comment #15)
> I can give you access to VMs where I can reproduce, if you can't, this would
> eliminate host/VM configuration differences.

Hmm, doing webcam redirection over the internet will not really work properly. Can you reproduce this with say a usb-stick, or does it only happen with webcams ?

Anyways access to a vm which reproduces this would be helpful. so yes please.

Comment 18 Christophe Fergeau 2015-10-15 09:07:03 UTC
(In reply to Hans de Goede from comment #17)
> (In reply to Christophe Fergeau from comment #15)
> > I can give you access to VMs where I can reproduce, if you can't, this would
> > eliminate host/VM configuration differences.
> 
> Hmm, doing webcam redirection over the internet will not really work
> properly. Can you reproduce this with say a usb-stick, or does it only
> happen with webcams ?

I could not reproduce with usb stick (I redirected/unredirected/redirected USB stick, things were fine, I did the same with a USB webcam, the webcam redirection hit the bug, then I redid these steps with the USB stick, and at the end the USB stick is still accessible in the VM.

Comment 19 Hans de Goede 2015-10-15 11:12:10 UTC
I still cannot reproduce this with the vm which Christophe has made available.

Christophe, that vm is using a RHEL-6 host and using F-21 as guest, are you sure you can reproduce it with that specific vm ?

Comment 20 Christophe Fergeau 2015-10-15 12:31:33 UTC
Yes, the terminal which was kept open on that VM had logs of a previous test I did where I reproduced this bug. By now, I've been able to reproduce this on various host/guest combinations, which could mean it's an issue with my client OS/my hardware?

Comment 21 Hans de Goede 2015-10-15 13:44:06 UTC
Hi,

(In reply to Christophe Fergeau from comment #20)
> Yes, the terminal which was kept open on that VM had logs of a previous test
> I did where I reproduced this bug. By now, I've been able to reproduce this
> on various host/guest combinations, which could mean it's an issue with my
> client OS/my hardware?

I'm starting to think that it is a webcam specific issue. Do you perhaps have another webcam to try with ?

Regards,

Hans

Comment 22 Hans de Goede 2015-10-16 09:46:12 UTC
Hi  Andrei,

Can you please change the "debug=3" in the -device usb-redir,chardev=... part of your qemu start command to debug=4, redirect qemu-output to a logfile, then reproduce the problem and attach the generated logfile here ?

Thanks,

Hans

Comment 23 Hans de Goede 2015-10-16 09:54:02 UTC
Hi Andrei,

Can you also when reproducing start remote-viewer like this:

SPICE_DEBUG=1 remote-viewer spice://.... &> remote-viewer.log

And also attach the generated remote-viewer log file here please ?

Thanks,

Hans

Comment 24 Hans de Goede 2015-10-16 09:55:24 UTC
(In reply to Hans de Goede from comment #23)
> Hi Andrei,
> 
> Can you also when reproducing start remote-viewer like this:
> 
> SPICE_DEBUG=1 remote-viewer spice://.... &> remote-viewer.log
> 
> And also attach the generated remote-viewer log file here please ?

To clarify, since there are 2 remote viewer runs involved, please generate 2 separate log files and attach both.

Thanks,

Hans

Comment 25 Andrei Stepanov 2015-10-16 10:02:13 UTC
Created attachment 1083547 [details]
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=4

Comment 26 Andrei Stepanov 2015-10-16 10:07:54 UTC
Created attachment 1083550 [details]
SPICE_DEBUG=1 for remote-viewer (1)

Comment 27 Andrei Stepanov 2015-10-16 10:08:49 UTC
Created attachment 1083551 [details]
SPICE_DEBUG=1 for remote-viewer (2)

Comment 28 Christophe Fergeau 2015-10-16 10:29:14 UTC
(In reply to Hans de Goede from comment #21)

> I'm starting to think that it is a webcam specific issue. Do you perhaps
> have another webcam to try with ?
> 

Hmm I can try another embedded webcam from another laptop (running el7.1), but I don't have access to external USB webcams.

Comment 29 Hans de Goede 2015-10-16 12:33:20 UTC
(In reply to Andrei Stepanov from comment #25)
> Created attachment 1083547 [details]
> -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=4

So this shows everything going 100% as expected, so it must be qemu's ehci emulation which for some reason in some cases causes port resets to fail after the webcam has been redirected once, once the reset has failed 4 times the device gets handed over to the uhci controller, which is of course wrong for a usb-2 webcam.

Changing component to qemu as this seems to be an ehci emulation problem. With some luck Gerd (the qemu usb maintainer) can actually reproduce this, unlike me.

Comment 30 Andrei Stepanov 2015-10-20 10:38:24 UTC
I got another Logitech camera (gspca_zc3xx) to reproduce bug.
It doesn't work at all.
See logs.

Comment 31 Andrei Stepanov 2015-10-20 10:41:36 UTC
Created attachment 1084677 [details]
dmesg on guest with gspca_zc3xx

Comment 32 Andrei Stepanov 2015-10-20 10:44:50 UTC
Created attachment 1084678 [details]
qemu-kvm for debug=4 usbredirchardev, gspca_zc3xx

Comment 33 Andrei Stepanov 2015-10-20 10:50:46 UTC
Created attachment 1084679 [details]
virt-viewer log for gspca_zc3xx

Comment 34 Gerd Hoffmann 2015-10-21 07:44:14 UTC
> Changing component to qemu as this seems to be an ehci emulation problem.
> With some luck Gerd (the qemu usb maintainer) can actually reproduce this,
> unlike me.

suspend bit in portsc is stuck.  reproduce is as easy as just tick the webcam in virt-manager, wait a few seconds so the guest detects and suspends the device, then un-tick and re-tick.  No need to restart virt-viewer or use cheese.  Once the port is stuck in that state any device will trigger the bug.

Comment 35 Gerd Hoffmann 2015-10-21 07:45:28 UTC
https://patchwork.ozlabs.org/patch/533649/

Comment 37 Gerd Hoffmann 2015-11-13 13:49:41 UTC
patch posted.

Comment 38 Miroslav Rezanina 2016-01-13 11:17:32 UTC
Fix included in qemu-kvm-1.5.3-106.el7

Comment 39 David Jaša 2016-02-17 14:10:11 UTC
*** Bug 1256864 has been marked as a duplicate of this bug. ***

Comment 41 Victor Toso 2016-03-30 09:08:54 UTC
*** Bug 1268290 has been marked as a duplicate of this bug. ***

Comment 42 Guo, Zhiyi 2016-05-25 05:53:48 UTC
Reproduced on qemu-kvm-1.5.3-105.el7.x86_64:

Steps
1.Launch rhel7.2 guest using virt-manager
2.Connect guest by remote-viewer spice://host_ip:5900, form ui, select "File" -> "USB device selection" -> select webcamera device(Integrated camera in my case)
3.In guest, goto "Application" -> "Sound & Video" -> "Cheese", video output correctly from Cheese.
4.Unselect webcamera device and select it again from "USB device selection" and redo step 3. 

Expect results:
Video output correctly from Cheese after step 4
Actual results:
Cheese prompt error and error log prompt from kernel log:
 
<6>[ 7451.177757] usb 1-3: USB disconnect, device number 10
<3>[ 7459.410778] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410788] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410794] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410800] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410807] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410807] usb usb1-port3: Cannot enable. Maybe the USB cable is bad?
<3>[ 7459.410829] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410835] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410842] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410848] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410854] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410854] usb usb1-port3: Cannot enable. Maybe the USB cable is bad?
<3>[ 7459.410872] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410878] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410884] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410890] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410896] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410897] usb usb1-port3: Cannot enable. Maybe the USB cable is bad?
<3>[ 7459.410914] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410920] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410926] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410932] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410938] usb usb1-port3: cannot reset (err = -32)
<3>[ 7459.410939] usb usb1-port3: Cannot enable. Maybe the USB cable is bad?
<3>[ 7459.410954] usb usb1-port3: unable to enumerate USB device
<6>[ 7459.639729] usb 3-1: new full-speed USB device number 9 using uhci_hcd
<6>[ 7460.006569] usb 3-1: not running at top speed; connect to a high speed hub
<6>[ 7460.083143] usb 3-1: New USB device found, idVendor=04ca, idProduct=7049
<6>[ 7460.083146] usb 3-1: New USB device strings: Mfr=3, Product=1, SerialNumber=2
<6>[ 7460.083148] usb 3-1: Product: Integrated Camera
<6>[ 7460.083149] usb 3-1: Manufacturer: SC20F26946AB5C8061H
<6>[ 7460.083150] usb 3-1: SerialNumber: 200901010001
<6>[ 7460.093639] uvcvideo: Found UVC 1.00 device Integrated Camera (04ca:7049)
<6>[ 7460.116675] input: Integrated Camera as /devices/pci0000:00/0000:00:06.1/usb3/3-1/3-1:1.0/input/input14


Verify this bug on qemu-kvm-1.5.3-112.el7.x86_64:
Following same steps, Cheese always can be used correctly and no error log prompt from kernel log

Comment 45 errata-xmlrpc 2016-11-03 20:05:33 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-2016-2585.html