** Description changed:

+ [ Impact ]
+ 
  On xHCI controllers that support Contiguous Frame ID (CFC), the resolute 7.0
  kernel puts gaps into High-Speed isochronous streams whose URBs are queued
  less than about two frames ahead. The gaps are not caused by software
  submitting late. The driver itself moves the stream forward by a frame.
  
  The old xhci_get_isoc_frame_id() checks the first TD of every URB against
  the valid Frame ID window. When the TD's frame falls on or before the window
  start (MFINDEX + IST + 1, rounded up to a frame), the code moves it to
  window start + 1 frame and continues the stream from there, even mid-stream.
  The microframes in between get no transaction.
  
  This is easy to hit with a USB Audio Class 2 device using asynchronous
  explicit feedback where the feedback endpoint has bInterval=1. In that case
  snd-usb-audio uses 1-packet (125 us) OUT URBs, so 12 URBs cover only
  12 microframes.
  
  Observed on Intel Meteor Lake-P xHCI [8086:7e7d] (HCSPARAMS2 IST = 4
  microframes, HCCPARAMS1 CFC = 1), with a High-Speed UAC2 device
  (Zephyr UAC2 explicit feedback sample, 2fe3:000e) on a root port:
  
-  - A bus analyzer (OpenVizsla) shows a repeating pattern: about 11-12 SOFs
-    with OUT data, then 3-4 SOFs with no IN and no OUT, plus occasional
-    single SOFs without OUT. OUT always resumes on the first microframe of a
-    new frame number.
-  - The xhci trace events show that every isoc TD carries an explicit
-    Frame ID, but only 4-7 TDs are assigned per Frame ID instead of 8. The
-    OUT histogram of TDs per Frame ID is {4: 352, 5: 816, 6: 651, 7: 183}.
-    URBs are resubmitted within a few microseconds of completion, and no
-    Missed Service / Ring Underrun events occur.
-  - The device receives no OUT data in roughly 25% of microframes. A device
-    that expects data in every microframe cannot play the stream correctly.
-  - The same hardware works correctly with Windows and macOS. Full-Speed
-    mode of the same device is not affected.
+  - A bus analyzer (OpenVizsla) shows a repeating pattern: about 11-12 SOFs
+    with OUT data, then 3-4 SOFs with no IN and no OUT, plus occasional
+    single SOFs without OUT. OUT always resumes on the first microframe of a
+    new frame number.
+  - The xhci trace events show that every isoc TD carries an explicit
+    Frame ID, but only 4-7 TDs are assigned per Frame ID instead of 8. The
+    OUT histogram of TDs per Frame ID is {4: 352, 5: 816, 6: 651, 7: 183}.
+    URBs are resubmitted within a few microseconds of completion, and no
+    Missed Service / Ring Underrun events occur.
+  - The device receives no OUT data in roughly 25% of microframes. A device
+    that expects data in every microframe cannot play the stream correctly.
+  - The same hardware works correctly with Windows and macOS. Full-Speed
+    mode of the same device is not affected.
  
  [ Fix ]
  
  Mainline rewrote the Frame ID calculation in v7.3. Mid-stream URBs are no
  longer moved forward, and a follow-up fixed a regression introduced by that
  rewrite. All three are clean cherry-picks except for one context line in
  xhci-mem.c in the first patch:
  
-  add8469b3e00 ("xhci: fix frame id calculation and checks for isoc URBs")
-  b08d153c95f1 ("xhci: Set frame ID field of isoc TRB when starting an isoch 
stream")
-  05506a76f13a ("usb: xhci: Fix isochronous scheduling regression")
+  add8469b3e00 ("xhci: fix frame id calculation and checks for isoc URBs")
+  b08d153c95f1 ("xhci: Set frame ID field of isoc TRB when starting an isoch 
stream")
+  05506a76f13a ("usb: xhci: Fix isochronous scheduling regression")
  
  05506a76f13a carries "Fixes: add8469b3e00". No other mainline commit up to
  v7.4-rc3 has a Fixes: tag for any of the three. None of them was tagged for
  stable. Upstream 7.0.y is no longer maintained, so this can only reach
  resolute as an SRU.
  
  [ Test Plan ]
  
  1. Connect a High-Speed UAC2 device with asynchronous explicit feedback
-    (feedback endpoint bInterval=1) to an xHCI port on a CFC-capable
-    controller. Check that bit 11 of HCCPARAMS1 is set in
-    /sys/kernel/debug/usb/xhci/<pci-dev>/reg-cap.
+    (feedback endpoint bInterval=1) to an xHCI port on a CFC-capable
+    controller. Check that bit 11 of HCCPARAMS1 is set in
+    /sys/kernel/debug/usb/xhci/<pci-dev>/reg-cap.
  2. Start playback, e.g.
-    aplay -D hw:<card>,0 --buffer-time=100000 --period-time=10000 -f dat 
/dev/zero
+    aplay -D hw:<card>,0 --buffer-time=100000 --period-time=10000 -f dat 
/dev/zero
  3. While it plays, record the xhci trace:
-    trace-cmd record -b 16384 -e xhci-hcd:xhci_queue_trb \
-      -e xhci-hcd:xhci_ring_ep_doorbell -- sleep 2
-    Decode the isoc TRBs from xhci_queue_trb: TRB type (field3 bits 15:10)
-    == 5, Frame ID = field3 bits 30:20. The endpoint is identified by the
-    xhci_ring_ep_doorbell event that follows the TRBs of each URB
-    (DCI = 2 * endpoint number + 1 for IN). Count the TDs per Frame ID for
-    each endpoint. Skip the first and last frame of the trace, because the
-    trace window cuts them part-way.
+    trace-cmd record -b 16384 -e xhci-hcd:xhci_queue_trb \
+      -e xhci-hcd:xhci_ring_ep_doorbell -- sleep 2
+    Decode the isoc TRBs from xhci_queue_trb: TRB type (field3 bits 15:10)
+    == 5, Frame ID = field3 bits 30:20. The endpoint is identified by the
+    xhci_ring_ep_doorbell event that follows the TRBs of each URB
+    (DCI = 2 * endpoint number + 1 for IN). Count the TDs per Frame ID for
+    each endpoint. Skip the first and last frame of the trace, because the
+    trace window cuts them part-way.
  4. Expected with the fix: 8 TDs per Frame ID for a 125 us endpoint, Frame IDs
-    strictly consecutive, and no idle microframes on a bus analyzer. Without
-    the fix: 4-7 TDs per Frame ID and periodic idle microframes.
+    strictly consecutive, and no idle microframes on a bus analyzer. Without
+    the fix: 4-7 TDs per Frame ID and periodic idle microframes.
  
  Results on the hardware above (2 s trace during playback; histogram of TDs
  per Frame ID, {TDs per frame: number of frames}):
  
-  - 7.0.0-43-generic (stock, unpatched):
-      EP 0x01 OUT             {4: 352, 5: 816, 6: 651, 7: 183}
-      EP 0x81 IN (feedback)   {1: 1001, 3: 1001}
-    Periodic idle microframes on the bus.
-  - 7.0.0-43.43 source + these three patches (built locally, 7.0.14-xhcibp):
-      EP 0x01 OUT             {8: 2004}
-      EP 0x81 IN (feedback)   {8: 2004}
-    Frame IDs strictly consecutive. No idle microframes on the bus.
-  - resolute master-next 70d93713221b (7.0.0-44.44) + these three patches
-    (built locally, 7.0.14-master):
-      EP 0x01 OUT             {8: 2003}
-      EP 0x81 IN (feedback)   {8: 2003}
-    Frame IDs strictly consecutive. No idle microframes on the bus.
-  - Mainline v7.4-rc2, which already contains the three commits:
-    no idle microframes on the bus.
+  - 7.0.0-43-generic (stock, unpatched):
+      EP 0x01 OUT             {4: 352, 5: 816, 6: 651, 7: 183}
+      EP 0x81 IN (feedback)   {1: 1001, 3: 1001}
+    Periodic idle microframes on the bus.
+  - 7.0.0-43.43 source + these three patches (built locally, 7.0.14-xhcibp):
+      EP 0x01 OUT             {8: 2004}
+      EP 0x81 IN (feedback)   {8: 2004}
+    Frame IDs strictly consecutive. No idle microframes on the bus.
+  - resolute master-next 70d93713221b (7.0.0-44.44) + these three patches
+    (built locally, 7.0.14-master):
+      EP 0x01 OUT             {8: 2003}
+      EP 0x81 IN (feedback)   {8: 2003}
+    Frame IDs strictly consecutive. No idle microframes on the bus.
+  - Mainline v7.4-rc2, which already contains the three commits:
+    no idle microframes on the bus.
  
  [ Where problems could occur ]
  
  The changes affect scheduling of all isochronous transfers on xHCI hosts:
  USB audio, UVC webcams, and other isoc users. Hosts with CFC are the most
  affected, because they use an explicit Frame ID for every TD.
  
-  - Patch 1 changes how the first URB of a stream is placed: it is aligned
-    to a full frame, or to the interval start if the interval is longer than
-    a frame. It also stops falling back to SIA or inserting Frame ID gaps
-    mid-stream. A device that relied on those gaps for recovery, or a driver
-    that submits isoc URBs late, could now see TDs scheduled into the past,
-    which complete with -EXDEV (Missed Service), instead of being silently
-    moved forward.
-  - Patch 2 also sets the Frame ID for the first TD of a stream on hosts
-    without CFC. A controller that mishandles Frame ID on non-CFC hosts could
-    start streams at a different time than before.
-  - Patch 3 fixes a regression introduced by patch 1. Without it, a stream
-    restarted after an OUT underrun (e.g. snd-usb-audio in duplex mode) could
-    be scheduled into the past and loop in -EXDEV recovery. It is required
-    together with patch 1.
+  - Patch 1 changes how the first URB of a stream is placed: it is aligned
+    to a full frame, or to the interval start if the interval is longer than
+    a frame. It also stops falling back to SIA or inserting Frame ID gaps
+    mid-stream. A device that relied on those gaps for recovery, or a driver
+    that submits isoc URBs late, could now see TDs scheduled into the past,
+    which complete with -EXDEV (Missed Service), instead of being silently
+    moved forward.
+  - Patch 2 also sets the Frame ID for the first TD of a stream on hosts
+    without CFC. A controller that mishandles Frame ID on non-CFC hosts could
+    start streams at a different time than before.
+  - Patch 3 fixes a regression introduced by patch 1. Without it, a stream
+    restarted after an OUT underrun (e.g. snd-usb-audio in duplex mode) could
+    be scheduled into the past and loop in -EXDEV recovery. It is required
+    together with patch 1.
  
  [ Other Info ]
  
-  - The issue was diagnosed with xhci trace events and an OpenVizsla capture.
-    snd-usb-audio is not at fault: URBs are resubmitted promptly, and the
-    gaps come from the Frame ID assignment in xhci-ring.c.
+  - The issue was diagnosed with xhci trace events and an OpenVizsla capture.
+    snd-usb-audio is not at fault: URBs are resubmitted promptly, and the
+    gaps come from the Frame ID assignment in xhci-ring.c.
  
  ProblemType: Bug
  DistroRelease: Ubuntu 26.04
  Package: linux-image-7.0.0-43-generic 7.0.0-43.43
  ProcVersionSignature: Ubuntu 7.0.0-43.43-generic 7.0.14
  Uname: Linux 7.0.0-43-generic x86_64
  ApportVersion: 2.34.1-0ubuntu0.1
  Architecture: amd64
  AudioDevicesInUse:
-  USER        PID ACCESS COMMAND
-  /dev/snd/controlC1:  tomo-local   5797 F.... wireplumber
-  /dev/snd/controlC0:  tomo-local   5797 F.... wireplumber
-  /dev/snd/seq:        tomo-local   5780 F.... pipewire
+  USER        PID ACCESS COMMAND
+  /dev/snd/controlC1:  tomo-local   5797 F.... wireplumber
+  /dev/snd/controlC0:  tomo-local   5797 F.... wireplumber
+  /dev/snd/seq:        tomo-local   5780 F.... pipewire
  CasperMD5CheckResult: pass
  CurrentDesktop: XFCE
  Date: Tue Nov 17 15:26:13 2026
  InstallationDate: Installed on 2026-06-23 (147 days ago)
  InstallationMedia: Ubuntu 26.04 "Resolute Raccoon" - Release amd64 
(20260423.1)
  MachineType: Dell Inc. Precision 3490
  ProcEnviron:
-  LANG=en_US.UTF-8
-  PATH=(custom, no user)
-  SHELL=/bin/bash
-  TERM=xterm-256color
-  XDG_RUNTIME_DIR=<set>
+  LANG=en_US.UTF-8
+  PATH=(custom, no user)
+  SHELL=/bin/bash
+  TERM=xterm-256color
+  XDG_RUNTIME_DIR=<set>
  ProcFB: 0 i915drmfb
  ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-7.0.0-43-generic 
root=/dev/mapper/ubuntu--vg-ubuntu--lv ro quiet splash 
crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M
  RebootRequiredPkgs: Error: path contained symlinks.
  SourcePackage: linux
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 08/25/2026
  dmi.bios.release: 1.27
  dmi.bios.vendor: Dell Inc.
  dmi.bios.version: 1.27.1
  dmi.board.name: 0FNG8D
  dmi.board.vendor: Dell Inc.
  dmi.board.version: A00
  dmi.chassis.type: 10
  dmi.chassis.vendor: Dell Inc.
  dmi.ec.firmware.release: 1.23
  dmi.modalias: 
dmi:bvnDellInc.:bvr1.27.1:bd08/25/2026:br1.27:efr1.23:svnDellInc.:pnPrecision3490:pvr:rvnDellInc.:rn0FNG8D:rvrA00:cvnDellInc.:ct10:cvr:sku0CB3:pfaPrecision:
  dmi.product.family: Precision
  dmi.product.name: Precision 3490
  dmi.product.sku: 0CB3
  dmi.sys.vendor: Dell Inc.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174743

Title:
  xhci: High-Speed isochronous OUT stream has periodic gaps on CFC-
  capable hosts (USB Audio 2 explicit feedback, bInterval=1)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2174743/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to