Linux USB
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Michal Pecio <michal.pecio@gmail.com>, Henry Tseng <henrytseng@qnap.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 0/2] xhci: handshake timeout overrun and configure endpoint hang on device disconnect
Date: Fri, 4 Dec 2026 18:17:34 +0200	[thread overview]
Message-ID: <3b580d95-ffb7-4e5c-af72-6e7633acf6e8@linux.intel.com> (raw)
In-Reply-To: <20261204115823.04daaa91.michal.pecio@gmail.com>

On 12/4/26 12:58, Michal Pecio wrote:
> On Fri, 27 Nov 2026 18:17:21 +0800, Henry Tseng wrote:
>> On Wed, 30 Sep 2026 18:17:50 +0800, Henry Tseng <henrytseng@qnap.com> wrote:
>>> This series addresses two problems found while debugging an AMD Raven
>>> USB 3.1 xHCI (1022:15e0) that gets declared dead when a USB storage
>>> enclosure is unplugged. During teardown a command fails to complete,
>>> aborting the command ring also fails, and the whole host is declared
>>> dead, taking unrelated devices on other root ports down with it:
>>>
>>>    xhci_hcd 0000:0c:00.3: Command timeout, USBSTS: 0x00000010 PCD
>>>    xhci_hcd 0000:0c:00.3: Abort command ring
>>>    xhci_hcd 0000:0c:00.3: Abort failed to stop command ring: -110
>>>    xhci_hcd 0000:0c:00.3: xHCI host controller not responding, assume dead
>>>    
>>
>> Hi Mathias,
>>
>> Gentle ping on this series. A short summary, since the thread got long:
>>
>> On an AMD Raven xHCI (1022:15e0), unplugging a QNAP TL-D800C enclosure
>> leaves the Configure Endpoint command that drops a hub's endpoints
>> during teardown incomplete. The command ring abort then fails and the
>> host is declared dead, taking down devices on other root ports too.
>> It only happens when the command is issued after the root port
>> disconnect, deconfiguring the same hubs while still connected works.
>>
>> Since Disable Slot follows right after and disables all endpoints of
>> the slot anyway (xHCI 4.8.3), the idea is to skip this Configure
>> Endpoint for disconnected devices. Michal saw no side effects on his
>> hosts when it is omitted before Disable Slot.
>>
>> v1 decided this from the roothub port state, but as Michal pointed
>> out, that can miss the case where the link comes back before
>> xhci_check_bandwidth() runs. For v2 I'd like to check
>> udev->state == USB_STATE_NOTATTACHED instead. usb_disconnect() sets
>> it on the device and its children before the command is issued, and
>> it doesn't change back.
> 
> This should work, AFAICT usb_disconnect() is the only path in USB core
> which destroys configured devices, and it works as you described.
> 
> USB_STATE_NOTATTACHED has the advantage of being immune to brief
> disconnections and not dependent on new v7.3 functionality, so easier
> to backport if necessary.
> 
> Disadvantage: slower to respond, if somebody deconfigures manually
> while also pulling the plug. I suspect this is less likely to occur in
> practice than transient loss of link.
> 
>> Would that work for you, and if so, would you prefer the check in
>> xhci_check_bandwidth() or in usb_hcd_alloc_bandwidth() in USB core?
> 
> Probably in xhci-hcd: this ability to omit bandwidth reconfiguration
> in certain cases is xHCI-specific, even if xhci-hcd is the only HCD
> using these function now (and possibly forever, but who knows).
> 
> I think core maintainers wouldn't want to deal with this hack.

Checking for udev->state == USB_STATE_NOTATTACHED sounds good.
Best place is probably xhci_check_bandwidth().

hosts like xhci-mtk depend on usb core calling drop_endpoint() to
set bandwidth scheduling.
  
XHCI_SW_BW_CHECKING hosts do software bandwidth tracking in
xhci_configure_endpoint(), so those should still take the full old
path.

Thanks
Mathias


      reply	other threads:[~2026-12-04 16:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 10:17 [PATCH 0/2] xhci: handshake timeout overrun and configure endpoint hang on device disconnect Henry Tseng
2026-09-30 10:17 ` [PATCH 1/2] xhci: make xhci_handshake() timeout wall-clock based again Henry Tseng
2026-12-04 11:13   ` Michal Pecio
2026-09-30 10:17 ` [PATCH 2/2] xhci: skip configure endpoint when dropping endpoints of a disconnected device Henry Tseng
2026-10-02  9:30 ` [PATCH 0/2] xhci: handshake timeout overrun and configure endpoint hang on device disconnect Michal Pecio
2026-10-07  9:52   ` Henry Tseng
2026-10-08  9:06     ` Michal Pecio
2026-10-08  9:13       ` Michal Pecio
2026-10-08 10:25       ` Henry Tseng
2026-10-09 15:35         ` Michal Pecio
2026-10-16 10:11           ` Henry Tseng
2026-10-26  9:10             ` Michal Pecio
2026-10-30 10:15               ` Henry Tseng
2026-10-30 10:55                 ` Michal Pecio
2026-10-22 10:03 ` Henry Tseng
2026-11-27 10:17 ` Henry Tseng
2026-12-04 10:58   ` Michal Pecio
2026-12-04 16:17     ` Mathias Nyman [this message]

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=3b580d95-ffb7-4e5c-af72-6e7633acf6e8@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=henrytseng@qnap.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=michal.pecio@gmail.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