From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"michal.pecio@gmail.com" <michal.pecio@gmail.com>,
"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: Sun, 5 Apr 2026 03:10:22 +0000 [thread overview]
Message-ID: <20260405030954.32jbg3fphi5xdla3@synopsys.com> (raw)
In-Reply-To: <b4e2edd9-2616-4cfe-90a5-438fb6625706@rowland.harvard.edu>
On Sat, Apr 04, 2026, Alan Stern wrote:
> On Sat, Apr 04, 2026 at 10:28:24PM +0000, Thinh Nguyen wrote:
> > On Sat, Apr 04, 2026, Thinh Nguyen wrote:
> > > On Sat, Apr 04, 2026, Alan Stern wrote:
> > > > If the class driver wants to take some other action (like submitting
> > > > URBs to a different endpoint) before using the endpoint that stopped,
> > > > it's free to do so. It only has to make sure that it doesn't submit any
> > > > URBs to the stopped endpoint until after the other action is finished --
> > > > which is what it would do anyway. (And maybe it has to unlink any URBs
> > > > that are already queued, which can be done with a simple function call.)
> > > >
> > >
> > > Then the xhci must make sure that it should not ring the doorbell to
> > > restart the endpoint when giving back the canceled URBs. It should only
> > > do so on newly submitted URBs.
> >
> > Ignore this comment, it's not restarting the endpoint in the case of
> > unlinking.
>
> I was going to say that xhci-hcd shouldn't restart the endpoint until
> the usb_reset_endpoint() call is made. Whether or not it rings the
> doorbell at that time may depend on whether there are any URBs on the
> queue; that's a relatively unimportant implementation detail.
>
> > > We can add a requirement such that if the class driver submitted the
> > > recovery URBs prior to completing the usb_reset_endpoint (which should
> > > be done after clear-halt), then the HCD may keep those URBs on a queue
> > > and only process those URBs and restart the endpoint afterward.
> > >
> >
> > Actually, adding this new requirement would be tricky because we don't
> > know whether it's recovery URBs or not.
>
> The purpose of the submitted URBs doesn't matter. The HCD shouldn't
> restart the endpoint until the usb_reset_endpoint() call occurs.
>
> Also, I should point out that usbcore will call usb_clear_halt() and
> usb_reset_endpoint(), presumably using a work queue for the calls. The
> class driver doesn't need to do it -- in fact, doing those things could
> lead to errors because the endpoint may already be running (the core may
> already have made the calls).
>
That's good. This is what I wanted to confirm.
May need to update how xhci handles usb_reset_endpoint() because I
believe it's expected the endpoint transfer ring to be drained prior (by
the class driver unlinking URBs).
Thanks for the clarifications,
Thinh
ps. Have a good weekend! I'll be back a week after.
next prev parent reply other threads:[~2026-04-05 3:10 UTC|newest]
Thread overview: 47+ 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 [this message]
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
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
-- strict thread matches above, loose matches on Subject: below --
2026-03-23 17:53 [RFC PATCH 1/2] xhci: prevent automatic endpoint restart after stall or error kernel test robot
2026-03-24 5:49 ` Dan Carpenter
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=20260405030954.32jbg3fphi5xdla3@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.