Skip to content

xhci: Fix isochronous scheduling gaps on CFC controllers

Nicola Lunghi linux-usb lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2usb: xhci: fix isoc silent reschedule creating stream gap on CFC controllersdrivers/usb/host/xhci-ring.c+13 -72 replies
2/2usb: xhci: fix CFC sequential scheduling lost on ring drain racedrivers/usb/host/xhci-ring.c+16 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] xhci: Fix isochronous scheduling gaps on CFC controllers

This series addresses a long-standing issue where the xHCI driver introduces frame-aligned gaps in isochronous streams during timing fluctuations. While many USB devices handle these gaps with a minor glitch, professional interfaces like the MOTU 1248 lose internal channel synchronization when these gaps occur.

I have identified two specific code paths in xhci-ring.c where these gaps are created:

Silent Rescheduling:
When a start frame is "late," the driver adds a +1 frame offset, creating an explicit hole in the stream.

Ring Drain Race:
On CFC-capable controllers, the driver falls back to ASAP scheduling if the ring is momentarily empty, resulting in a jump to a future frame instead of continuing sequentially.

Impact on MOTU 1248:
The MOTU 1248 is particularly sensitive to stream continuity. The two situations described above cause a
shift in the output channels, where audio intended for one set of channels is routed to the wrong physical outputs until the device is reset.

Proposed Solution:
This series modifies the xHCI driver to prefer sequential scheduling on modern CFC-capable controllers:

- Patch 1 removes the silent start_frame_id + 1 reschedule, returning -EINVAL to allow the use of the TRB_SIA (Schedule Immediate After) flag.
- Patch 2 expands the CFC sequential condition to check if a periodic completion is in progress, covering the
"ring drain" race where a new URB is submitted just as the previous one finishes.

These changes build upon recent work by Michał Pecio regarding missed TD handling.

Nicola Lunghi (2):
usb: xhci: fix isoc silent reschedule creating stream gap on CFC
controllers
usb: xhci: fix CFC sequential scheduling lost on ring drain race

 drivers/usb/host/xhci-ring.c | 42 +++++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 13 deletions(-)
Signature · 1 line
2.51.0