public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Michal Pecio <michal.pecio@gmail.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, 24 Apr 2026 12:13:44 +0300	[thread overview]
Message-ID: <bde7e968-e0f6-491c-ad45-3446fdf3a8f0@linux.intel.com> (raw)
In-Reply-To: <557aff2a-5124-4067-8637-6dde703f919b@rowland.harvard.edu>

On 4/23/26 17:12, Alan Stern wrote:
> On Wed, Apr 22, 2026 at 11:35:42AM -0400, Alan Stern wrote:
>> On Wed, Apr 22, 2026 at 04:51:30PM +0300, Mathias Nyman wrote:
>>> On 4/22/26 08:30, Michal Pecio wrote:
>>>> On Tue, 21 Apr 2026 22:11:41 -0400, Alan Stern wrote:
>>>>> 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?
>>
>> That wasn't my intention.  The purpose was to avoid getting into a tight
>> loop such as in fuzzing tests with dummy-hcd.  When a device is
>> disconnected, if the class driver's completion handler immediately
>> resubmits after a -EPROTO error, and the resubmitted URB immediately
>> fails with -EPROTO status, the resulting loop can use enough of a CPU's
>> time to cause a "CPU hung" error.
>>
>> The same sort of thing can happen with real host controllers, although
>> the loop won't be quite so tight.  But if we prevent resubmitted URBs
>> from failing until the endpoint is reset or restarted, that will slow
>> down the loop a lot.  Especially with a series of increasing delays
>> between the restarts.
> 
> You know, on further thought I'm not sure the benefit is worth the
> effort.  I'll see if the tight-loop problem in dummy-hcd can be fixed by
> changing dummy-hcd.
> 

The tight loop -EPROTO return case is probably not a big issue for xhci
anyway  as both xhci driver and hardware cause some delay before giving back
an URB with EPROTO status.

xHC halts the host side of the control endpoints on transaction errors, and
driver will reset the internal endpoint and move the ring dequeue pointer past
the URB before giving the URB back with -EPROTO status.

-Mathias


  reply	other threads:[~2026-04-24  9:13 UTC|newest]

Thread overview: 45+ 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
2026-04-22 15:35                                                       ` Alan Stern
2026-04-23 14:12                                                         ` Alan Stern
2026-04-24  9:13                                                           ` Mathias Nyman [this message]
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=bde7e968-e0f6-491c-ad45-3446fdf3a8f0@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