Linux USB
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Dylan Robinson <dylan_robinson@motu.com>
Cc: 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: Fri, 8 May 2026 21:25:25 -0400	[thread overview]
Message-ID: <3f63207b-2e34-4b7a-875f-e7a1294ae30e@rowland.harvard.edu> (raw)
In-Reply-To: <CA+Df+jf=UaVubKM1Pfu7sgREUMYv=6QMi94mbhhefjhXq8-6uw@mail.gmail.com>

On Fri, May 08, 2026 at 01:20:04PM -0400, Dylan Robinson wrote:
> 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.
> 
> For endpoints with larger polling intervals, this "nearest valid start
> frame" approach seems appropriate, since the device cannot expect
> timing granularity finer than its polling interval anyway.

That makes sense, and it should be doable.  At least for ehci-hcd, and 
likely for xhci-hcd as well.

> > What if the HCD only supports scheduling up to 256 ms in the future, but
> > the driver asks for a start frame that is 400 ms in the future?
> 
> On macOS and Windows the submission would fail with an error. That
> seems appropriate.
> 
> For example, macOS has the following return status:
>  - kIOReturnIsoTooNew (Too far in the future)
>  - kIOReturnIsoTooOld (Too far in the past)
> 
> On Windows, the status of the URB is set to USBD_STATUS_BAD_START_FRAME.

We ought to be able to do something similar.

> > What if the periodic schedule is already full and there is no bandwidth
> > remaining to schedule the new stream?  How will the driver find out?  By
> > getting a different error code from the URB submission?
> 
> The driver needs to know if the stream cannot start. What happens currently?

Submission fails with a -ENOSPC error code.  On the other hand, if the 
schedule is set up when the alternate setting is installed, and that 
can't be done, then the usb_set_interface() call fails.

> We can ultimately only provide functionality within the limits of what
> the host platform and HCD are capable of supporting.
> 
> In general, the more precise and predictable the scheduling behavior
> is, the lower latency and better overall performance the driver can
> achieve. Falling back to unspecified scheduling may allow basic
> functionality to work, but at the cost of increased buffering, reduced
> synchronization accuracy and longer startup delay.

All right, let's say what Mathias and Michal have to say about this.

Alan Stern

  reply	other threads:[~2026-05-09  1:25 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 [this message]
2026-05-09 22:12               ` Michal Pecio
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=3f63207b-2e34-4b7a-875f-e7a1294ae30e@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=dylan_robinson@motu.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.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