-usb makes qemu fight against linux
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.
Quoted 18 lines · Stan Behrens
when you add a bluetooth-dongle, usb-flash-drive or something like that via:
usb_addhost: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
Quoted 5 lines
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.
--- usb-linux.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
usb-linux.c +1 -1
@@ -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 ; }
Signature · 1 line
1.6.2.2
Quoted 11 lines · Paul Bolle
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
---
usb-linux.c (working copy) renamed from usb-linux.c (revision 5571) +0 -0
@@ -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;