From: "Neronin, Niklas" <niklas.neronin@linux.intel.com>
To: "Michał Pecio" <michal.pecio@gmail.com>,
"Mathias Nyman" <mathias.nyman@intel.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: Problematic Set TR Deq error handling series in xhci-next
Date: Mon, 12 May 2025 16:02:06 +0300 [thread overview]
Message-ID: <c606689d-e680-4796-bb65-87424a157e98@linux.intel.com> (raw)
In-Reply-To: <20250509114138.7052dd3b@foxbook>
> I noticed that xhci/for-usb-next now includes a series which tries
> to handle Set TR Deq errors. It strikes me as a solution looking for
> a problem, and frankly creating new problems where none existed ;)
Hi,
The purpose of this series is to add some error handling and improve
warning messages. Fixing the root cause is another task altogether.
Before, the only difference between a Set TR Deq command failure
and success was that, in the case of failure, a warning was printed,
and the xhci driver ring dequeue pointer was not moved. Otherwise,
a Set TR Deq command failure behaved as if it were successful.
In my opinion, instead of ignoring the Set TR Deq errors it would be
better to retry the command if the error is due to something easily
fixed, such as wrong EP state or Slot state.
In the worst-case scenario, the xhci driver will still fail, but with
a more specific warning message.
> I am aware of three cases leading to errors being handled here, and
> none of them is addressed. One is harmless and easy to fix properly,
> but this series appears to turn it into a "never give back the URB"
> disaster. Tests pending, I hope to find some time this weekend.
> > ...
>
> The case of "running" (or "halted", which "running" can morth into)
> is possibly more useful, because we assume it's caused by illegal
> state changes without driver's knowledge. But these are supposed to
> be detected and fixed by handle_cmd_stop_ep(), because they cause
> other problems too. It's unclear if retrying Stop Endpoint and Set
> TR Deq again will solve any case not solved yet, but risk exists of
> infinite retries on broken HW. (And HW is broken if we are here).
The infinite retry loop is a good point, did not consider this.
But wouldn't the Stop EP command fail first, otherwise the state is
correct for the Set TR Deq?
Do you still think these changes might result in more negative impacts
than positive ones?
Thank you for the review and comments.
Best Regards,
Niklas
>
> Queuing a Soft Retry and then doing Set TR Deq out of the halted TD
> instead of restarting the ring is a weird thing to do and IDK if HW
> will get it right. IIRC, some ASMedia had issues in similar cases:
> it would retry the TD anyway, despite Set TR Deq.
>
> ...
>
> Regards,
> Michal
next prev parent reply other threads:[~2025-05-12 13:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 9:41 Problematic Set TR Deq error handling series in xhci-next Michał Pecio
2025-05-10 15:52 ` Alan Stern
2025-05-11 14:04 ` Michał Pecio
2025-05-11 19:24 ` Alan Stern
2025-05-12 13:02 ` Neronin, Niklas [this message]
2025-05-13 10:29 ` Michał Pecio
2025-05-14 9:34 ` Michał Pecio
2025-05-15 7:11 ` Neronin, Niklas
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=c606689d-e680-4796-bb65-87424a157e98@linux.intel.com \
--to=niklas.neronin@linux.intel.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