From: Michal Pecio <michal.pecio@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"oneukum@suse.com" <oneukum@suse.com>,
"niklas.neronin@linux.intel.com" <niklas.neronin@linux.intel.com>
Subject: Re: [RFC PATCH 1/2] xhci: prevent automatic endpoint restart after stall or error
Date: Fri, 17 Apr 2026 23:48:46 +0200 [thread overview]
Message-ID: <20260417234846.41a24089.michal.pecio@gmail.com> (raw)
In-Reply-To: <4a484a89-f52a-48c2-af43-c0029878ddaf@rowland.harvard.edu>
On Fri, 17 Apr 2026 13:38:46 -0400, Alan Stern wrote:
> The behavior for control endpoints isn't clear. When a transaction
> error occurs in a control transfer, does xHCI stop the endpoint
> queue? Presumably usb_clear_halt() isn't needed, but what about
> usb_reset_endpoint()?
>
> I will assume that all stalls for control endpoints are protocol
> stalls and therefore do not need to be cleared (the device will
> automatically clear the halt condition when it receives the next
> SETUP packet for the endpoint). But does xhci-hcd still require a
> usb_reset_endpoint() after a control stall?
Nope.
The host endpoint halts on every STALL handshake or non-isoc protocol
error, but the driver immediately resets every halted endpoint because
it's a precondition to even remove the failed URB from the HW queue
before giving it back, which looks like a prudent thing to do.
Currently, by the time the URB is given back, its endpoint is already
in a "stopped but runnable" state and its sequence state is zeroed.
And it may have already been restarted if there are more pending URBs.
This seems to need no change for control endpoints?
For bulk/interrupt it also means that if we delay the restart until
endpoint_reset() then endpoint_reset() has nothing to do besides
restarting the endpoint, which is a good thing because this method
under normal conditions requires no URBs to be present.
> Recovery from a transaction error on a bulk or interrupt endpoint
> involves sending a Clear-Halt request to the device. But if the
> error was caused by some sort of transient interference that hasn't
> ended yet, the Clear-Halt might itself fail with the same error. To
> handle this, we should retry the Clear-Halt at increasing time
> intervals. At what point should the core give up?
Good question, I don't know. One thing I noticed is that Windows does
tend to lose patience with completely unresponsive devices and kicks
them out, but I don't know the exact criteria.
And if core is to clear halt autonomously, things may get interesting
if a driver tries to do the same, or something else like removing the
endpoint with usb_set_interface().
A related issue is clearing TT buffers. AFAIK this has no retries, it
fails silently and leaves the endpoint potentially broken, and it is
waited for to complete in case of usb_set_interface().
Regards,
Michal
next prev parent reply other threads:[~2026-04-17 21:48 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 12:25 [RFC PATCH 0/2] fix xhci endpoint restart at EPROTO Mathias Nyman
2026-03-23 12:25 ` [RFC PATCH 1/2] xhci: prevent automatic endpoint restart after stall or error Mathias Nyman
2026-03-25 1:52 ` Thinh Nguyen
2026-03-25 9:38 ` Mathias Nyman
2026-03-26 1:19 ` Thinh Nguyen
2026-03-26 11:25 ` Mathias Nyman
2026-03-26 23:24 ` Thinh Nguyen
2026-03-30 12:51 ` Mathias Nyman
2026-03-30 14:17 ` stern
2026-03-31 9:34 ` Mathias Nyman
2026-03-31 15:31 ` stern
2026-04-01 22:08 ` Mathias Nyman
2026-04-02 2:36 ` stern
2026-04-03 1:59 ` Thinh Nguyen
2026-04-03 2:42 ` stern
2026-04-03 8:51 ` Michal Pecio
2026-04-03 14:55 ` stern
2026-04-03 19:13 ` xhci-hcd and URB_SHORT_NOT_OK Michal Pecio
2026-04-03 20:17 ` stern
2026-04-04 1:15 ` [RFC PATCH 1/2] xhci: prevent automatic endpoint restart after stall or error Thinh Nguyen
2026-04-04 1:54 ` stern
2026-04-04 20:41 ` Thinh Nguyen
2026-04-04 21:54 ` Alan Stern
2026-04-04 22:15 ` Thinh Nguyen
2026-04-04 22:28 ` Thinh Nguyen
2026-04-05 1:30 ` Alan Stern
2026-04-05 3:10 ` Thinh Nguyen
2026-04-07 15:23 ` Alan Stern
2026-04-07 20:24 ` Mathias Nyman
2026-04-17 17:38 ` Alan Stern
2026-04-17 21:48 ` Michal Pecio [this message]
2026-04-18 2:34 ` Alan Stern
2026-04-18 9:21 ` Michal Pecio
2026-04-18 14:56 ` Alan Stern
2026-04-01 22:08 ` Thinh Nguyen
2026-04-01 22:34 ` Mathias Nyman
2026-04-01 22:47 ` Thinh Nguyen
2026-03-23 12:25 ` [RFC PATCH 2/2] xhci: Ensure URB is given back when endpoint halts on a multi-TD URB 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=20260417234846.41a24089.michal.pecio@gmail.com \
--to=michal.pecio@gmail.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=niklas.neronin@linux.intel.com \
--cc=oneukum@suse.com \
--cc=stern@rowland.harvard.edu \
/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