qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] USB continuous reset / unplug cleanup not done properly
@ 2011-12-14 14:29 erik.rull
  2011-12-19  9:00 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: erik.rull @ 2011-12-14 14:29 UTC (permalink / raw)
  To: qemu-devel

Hi all,

I experience several problems using the usb-host USB routing feature to the
guest.

1) Devices get resetted again and again on the host side and do not work
properly on the guest side - they work fine on the host side outside qemu.
2) Unplugged devices remain in the "info usb" list

I start up qemu-kvm-1.0

(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
(qemu) info usbhost
husb: using sys file-system with /dev/bus/usb
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020

plug in a usb key

[ 3681.562935] usb 2-1.4: new high speed USB device using ehci_hcd and
address 16
[ 3681.651168] usb 2-1.4: configuration #1 chosen from 1 choice
[ 3681.651485] scsi37 : SCSI emulation for USB Mass Storage devices
[ 3681.651645] usb-storage: device found at 16
[ 3681.651758] usb-storage: waiting for device to settle before scanning
[ 3687.579074] scsi 37:0:0:0: Direct-Access     USB      DISK 2.0        
0604 PQ: 0 ANSI: 0 CCS
[ 3687.579371] sd 37:0:0:0: Attached scsi generic sg1 type 0
[ 3687.580601] usb-storage: device scan complete
[ 3687.581516] sd 37:0:0:0: [sdb] 3981312 512-byte logical blocks: (2.03
GB/1.89 GiB)
[ 3687.582688] sd 37:0:0:0: [sdb] Write Protect is off
[ 3687.582806] sd 37:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 3687.582886] sd 37:0:0:0: [sdb] Assuming drive cache: write through
[ 3687.585932] sd 37:0:0:0: [sdb] Assuming drive cache: write through
[ 3687.586019]  sdb: sdb1
[ 3687.588551] sd 37:0:0:0: [sdb] Assuming drive cache: write through
[ 3687.588643] sd 37:0:0:0: [sdb] Attached SCSI removable disk
[ 3749.074062] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 16
[ 3749.384065] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 16
[ 3749.666806] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1

(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 16, Port 1.4, Speed 480 Mb/s
    Class 00: USB device 090c:1000, DISK 2.0
(qemu)

add it to qemu

(qemu) device_add usb-host,hostbus=2,hostport=1.4

(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 1.1, Port 1, Speed 480 Mb/s, Product DISK 2.0
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 16, Port 1.4, Speed 480 Mb/s
    Class 00: USB device 090c:1000, DISK 2.0
  Auto filters:
    Bus 2, Addr *, Port 1.4, ID *:*
(qemu)
up to here is everything fine
now unplugging the usb device

[ 3812.970174] usb 2-1.4: USB disconnect, address 16

plugging in another USB key

[ 3893.786934] usb 2-1.4: new high speed USB device using ehci_hcd and
address 17
[ 3893.880414] usb 2-1.4: configuration #1 chosen from 1 choice
[ 3893.880776] scsi38 : SCSI emulation for USB Mass Storage devices
[ 3893.880941] usb-storage: device found at 17
[ 3893.881019] usb-storage: waiting for device to settle before scanning
[ 3894.588808] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 17
[ 3908.951434] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 17
[ 3909.117433] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 17
[ 3909.277436] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 17
[ 3909.366994] usb-storage: device scan complete
[ 3909.539434] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 17
[ 3915.918311] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 17

doesn't work properly with qemu, removing it

[ 4009.066172] usb 2-1.4: USB disconnect, address 17

(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 1.1, Port 1, Speed 480 Mb/s, Product DISK 2.0
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Auto filters:
    Bus 2, Addr *, Port 1.4, ID *:*
(qemu) 

why is the usb key still present?
in the guest it is no longer visible

plugging in another usb device

(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 1.0, Port 1, Speed 480 Mb/s, Product Imation
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 17, Port 1.4, Speed 480 Mb/s
    Class 00: USB device 0718:0064, Imation
  Auto filters:
    Bus 2, Addr *, Port 1.4, ID *:*
(qemu)
device get reset from time to time, runs perfect in plain linux host
environment, not usable on guest side, gets only detected but the file
access is impossible

[ 4018.203063] usb 2-1.4: new high speed USB device using ehci_hcd and
address 18
[ 4038.291913] usb 2-1.4: configuration #1 chosen from 1 choice
[ 4038.292171] scsi39 : SCSI emulation for USB Mass Storage devices
[ 4038.292251] usb-storage: device found at 18
[ 4038.292252] usb-storage: waiting for device to settle before scanning
[ 4039.422559] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4039.732558] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4040.012456] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4074.701937] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4074.787803] scsi40 : SCSI emulation for USB Mass Storage devices
[ 4074.788436] usb-storage: device found at 18
[ 4074.788437] usb-storage: waiting for device to settle before scanning
[ 4075.012936] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4075.223815] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4094.730811] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4094.816665] scsi41 : SCSI emulation for USB Mass Storage devices
[ 4094.817316] usb-storage: device found at 18
[ 4094.817318] usb-storage: waiting for device to settle before scanning
[ 4095.040685] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4095.252501] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4114.758561] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4114.844418] scsi42 : SCSI emulation for USB Mass Storage devices
[ 4114.845067] usb-storage: device found at 18
[ 4114.845069] usb-storage: waiting for device to settle before scanning
[ 4115.069555] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4115.281310] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4134.786310] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4134.872208] scsi43 : SCSI emulation for USB Mass Storage devices
[ 4134.876182] usb-storage: device found at 18
[ 4134.876185] usb-storage: waiting for device to settle before scanning
[ 4135.097313] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4135.318192] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4148.806062] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4148.891676] scsi44 : SCSI emulation for USB Mass Storage devices
[ 4148.892341] usb-storage: device found at 18
[ 4148.892343] usb-storage: waiting for device to settle before scanning
[ 4149.117056] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4149.327979] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4162.825814] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4162.911422] scsi45 : SCSI emulation for USB Mass Storage devices
[ 4162.912124] usb-storage: device found at 18
[ 4162.912126] usb-storage: waiting for device to settle before scanning
[ 4163.136811] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4163.347622] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4173.842060] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4173.927664] scsi46 : SCSI emulation for USB Mass Storage devices
[ 4173.928301] usb-storage: device found at 18
[ 4173.928302] usb-storage: waiting for device to settle before scanning
[ 4174.152060] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4174.364862] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4184.857310] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4184.942917] scsi47 : SCSI emulation for USB Mass Storage devices
[ 4184.943573] usb-storage: device found at 18
[ 4184.943575] usb-storage: waiting for device to settle before scanning
[ 4185.167308] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4185.379196] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4195.872561] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4195.958042] scsi48 : SCSI emulation for USB Mass Storage devices
[ 4195.958653] usb-storage: device found at 18
[ 4195.958654] usb-storage: waiting for device to settle before scanning
[ 4196.183560] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4196.395198] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4206.888811] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4206.974290] scsi49 : SCSI emulation for USB Mass Storage devices
[ 4206.974933] usb-storage: device found at 18
[ 4206.974935] usb-storage: waiting for device to settle before scanning
[ 4207.198810] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4207.409684] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4545.364689] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4545.450172] scsi50 : SCSI emulation for USB Mass Storage devices
[ 4545.450917] usb-storage: device found at 18
[ 4545.450996] usb-storage: waiting for device to settle before scanning
[ 4545.675561] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4545.886437] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4556.379937] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4556.465422] scsi51 : SCSI emulation for USB Mass Storage devices
[ 4556.466178] usb-storage: device found at 18
[ 4556.466256] usb-storage: waiting for device to settle before scanning
[ 4556.690808] usb 2-1.4: reset high speed USB device using ehci_hcd and
address 18
[ 4556.902625] usb 2-1.4: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4563.305886] usb 2-1.4: USB disconnect, address 18

finally, removed from the PC
device gets reset again and again, this piece of hardware was working on
qemu 0.14!

next thing is the DVD drive (via USB)
plugging it in (on another port):
(qemu) device_add usb-host,hostbus=2,hostport=1.2

[ 4601.626686] usb 2-1.2: new high speed USB device using ehci_hcd and
address 19
[ 4601.734419] usb 2-1.2: configuration #1 chosen from 1 choice
[ 4601.734863] scsi52 : SCSI emulation for USB Mass Storage devices
[ 4601.735022] usb-storage: device found at 19
[ 4601.735100] usb-storage: waiting for device to settle before scanning
[ 4606.769533] scsi 52:0:0:0: CD-ROM            HL-DT-ST DVDRRW GSA-2166D
1.01 PQ: 0 ANSI: 0
[ 4607.016936] sr0: scsi3-mmc drive: 48x/48x writer dvd-ram cd/rw xa/form2
cdda tray
[ 4607.017134] sr 52:0:0:0: Attached scsi CD-ROM sr0
[ 4607.017285] sr 52:0:0:0: Attached scsi generic sg1 type 5
[ 4607.017464] usb-storage: device scan complete
[ 4672.223312] usb 2-1.2: reset high speed USB device using ehci_hcd and
address 19
[ 4672.544308] usb 2-1.2: reset high speed USB device using ehci_hcd and
address 19
[ 4672.837083] usb 2-1.2: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1
[ 4676.549689] usb 2-1.2: reset high speed USB device using ehci_hcd and
address 19
[ 4676.644718] scsi53 : SCSI emulation for USB Mass Storage devices
[ 4676.645726] usb-storage: device found at 19
[ 4676.645805] usb-storage: waiting for device to settle before scanning
[ 4676.869558] usb 2-1.2: reset high speed USB device using ehci_hcd and
address 19
[ 4677.092409] usb 2-1.2: usbfs: interface 0 claimed by usb-storage while
'qemu-system-x86' sets config #1

(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 1.1, Port 1, Speed 480 Mb/s, Product Imation
  Device 1.2, Port 2, Speed 480 Mb/s, Product Super Multi DVD Rewriter
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 19, Port 1.2, Speed 480 Mb/s
    Class 00: USB device 152e:2507, Super Multi DVD Rewriter
  Auto filters:
    Bus 2, Addr *, Port 1.4, ID *:*
    Bus 2, Addr *, Port 1.2, ID *:*
(qemu)

again - why is the USB key still present?
it was remove before!

Disconnecting the DVD drive:

[ 9540.202181] usb 2-1.2: USB disconnect, address 19

(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 1.1, Port 1, Speed 480 Mb/s, Product Imation
  Device 1.2, Port 2, Speed 480 Mb/s, Product Super Multi DVD Rewriter
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0020
  Auto filters:
    Bus 2, Addr *, Port 1.4, ID *:*
    Bus 2, Addr *, Port 1.2, ID *:*
(qemu)

Finally - both DVD and USB key remain listed, why?


Best regards,

Erik

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] USB continuous reset / unplug cleanup not done properly
  2011-12-14 14:29 [Qemu-devel] USB continuous reset / unplug cleanup not done properly erik.rull
@ 2011-12-19  9:00 ` Gerd Hoffmann
  2011-12-19 17:31   ` Erik Rull
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2011-12-19  9:00 UTC (permalink / raw)
  To: erik.rull; +Cc: qemu-devel

  Hi,

> 1) Devices get resetted again and again on the host side and do not work
> properly on the guest side - they work fine on the host side outside qemu.

I see those too.  Not clear what is going on here.  usbfs requests seem
to get stuck now and then for not-yet known reasons.  Sometimes they
finish after a few seconds.  Sometimes they get stuck long enougth that
some timeout within the guest fires and the guest resets the device.

I see those with a F16 guest which polls the usb stick with
test-unit-ready requests.  Letting it run idle produces a ...

   usb 1-6: reset high speed USB device number 3 using ehci_hcd

... log line line in the guest now and then.  Tried to write a small
reproducer (tool constantly sending test-unit-ready via usbfs), but that
one works just fine without any hangs.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] USB continuous reset / unplug cleanup not done properly
  2011-12-19  9:00 ` Gerd Hoffmann
@ 2011-12-19 17:31   ` Erik Rull
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Rull @ 2011-12-19 17:31 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

Hi Gerd,

Gerd Hoffmann wrote:
>    Hi,
>
>> 1) Devices get resetted again and again on the host side and do not work
>> properly on the guest side - they work fine on the host side outside qemu.
>
> I see those too.  Not clear what is going on here.  usbfs requests seem
> to get stuck now and then for not-yet known reasons.  Sometimes they
> finish after a few seconds.  Sometimes they get stuck long enougth that
> some timeout within the guest fires and the guest resets the device.

Is it possible to increase either the timeout periods or "block" the USB 
device during it is in use by the guest, so that usbfs does not want to 
reset it?

> I see those with a F16 guest which polls the usb stick with
> test-unit-ready requests.  Letting it run idle produces a ...
>
>     usb 1-6: reset high speed USB device number 3 using ehci_hcd
>
> ... log line line in the guest now and then.  Tried to write a small
> reproducer (tool constantly sending test-unit-ready via usbfs), but that
> one works just fine without any hangs.

Is it possible to trace the USB requests at this level? Maybe there is a 
possibility to figure out why the reset happens.

> cheers,
>    Gerd
>

Any idea about the second point regarding the remaining devices in the info 
usb list?

Best regards,

Erik

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-19 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-14 14:29 [Qemu-devel] USB continuous reset / unplug cleanup not done properly erik.rull
2011-12-19  9:00 ` Gerd Hoffmann
2011-12-19 17:31   ` Erik Rull

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).