From: Michal Pecio <michal.pecio@gmail.com>
To: Dylan Robinson <dylan_robinson@motu.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
linux-usb@vger.kernel.org, mathias.nyman@intel.com
Subject: Re: [Bug 220748] usb: xhci_queue_isoc_tx_prepare ignore start_frame and always assumes URB_ISO_ASAP is set
Date: Sun, 10 May 2026 00:12:04 +0200 [thread overview]
Message-ID: <20260510001204.7a4d5faa.michal.pecio@gmail.com> (raw)
In-Reply-To: <CA+Df+jf=UaVubKM1Pfu7sgREUMYv=6QMi94mbhhefjhXq8-6uw@mail.gmail.com>
On Fri, 8 May 2026 13:20:04 -0400, Dylan Robinson wrote:
> Our High Speed and SuperSpeed devices always use a bInterval of 1, so
> they expect transfers in every microframe. I'm less familiar with the
> behavior and expectations of endpoints that use larger polling
> intervals.
>
> Perhaps, rather than treating this as a "specified start frame", it
> would be better to think of it as a "specified start service
> interval".
>
> If a driver requests a start frame that is not specifically available
> within the periodic schedule, it seems reasonable for the HCD to place
> the transfer at another valid position within that same service
> interval. The actual start frame used could then still be reported
> back through the completed URB, which can be inspected by the driver
> if it needs to know the precise scheduling decision.
IDK if drivers ever need to know. They better not, because there is
no way to get "phase" information out of xHCI, besides timing IRQs.
There is also no way to set it. And no way to schedule a new stream
not on frame boundary. See xHCI 4.11.2.5.1, the rules are simple.
The urb->start_frame you get is the first (u)frame of target interval.
Requests from drivers would need to be rounded, ignored or rejected.
> > It's always possible to observe these errors after the fact
> > (assuming the start_frame values are reliable). I'm not sure what
> > value there is in observing them when the URB is submitted,
> > however. What would the driver do differently in these two cases?
>
> I agree the two cases are quite similar in terms of observability.
>
> The main practical benefit of detecting this at submission time might
> be the potential to reduce recovery latency. If the driver can
> determine immediately that scheduling has failed, it may be able to
> restart or resynchronize the stream sooner, which for an audio
> interface, could translate to a smaller audible glitch.
I believe gaps between URBs are not supposed to be happening at all
with proper resubmission, according to documented rules, so drivers
can detect gaps by watching for EXDEV status in frame_desc, if we
manage to bring xhci-hcd into compliance with the rules.
As for predicting EXDEV at submission, it's a gable. We can only be
100% sure whether it's too late or not when the interval completes
with Missed Service or Success.
Admittedly if it fails, the driver unfortunately only learns about
it after the end of the whole URB. Short URBs could be better here.
We can predict it by looking at the Isochronous Scheduling Threshold
reported by the HC, but it's a single number which may not accurately
reflect all cases (full-speed devices behind high-speed hubs are a
fascinating topic) and IME it's quite pessimistic on many chips - in
reality, they can do better than they claim.
So being conservative and failing submissions which missed the IST
might cause a driver to panic and reset the endpoint when no glitch
would actually occur. And of course delaying such URBs (as currently
done) has the known effects that this bug is about.
I wrote some experimental patches to debug and fix this back then,
but nobody was commenting on the bug so I dropped this topic because
I'm reluctant to submit significant changes without real testing.
I can rehash this stuff.
The most important question is if actual HW properly handles URBs
submitted too late. It would be nice to get testing on various xHCI
chips from varous vendors. If there are problems, it could prove
necessary to detect late submissions and complete such transfers as
EXDEV witout HW involvemnet. Yuck. Maybe it won't come to that.
Regards,
Michal
next prev parent reply other threads:[~2026-05-09 22:12 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 21:25 [Bug 220748] New: usb: xhci_queue_isoc_tx_prepare ignore start_frame and always assumes URB_ISO_ASAP is set bugzilla-daemon
2025-11-05 8:40 ` [Bug 220748] " bugzilla-daemon
2025-11-05 8:48 ` bugzilla-daemon
2025-11-05 8:53 ` bugzilla-daemon
2025-11-05 9:06 ` bugzilla-daemon
2025-11-05 15:47 ` bugzilla-daemon
2025-11-05 18:28 ` bugzilla-daemon
2025-11-05 18:30 ` bugzilla-daemon
2025-11-05 20:16 ` bugzilla-daemon
2025-11-05 21:18 ` bugzilla-daemon
2025-11-06 3:52 ` bugzilla-daemon
2025-11-06 8:27 ` bugzilla-daemon
2025-11-06 8:35 ` bugzilla-daemon
2025-11-06 15:03 ` bugzilla-daemon
2025-11-08 10:33 ` bugzilla-daemon
2025-11-08 16:09 ` bugzilla-daemon
2025-11-10 10:23 ` bugzilla-daemon
2025-11-10 10:42 ` bugzilla-daemon
2026-05-04 23:53 ` bugzilla-daemon
2026-05-04 23:54 ` bugzilla-daemon
2026-05-05 1:14 ` bugzilla-daemon
2026-05-05 9:59 ` bugzilla-daemon
2026-05-05 17:09 ` bugzilla-daemon
2026-05-05 17:10 ` bugzilla-daemon
2026-05-05 17:10 ` bugzilla-daemon
2026-05-05 17:13 ` bugzilla-daemon
2026-05-06 13:32 ` bugzilla-daemon
2026-05-06 15:03 ` bugzilla-daemon
2026-05-07 2:38 ` Alan Stern
2026-05-07 16:17 ` Dylan Robinson
2026-05-07 17:24 ` Alan Stern
2026-05-07 21:16 ` Dylan Robinson
2026-05-08 3:02 ` Alan Stern
2026-05-08 17:20 ` Dylan Robinson
2026-05-09 1:25 ` Alan Stern
2026-05-09 22:12 ` Michal Pecio [this message]
2026-05-10 12:39 ` Dylan Robinson
2026-05-11 19:21 ` [RFT PATCH] xhci: fix frame id calculation for isoc transfer Mathias Nyman
2026-05-11 19:36 ` Mathias Nyman
2026-05-07 21:54 ` [Bug 220748] usb: xhci_queue_isoc_tx_prepare ignore start_frame and always assumes URB_ISO_ASAP is set Michal Pecio
2026-05-08 3:09 ` Alan Stern
2026-05-08 9:41 ` Michal Pecio
2026-05-08 14:54 ` Alan Stern
2026-05-08 21:39 ` Dylan Robinson
2026-05-09 11:10 ` Michal Pecio
2026-05-09 20:18 ` Dylan Robinson
2026-05-11 19:15 ` bugzilla-daemon
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=20260510001204.7a4d5faa.michal.pecio@gmail.com \
--to=michal.pecio@gmail.com \
--cc=dylan_robinson@motu.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.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