public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] xhci: Fix isochronous scheduling gaps on CFC controllers
@ 2026-05-04 23:31 Nicola Lunghi
  2026-05-04 23:31 ` [PATCH 1/2] usb: xhci: fix isoc silent reschedule creating stream gap " Nicola Lunghi
  2026-05-04 23:31 ` [PATCH 2/2] usb: xhci: fix CFC sequential scheduling lost on ring drain race Nicola Lunghi
  0 siblings, 2 replies; 4+ messages in thread
From: Nicola Lunghi @ 2026-05-04 23:31 UTC (permalink / raw)
  To: mathias.nyman, michal.pecio, niklas.neronin, gregkh
  Cc: linux-usb, linux-kernel, Nicola Lunghi

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. 

Link: https://bugzilla.kernel.org/show_bug.cgi?id=220748

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(-)

-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-05 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 23:31 [PATCH 0/2] xhci: Fix isochronous scheduling gaps on CFC controllers Nicola Lunghi
2026-05-04 23:31 ` [PATCH 1/2] usb: xhci: fix isoc silent reschedule creating stream gap " Nicola Lunghi
2026-05-05 13:32   ` Mathias Nyman
2026-05-04 23:31 ` [PATCH 2/2] usb: xhci: fix CFC sequential scheduling lost on ring drain race Nicola Lunghi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox