xhci: unratelimited "buffer overrun event" warning floods log (~7000/s) with USB S/PDIF capture device
Subsystems (3)
Good day Mathias,
With a USB S/PDIF TX/RX adapter (Savitech, 262a:9123, UAC2, high speed), the xHCI driver logs an isochronous buffer overrun warning for nearly every microframe while the adapter's S/PDIF input has no signal:
xhci_hcd 0000:00:14.0: WARN: buffer overrun event for slot 2 ep 4 on endpoint
Rate measured: ~433,000 messages per minute (~7,200/s). systemd-journald sits at 100% of one core and reports "Missed N kernel messages".
Setup:
- Intel N100 (PCH xHCI 0000:00:14.0), Debian 13
- Kernel: 6.12.117+deb13-amd64 (same code in mainline 7.4-rc3)
- Capture stream open continuously (CamillaDSP), 48 kHz S16_LE, EP 0x82 IN isochronous, adaptive, 125 us interval
- TV feeding the S/PDIF input goes idle -> no input signal -> flood. With a valid input signal the count is 0.
The device is clearly misbehaving (it sends more data than requested when the S/PDIF receiver is unlocked; it also reports its clock source as valid while unlocked). The driver handles the events correctly and audio recovers fine. The problem is only the logging: the warning in handle_tx_event() for COMP_ISOCH_BUFFER_OVERRUN is not rate-limited, so a single misbehaving isoc device can generate thousands of lines per second.
Locally I changed that xhci_warn() to dev_warn_ratelimited() and the rate dropped to ~100/min with no functional change.
Would a patch rate-limiting this message (or demoting it to xhci_dbg) be acceptable?
drivers/usb/host/xhci-ring.c +0 -0
@@ handle_tx_event()case COMP_ISOCH_BUFFER_OVERRUN : - xhci_warn(xhci, - "WARN: buffer overrun event for slot %u ep %u on
endpoint",
- slot_id, ep_index);
+ dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller,
+ "WARN: buffer overrun event for slot %u
ep %u on endpoint\n",
+ slot_id, ep_index);
break;
or
case COMP_ISOCH_BUFFER_OVERRUN:
- xhci_warn(xhci,
- "WARN: buffer overrun event for slot %u ep %u on
endpoint",
- slot_id, ep_index);
+ xhci_dbg(xhci, "Buffer overrun event for slot %u ep %u\n",
+ slot_id, ep_index);
break;
Endpoint descriptor:
Endpoint 0x82 (capture), from lsusb -v:
altset 1 (S16_LE): Isochronous, Adaptive, wMaxPacketSize 104, bInterval 1 altset 2 (S24_3LE): Isochronous, Adaptive, wMaxPacketSize 156, bInterval 1
/proc/asound/card0/stream0 while flooding:
Capture: Status: Running, Interface 3, Altset 1, Packet Size = 36, Momentary freq = 48000 Hz
Thank you,
Alex.
Hi,
Quoted 22 lines · Alex Kononov
Good day Mathias,
With a USB S/PDIF TX/RX adapter (Savitech, 262a:9123, UAC2, high speed), the xHCI driver logs an isochronous buffer overrun warning for nearly every microframe while the adapter's S/PDIF input has no signal:
xhci_hcd0000:00:14.0: WARN: buffer overrun event for slot 2 ep 4 on endpointRate measured: ~433,000 messages per minute (~7,200/s). systemd-journald sits at 100% of one core and reports "Missed N kernel messages".
Setup:
- Intel N100 (PCH xHCI 0000:00:14.0), Debian 13
- Kernel: 6.12.117+deb13-amd64 (same code in mainline 7.4-rc3)
- Capture stream open continuously (CamillaDSP), 48 kHzS16_LE, EP0x82IN isochronous, adaptive, 125 us interval
- TV feeding the S/PDIF input goes idle -> no input signal -> flood. With a valid input signal the count is 0.
Quoted 3 lines
The device is clearly misbehaving (it sends more data than requested when the S/PDIF receiver is unlocked; it also reports its clock source as valid while unlocked).
Either the device is buggy or snd_usb_audio driver submits wrong URBs, but that's a sound subsystem issue.
Quoted 9 lines
The driver handles the events correctly and audio recovers fine. The problem is only the logging: the warning in
handle_tx_event()forCOMP_ISOCH_BUFFER_OVERRUNis not rate-limited, so a single misbehaving isoc device can generate thousands of lines per second.Locally I changed that
xhci_warn()todev_warn_ratelimited()and the rate dropped to ~100/min with no functional change.
Would a patch rate-limiting this message (or demoting it toxhci_dbg) be acceptable?
Not Mathias, but I think it should be xhci_dbg() like all the other conditions which are device-triggerable rather than driver bugs. People can still see this as -EOVERFLOW status in iso_frame_desc[].
Quoted 7 lines
drivers/usb/host/xhci-ring.c +0
-0@@
handle_tx_event()drivers/usb/host/xhci-ring.c +0
-2case COMP_ISOCH_BUFFER_OVERRUN : - xhci_warn(xhci, - "WARN: buffer overrun event for slot %u ep %u onendpoint",
When submitting, please make sure to avoid line breaks like this.
Regards,
Michal