From: Roger Quadros <rogerq@ti.com>
To: <mathias.nyman@intel.com>
Cc: <balbi@ti.com>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/5] usb: xhci: Fix breakage on dual-role case
Date: Thu, 20 Aug 2015 10:09:29 +0300 [thread overview]
Message-ID: <55D57D29.1040702@ti.com> (raw)
In-Reply-To: <1439894354-6160-1-git-send-email-rogerq@ti.com>
Hi Mathias,
On 18/08/15 13:39, Roger Quadros wrote:
> Hi,
>
> Plugging and unplugging a USB-OTG adapter with a USB device into a
> am437x-gp-evm dual-role port (USB1) causes XHCI to malfunction
> and USB device to be no longer detected after a few iterations.
>
> The triggering case is so
> 1) USB1 in peripheal mode
> 2) plug OTG adapter with USB device
> 3) USB1 switches to host mode
> 4) Detects new USB device
> 5) unplug OTG adapter
> 6) OTG core tries to remove host controller while new device
> is being processed.
>
> At 6 some races are observed in the XHCI driver causing it to
> malfunction. See kernel log at the end of this mail.
>
> This series tries to address some of the issues.
> Althouth it is not 100% fool proof yet and XHCI can still get
> stuck up for a few seconds occasionally, it did recover always
> in a max of 10 seconds and the USB device was enumerated after
> that.
>
> During a dual-role switch, usb_remove_hcd() and usb_add_hcd()
> will be called consecutively for both Shared and Primary
> HCDs. This can happen asynchronously and we have to be prepared
> for it.
>
Even after this series I do occasionally see a delay of 5 seconds
during adapter detach. (please see kernel log below).
Is it possible to further optimize so that when xhci_stop is called
we don't depend entirely on timeout timers to stop queued commands?
[ 106.301771] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 106.307480] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 3
[ 106.320818] xhci-hcd xhci-hcd.0.auto: hcc params 0x0238f06d hci version 0x100 quirks 0x00010010
[ 106.329809] xhci-hcd xhci-hcd.0.auto: irq 253, io mem 0x48390000
[ 106.337587] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002
[ 106.344455] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 106.352769] usb usb3: Product: xHCI Host Controller
[ 106.357813] usb usb3: Manufacturer: Linux 4.1.6-01054-g496f557-dirty xhci-hcd
[ 106.365012] usb usb3: SerialNumber: xhci-hcd.0.auto
[ 106.381914] hub 3-0:1.0: USB hub found
[ 106.390765] hub 3-0:1.0: 1 port detected
[ 106.400732] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 106.407492] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 4
[ 106.421396] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[ 106.436701] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003
[ 106.443577] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 106.454456] usb usb4: Product: xHCI Host Controller
[ 106.460990] usb usb4: Manufacturer: Linux 4.1.6-01054-g496f557-dirty xhci-hcd
[ 106.473275] usb usb4: SerialNumber: xhci-hcd.0.auto
[ 106.502263] hub 4-0:1.0: USB hub found
[ 106.511431] hub 4-0:1.0: 1 port detected
[ 106.715490] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[ 106.822091] xhci-hcd xhci-hcd.0.auto: remove, state 4
[ 106.827261] usb usb4: USB disconnect, device number 1
[ 111.845544] xhci-hcd xhci-hcd.0.auto: Command completion event does not match command
[ 111.853518] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command
[ 111.888145] xhci-hcd xhci-hcd.0.auto: Host not halted after 16000 microseconds.
[ 111.895528] xhci-hcd xhci-hcd.0.auto: Host controller not halted, aborting reset.
[ 111.905732] xhci-hcd xhci-hcd.0.auto: USB bus 4 deregistered
[ 111.912598] xhci-hcd xhci-hcd.0.auto: remove, state 1
[ 111.918695] usb usb3: USB disconnect, device number 1
[ 112.125544] usb 3-1: device descriptor read/all, error -22
[ 112.131106] usb usb3-port1: couldn't allocate usb_device
[ 112.140019] xhci-hcd xhci-hcd.0.auto: USB bus 3 deregistered
cheers,
-roger
next prev parent reply other threads:[~2015-08-20 7:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 10:39 [PATCH 0/5] usb: xhci: Fix breakage on dual-role case Roger Quadros
2015-08-18 10:39 ` [PATCH 1/5] usb: xhci: lock mutex on xhci_stop Roger Quadros
2015-08-18 11:39 ` Mathias Nyman
2015-08-18 10:39 ` [PATCH 2/5] usb: hcd: Initialize hcd->flags to 0 Roger Quadros
2015-08-18 10:39 ` [PATCH 3/5] usb: xhci: Clear XHCI_STATE_DYING on start Roger Quadros
2015-08-18 11:43 ` Mathias Nyman
2015-08-18 10:39 ` [PATCH 4/5] usb: xhci: stop everything on the first call to xhci_stop Roger Quadros
2015-08-18 12:14 ` Mathias Nyman
2015-08-20 6:42 ` Roger Quadros
2015-08-18 10:39 ` [PATCH 5/5] usb: xhci: exit early in xhci_setup_device() if we're halted or dying Roger Quadros
2015-08-18 12:17 ` Mathias Nyman
2015-08-20 7:09 ` Roger Quadros [this message]
2015-08-27 11:18 ` [PATCH 0/5] usb: xhci: Fix breakage on dual-role case Mathias Nyman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D57D29.1040702@ti.com \
--to=rogerq@ti.com \
--cc=balbi@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox