qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [BUG] -usb makes qemu fight against linux
@ 2009-03-06  8:54 Stan Behrens
  2009-04-24 10:05 ` Paul Bolle
  0 siblings, 1 reply; 3+ messages in thread
From: Stan Behrens @ 2009-03-06  8:54 UTC (permalink / raw)
  To: qemu-devel

Hi List,

when you add a bluetooth-dongle, usb-flash-drive or something like that via:
usb_add host:2.23
to you're guest-OS, qemu starts to fight against the linux-usb-configuration.

qemu's output looks like this:
husb: open device 2.32
husb: config #1 need -1
husb: 1 interfaces claimed for configuration 1
husb: grabbed usb device 2.32
husb: config #1 need 1
husb: 1 interfaces claimed for configuration 1
husb: config #1 need 1
husb: 1 interfaces claimed for configuration 1
husb: config #1 need 1
husb: 1 interfaces claimed for configuration 1
husb: config #1 need 1
husb: 1 interfaces claimed for configuration 1

And '# dmesg' says:
[12929.001037] usb 2-3: reset high speed USB device using ehci_hcd and address 32
[12929.782032] usb 2-3: reset high speed USB device using ehci_hcd and address 32
[12930.176041] usb 2-3: reset high speed USB device using ehci_hcd and address 32
[12930.726032] usb 2-3: reset high speed USB device using ehci_hcd and address 32

I tried to prevent foreign communication to the usb-device via:
# udevadm control --stop_exec_queue
# modprobe -r sd_mod usb-storage btusb
# mount -t usbfs -o devmode=0600,devuid=1000,devgid=1000 none /proc/bus/usb/
but it does not help.

The Command-Line I used:
qemu-svn/bin/qemu -L qemu-svn/share/qemu -no-quit -m 512 -net nic -net tap,ifname=job,script=no,downscript=no -drive file=image -startdate 2008-12-24 -usb -snapshot

qemu-svn: 'At revision 6718.'.


Bye.

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

* Re: [Qemu-devel] [BUG] -usb makes qemu fight against linux
  2009-03-06  8:54 [Qemu-devel] [BUG] -usb makes qemu fight against linux Stan Behrens
@ 2009-04-24 10:05 ` Paul Bolle
  2009-04-24 10:44   ` Paul Bolle
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Bolle @ 2009-04-24 10:05 UTC (permalink / raw)
  To: Stan Behrens; +Cc: qemu-devel

On Fri, 2009-03-06 at 09:54 +0100, Stan Behrens wrote:
> when you add a bluetooth-dongle, usb-flash-drive or something like that via:
> usb_add host:2.23
> to you're guest-OS, qemu starts to fight against the linux-usb-configuration.
> 
> qemu's output looks like this:
> husb: open device 2.32
> husb: config #1 need -1
> husb: 1 interfaces claimed for configuration 1
> husb: grabbed usb device 2.32
> husb: config #1 need 1
> husb: 1 interfaces claimed for configuration 1
> husb: config #1 need 1
> husb: 1 interfaces claimed for configuration 1
> husb: config #1 need 1
> husb: 1 interfaces claimed for configuration 1
> husb: config #1 need 1
> husb: 1 interfaces claimed for configuration 1
> 
> And '# dmesg' says:
> [12929.001037] usb 2-3: reset high speed USB device using ehci_hcd and address 32
> [12929.782032] usb 2-3: reset high speed USB device using ehci_hcd and address 32
> [12930.176041] usb 2-3: reset high speed USB device using ehci_hcd and address 32
> [12930.726032] usb 2-3: reset high speed USB device using ehci_hcd and address 32

This seems related to this discussion:
http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg01320.html (in a
thread regarding a preliminary patch to implement ehci).

Could you try the following patch? It was created after finally
discovering the discussion mentioned above (which I hardly understand,
which in turn leads to an impressive, but possibly nonsensical commit
message for this patch). It seems to fix a similar issue I ran into
(while trying some advanced feature of a USB memory stick I happen to
have.)


Paul Bolle
---
[PATCH] usb-linux: use USB_RET_STALL on -EPIPE URB status

If ioctl([...], USBDEVFS_REAPURBNDELAY, [...]) sets the URB status to
-EPIPE use USB_RET_STALL (and not USB_RET_NAK). USB_RET_NAK can confuse
guests and seems to trigger some guests to repeatedly request port
resets, which slows down (or even blocks) USB operations.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
 usb-linux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/usb-linux.c b/usb-linux.c
index 70d7a1c..80ef6fc 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -277,7 +277,7 @@ static void async_complete(void *opaque)
                 set_halt(s, p->devep);
                 /* fall through */
             default:
-                p->len = USB_RET_NAK;
+                p->len = USB_RET_STALL;
                 break;
             }
 
-- 
1.6.2.2

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

* Re: [Qemu-devel] [BUG] -usb makes qemu fight against linux
  2009-04-24 10:05 ` Paul Bolle
@ 2009-04-24 10:44   ` Paul Bolle
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Bolle @ 2009-04-24 10:44 UTC (permalink / raw)
  To: Stan Behrens; +Cc: qemu-devel

On Fri, 2009-04-24 at 12:05 +0200, Paul Bolle wrote:
> On Fri, 2009-03-06 at 09:54 +0100, Stan Behrens wrote:
> This seems related to this discussion:
> http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg01320.html (in a
> thread regarding a preliminary patch to implement ehci).
> 
> Could you try the following patch? It was created after finally
> discovering the discussion mentioned above (which I hardly understand,
> which in turn leads to an impressive, but possibly nonsensical commit
> message for this patch). It seems to fix a similar issue I ran into
> (while trying some advanced feature of a USB memory stick I happen to
> have.)

I just found a slightly different and, I guess, better solution here:
http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg01326.html (I
seem to have missed this messages in that archive as it is, for some
reason, a separate thread).

I simply copied it from that address into this mail. It will probably
not apply without manual adjustments.


Paul Bolle
---
Index: usb-linux.c
===================================================================
--- usb-linux.c (revision 5571)
+++ usb-linux.c (working copy)
@@ -68,7 +68,7 @@
 static int usb_host_find_device(int *pbus_num, int *paddr,
                                 char *product_name, int
product_name_size,
                                 const char *devname);
-//#define DEBUG
+// #define DEBUG
 
 #ifdef DEBUG
 #define dprintf printf
@@ -276,7 +276,9 @@
 
             case -EPIPE:
                 set_halt(s, p->devep);
-                /* fall through */
+               p->len = USB_RET_STALL;
+               break;
+
             default:
                 p->len = USB_RET_NAK;
                 break;

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

end of thread, other threads:[~2009-04-24 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-06  8:54 [Qemu-devel] [BUG] -usb makes qemu fight against linux Stan Behrens
2009-04-24 10:05 ` Paul Bolle
2009-04-24 10:44   ` Paul Bolle

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).