public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Michal Pecio <michal.pecio@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>
Cc: 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: Wed, 22 Apr 2026 16:51:30 +0300	[thread overview]
Message-ID: <e06dcae8-5b8e-4e58-a0cc-1c67e5a08170@linux.intel.com> (raw)
In-Reply-To: <20260422073054.0bd482ba.michal.pecio@gmail.com>

On 4/22/26 08:30, Michal Pecio wrote:
> On Tue, 21 Apr 2026 22:11:41 -0400, Alan Stern wrote:
>> On Tue, Apr 07, 2026 at 11:24:01PM +0300, Mathias Nyman wrote:
>>> On 4/7/26 18:23, Alan Stern wrote:
>>>> It's been a while now, and nobody has objected to the proposed
>>>> plan for handling this issue, so I'm going to assume that
>>>> everyone is on board with the idea.
>>>
>>> Yes, I support this
>>>
>>> So basically usb core will call usb_clear_halt() after EPROTO URB
>>> completion handler finishes, and xhci-hcd needs to prevent
>>> bulk/interrupt endpoint from restarting after returning a EPROTO
>>> URB up until usb_reset_endpoint() is called
>>
>> Can you confirm that it's also possible for xhci-hcd to prevent
>> control endpoints from restarting when a transaction error (-EPROTO)
>> occurs?  Up until usb_reset_endpoint() or a new callback?
> 
> Doable. They halt like any other and it's SW's choice how to restart.

Yes, doable.

Would this be used in cases where all hope is lost and we want to reset the
device, canceling all pending control URBs before restarting the ring,
thus avoiding sending any extra URBs to the device just to wait for
them to fail or timeout?

In most cases I can think of it would make sense to keep the control endpoint
running. Just let the hcd move to the SETUP stage of the next control transfer
URB and continue.

For example EMF causing transaction error (-EPROTO) on active IN and OUT bulk
transfers. Two clear-halt requests are queued, one for each endpoint.
If first clear-halt request fails with -EPROTO  we still want to continue with
the next request.
Shouldn't be any toggle/seq-nr issues here on the control endpoint.

Most control transfer STALL (EPIPE) cases are protocol stalls, and we should
just continue running. Exception here might be a STALL response
to a clear-halt request. I assume (didn't check) device must support those.
So in that case we may want to reset the device.

There's also a risk that the control endpoint isn't started when it should.
For example class driver could potentially call usb_clear_halt() on the control
endpoint, synchronously waiting  for the clear-halt request to complete before
calling usb_reset_endpoint(). If endpoint restarts at usb_reset_endpoint() then
the clear-halt control transfer would time out.

Thanks
Mathias


  reply	other threads:[~2026-04-22 13:51 UTC|newest]

Thread overview: 43+ 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
2026-04-18  2:34                                                     ` Alan Stern
2026-04-18  9:21                                                       ` Michal Pecio
2026-04-18 14:56                                                         ` Alan Stern
2026-04-22  2:11                                                 ` Alan Stern
2026-04-22  5:30                                                   ` Michal Pecio
2026-04-22 13:51                                                     ` Mathias Nyman [this message]
2026-04-22 15:35                                                       ` Alan Stern
2026-04-22 14:57                                                     ` 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=e06dcae8-5b8e-4e58-a0cc-1c67e5a08170@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=michal.pecio@gmail.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