diff mbox

usb: queue can have async packets too

Message ID 1330439808-524-1-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Feb. 28, 2012, 2:36 p.m. UTC
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Erik Rull March 2, 2012, 1:14 p.m. UTC | #1
On February 28, 2012 at 3:36 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/usb.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/hw/usb.c b/hw/usb.c
> index 57fc5e3..fc41d62 100644
> --- a/hw/usb.c
> +++ b/hw/usb.c
> @@ -356,6 +356,9 @@ void usb_packet_complete(USBDevice *dev, USBPacket
*p)
> 
>      while (!QTAILQ_EMPTY(&ep->queue)) {
>          p = QTAILQ_FIRST(&ep->queue);
> +        if (p->state == USB_PACKET_ASYNC) {
> +            break;
> +        }
>          assert(p->state == USB_PACKET_QUEUED);
>          ret = usb_process_one(p);
>          if (ret == USB_RET_ASYNC) {
> --
> 1.7.1
>
>


Hi Gerd,

this fixes my issue.

But: This + the latest GIT master causes again my problems with the
incomplete routing of host devices if the devices are plugged in before
starting up the guest. They are marked with a yellow exclamation mark in
the XP device manager. If I plug them in later, they are working fine.

This was working before the commit that cause the assertion and is now not
working again.

Please have a look at that!

Best regards,

Erik
Gerd Hoffmann March 2, 2012, 2:15 p.m. UTC | #2
> But: This + the latest GIT master causes again my problems with the

With or without this one:

commit 5ca2358ac895139e624881c5b3bf3095d3cc4515
Date:   Wed Feb 29 09:11:00 2012 -0600

    Merge remote-tracking branch 'kraxel/usb.39' into staging

?

cheers,
  Gerd
Erik Rull March 5, 2012, 10:22 a.m. UTC | #3
On March 2, 2012 at 3:15 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> > But: This + the latest GIT master causes again my problems with the
>
> With or without this one:
>
> commit 5ca2358ac895139e624881c5b3bf3095d3cc4515
> Date:   Wed Feb 29 09:11:00 2012 -0600
>
>     Merge remote-tracking branch 'kraxel/usb.39' into staging
>
> ?
>
> cheers,
>   Gerd
>
>


Hi Gerd,

I'm really sorry, but after rechecking my versions that worked (doing git
checkouts there) I don't get it working again :-(
I have no idea what's wrong now...

The startup issue is existing now again on all versions I tested - maybe
this was just a side effect during the bisect?

So finally - with the current master + your patch the assertion failed is
fixed but the startup issue seems to remain.

Any ideas how I could help you debugging this issue?
I tested it on Windows XP and a plain vanilla kernel 2.6.29.12 linux system
- both show the same behavior.

Attached the usb-filtered-dmesg from my guest linux booting up.
If you need further information, please let me know!
The usb 1-1 is my USB msd that gets not detected properly...

Thanks a lot!

Best regards,

Erik

172.17.17.183 ~ # dmesg | grep "usb" -i
[    0.151096] usbcore: registered new interface driver usbfs
[    0.151591] usbcore: registered new interface driver hub
[    0.152031] usbcore: registered new device driver usb
[    0.841074] usbmon: debugfs is not available
[    0.841506] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.843518] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus
number 1
[    1.170948] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[    1.171532] usb usb1: configuration #1 chosen from 1 choice
[    1.172080] hub 1-0:1.0: USB hub found
[    1.173100] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.173602] uhci_hcd: USB Universal Host Controller Interface driver
[    1.175625] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus
number 2
[    1.177092] usb usb2: configuration #1 chosen from 1 choice
[    1.177599] hub 2-0:1.0: USB hub found
[    1.180072] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus
number 3
[    1.181477] usb usb3: configuration #1 chosen from 1 choice
[    1.182025] hub 3-0:1.0: USB hub found
[    1.184472] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus
number 4
[    1.185872] usb usb4: configuration #1 chosen from 1 choice
[    1.186419] hub 4-0:1.0: USB hub found
[    1.187396] Initializing USB Mass Storage driver...
[    1.187876] usbcore: registered new interface driver usb-storage
[    1.188392] USB Mass Storage support registered.
[    1.188852] usbcore: registered new interface driver ums-datafab
[    1.189394] usbcore: registered new interface driver ums-freecom
[    1.189882] usbcore: registered new interface driver ums-isd200
[    1.190415] usbcore: registered new interface driver ums-jumpshot
[    1.190961] usbcore: registered new interface driver ums-sddr09
[    1.191447] usbcore: registered new interface driver ums-sddr55
[    1.192015] usbcore: registered new interface driver usbserial
[    1.192506] USB Serial support registered for generic
[    1.193031] usbcore: registered new interface driver usbserial_generic
[    1.193510] usbserial: USB Serial Driver core
[    1.194013] USB Serial support registered for cp210x
[    1.194482] usbcore: registered new interface driver cp210x
[    1.197268] USB Serial support registered for pl2303
[    1.197741] usbcore: registered new interface driver pl2303
[    1.198255] pl2303: Prolific PL2303 USB to serial adaptor driver
[    1.206945] usbcore: registered new interface driver usbhid
[    1.206945] usbhid: v2.6:USB HID core driver
[    1.808963] usb 1-1: new high speed USB device using ehci_hcd and
address 2
[    2.182204] usb 1-1: configuration #1 chosen from 1 choice
[    2.183150] scsi2 : SCSI emulation for USB Mass Storage devices
[    2.184084] usb-storage: device found at 2
[    2.184085] usb-storage: waiting for device to settle before scanning
[    2.545015] usb 2-2: new full speed USB device using uhci_hcd and
address 2
[    2.895181] usb 2-2: configuration #1 chosen from 1 choice
[    2.911124] input: QEMU 1.0.50 QEMU USB Tablet as
/devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/input/input3
[    2.912007] generic-usb 0003:0627:0001.0001: input: USB HID v0.01
Pointer [QEMU 1.0.50 QEMU USB Tablet] on usb-0000:00:1d.0-2/input0
[    7.296026] usb 1-1: reset high speed USB device using ehci_hcd and
address 2
[    7.531025] usb 1-1: reset high speed USB device using ehci_hcd and
address 2
[    7.767025] usb 1-1: reset high speed USB device using ehci_hcd and
address 2
[    8.003025] usb 1-1: reset high speed USB device using ehci_hcd and
address 2
[    8.129208] usb-storage: device scan complete
172.17.17.183 ~ #
Erik Rull March 6, 2012, 3:40 p.m. UTC | #4
On March 5, 2012 at 11:22 AM Erik Rull <erik.rull@rdsoftware.de> wrote:

>
>
>
> On March 2, 2012 at 3:15 PM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> > > But: This + the latest GIT master causes again my problems with the
> >
> > With or without this one:
> >
> > commit 5ca2358ac895139e624881c5b3bf3095d3cc4515
> > Date:   Wed Feb 29 09:11:00 2012 -0600
> >
> >     Merge remote-tracking branch 'kraxel/usb.39' into staging
> >
> > ?
> >
> > cheers,
> >   Gerd
> >
> >
>
>
> Hi Gerd,
>
> I'm really sorry, but after rechecking my versions that worked (doing git
> checkouts there) I don't get it working again :-(
> I have no idea what's wrong now...
>
> The startup issue is existing now again on all versions I tested - maybe
> this was just a side effect during the bisect?
>
> So finally - with the current master + your patch the assertion failed is
> fixed but the startup issue seems to remain.
>
> Any ideas how I could help you debugging this issue?
> I tested it on Windows XP and a plain vanilla kernel 2.6.29.12 linux
system
> - both show the same behavior.
>
> Attached the usb-filtered-dmesg from my guest linux booting up.
> If you need further information, please let me know!
> The usb 1-1 is my USB msd that gets not detected properly...
>
> Thanks a lot!
>
> Best regards,
>
> Erik

It's getting pretty ugly. Today I wanted to test the executable with
enabled tracing - and it worked. I reconfigured to "nop-tracing" and it
still works - but only on Linux guest side, the Windows guest still has
some issues - with or without tracing enabled.

Would the usb-tracing output help you to find a possible source of the
problem? The logfiles are pretty large (0.5 and 1.1 MB gzip! / uncompressed
~ 70 / 140 MB).

Best regards,

Erik
diff mbox

Patch

diff --git a/hw/usb.c b/hw/usb.c
index 57fc5e3..fc41d62 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -356,6 +356,9 @@  void usb_packet_complete(USBDevice *dev, USBPacket *p)
 
     while (!QTAILQ_EMPTY(&ep->queue)) {
         p = QTAILQ_FIRST(&ep->queue);
+        if (p->state == USB_PACKET_ASYNC) {
+            break;
+        }
         assert(p->state == USB_PACKET_QUEUED);
         ret = usb_process_one(p);
         if (ret == USB_RET_ASYNC) {