New: Hardware - Host controller: ASMedia ASM2142/ASM3142 USB 3.1 Host Controller [1b21:2142] on a PCIe add-in card (GLOTRENDS U3142X1), link 8 GT/s x1, Kernel driver: xhci_hcd xhci quirks reported at probe: 0x0000000000800010 (SPURIOUS_SUCCESS | NO_64BIT_
https://bugzilla.kernel.org/show_bug.cgi?id=222328
Bug ID: 222328
Summary: Hardware - Host controller: ASMedia ASM2142/ASM3142
USB 3.1 Host Controller [1b21:2142] on a PCIe add-in
card (GLOTRENDS U3142X1), link 8 GT/s x1, Kernel
driver: xhci_hcd xhci quirks reported at probe:
0x0000000000800010 (SPURIOUS_SUCCESS | NO_64BIT_
Product: Drivers
Version: 2.5
Kernel Version: 7.3.4
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: USB
Assignee: [email protected]
Reporter: [email protected]
Regression: NoCreated attachment 311583
--> https://bugzilla.kernel.org/attachment.cgi?id=311583&action=edit
dmesg, lspci, lsusb, v4l2 formats and xhci tracepoints
Hardware
- Host controller: ASMedia ASM2142/ASM3142 USB 3.1 Host Controller [1b21:2142] on a PCIe add-in card
(GLOTRENDS U3142X1), link 8 GT/s x1, Kernel driver: xhci_hcd xhci quirks reported at probe: 0x0000000000800010 (SPURIOUS_SUCCESS |NO_64BIT_SUPPORT)
- Device: Elgato 4K X capture card [0fd9:009b] (SuperSpeed Plus PID; USB_QUIRK_NO_BOS applies),
UVC 1.00, video on a bulk endpoint (EP 2 IN, wMaxPacketSize 1024, bMaxBurst
7)
- Board: Gigabyte A520M S2H, Ryzen 5 5600X
- Kernel: 7.3.4-ogc10.1.fc45.x86_64 (Bazzite / Fedora 45) Reproduced with and without iommu=pt.
Symptom
- The device enumerates at SuperSpeed Plus and every UVC mode is offered (e.g. NV12 3840x2160@60).
- Capture of any mode, including NV12 1920x1080@60 and MJPEG 3840x2160@60, delivers about 1 frame
every few seconds. ffmpeg shows "frame= 1 ... elapsed=0:00:06".
- dmesg repeatedly shows:
xhci_hcd 0000:04:00.0: Event dma 0x000000000b036000 for ep 4 status 1 not
part of TD at 000000000b02cfe0 - 000000000b02cfe0
xhci_hcd 0000:04:00.0: Event dma 0x000000000b036010 for ep 4 status 1 not
part of TD at 000000000b02cfe0 - 000000000b02cfe0
xhci_hcd 0000:04:00.0: Event dma 0x000000000b036020 for ep 4 status 1 not
part of TD at 000000000b02cfe0 - 000000000b02cfe0
xhci_hcd 0000:04:00.0: Event dma 0x000000000b036030 for ep 4 status 1 notpart of TD at 000000000b02cfe0 - 000000000b02cfe0
- Same device, same card, same cable on Windows 11: full 10 Gbps capture works.
- The same device on the board's AMD xHCI ports (other controllers) captures normally.
Analysis (xhci-hcd tracepoints, uvcvideo bulk URBs of 16384 bytes, 1 TRB per TD)
The stream runs at full speed until the endpoint ring's enqueue reaches the last TRB slot before the
Link TRB. The controller completes the TRBs before it, posts NO transfer event for the TRB at
segment offset 0xfe0, and then posts events for the TRBs on the next segment. The driver's current TD
stays at ...fe0, so every later event is "not part of TD" and the stream stalls.
xhci_queue_trb: BULK: @0x...b02cfc0 ... length 16384 ... flags
b:i:I:c:s:I:e:c
xhci_queue_trb: BULK: @0x...b02cfd0 ... length 16384
xhci_queue_trb: BULK: @0x...b02cfe0 ... length 16384 <-- last
TRB before link TRB at ...ff0
xhci_queue_trb: BULK: @0x...b036000 ... length 16384 <-- next
segment
xhci_queue_trb: BULK: @0x...b036010 ... length 16384
xhci_handle_event: TRB 000000000b02cfc0 status 'Success' ... ep 5 'Transfer
Event'
xhci_handle_event: TRB 000000000b02cfd0 status 'Success' ...
(no event for 000000000b02cfe0)
xhci_handle_event: TRB 000000000b036000 status 'Success' ... -> "not part
of TD"
xhci_handle_event: TRB 000000000b036010 status 'Success' ... -> "not part
of TD"
xhci_handle_event: TRB 000000000b036020 status 'Success' ...
xhci_handle_event: TRB 000000000b036030 status 'Success' ...
It looks as if the ASM2142/3142 does not post a completion event for a TD that ends on the TRB
directly before an unchained Link TRB, at least at SuperSpeed Plus with this bulk device. Windows'
xHCI driver is not affected, possibly because of different ring and link TRB chaining behaviour.
Attachments
- xhci-trace-all.txt.gz: xhci-hcd tracepoints during a 4 s capture attempt
- dmesg.txt, lspci-asm3142.txt (lspci -vvv), lspci-tree.txt, lsusb-tree.txt, v4l2-formats.txt,
ffmpeg-1080p60.txt, uname.txt
Steps to reproduce
ffmpeg -f v4l2 -input_format nv12 -video_size 1920x1080 -framerate 60 \
-i /dev/v4l/by-id/usb-Elgato_Elgato_4K_X_*-video-index0 -t 4 -f null -Workarounds tried, none helped:
- iommu=pt: no change.
- xhci_hcd.quirks=0x1 (XHCI_LINK_TRB_QUIRK, probe quirks 0x0000000000800011):
no change. The event for the
TRB right before the link TRB is still missing:
Event dma 0x00000000fec67000 for ep 4 status 1 not part of TD at
00000000fec66fe0 - 00000000fec66fe0
Happy to test patches. I can build and boot a test kernel if needed.
Signature · 2 lines
You are receiving this mail because: You are watching the assignee of the bug.
[Bug 222328] xhci: ASMedia ASM2142/ASM3142 [1b21:2142] skips transfer event for bulk TRB before link TRB -> UVC stream (Elgato 4K X, 10 Gbps) stalls with "not part of TD"
https://bugzilla.kernel.org/show_bug.cgi?id=222328
Michał Pecio ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #1 from Michał Pecio ([email protected]) --- Fascinating, the same happens on my ASM3142 with a 5gbps UVC capture device, but I haven't seen it with other USB3 bulk IN devices. Typically for ASMedia, the bug is random (several TDs at 0x...fe0 succeed before the first missing event is logged). Or maybe it happens if the unreported transfer was short?
Patching uvcvideo to only submit one URB at a time (#define UVC_URBS 1) seems to fix it, but 2 URBs trigger it about as quickly as 5. Seems to happen faster if the device is behind a hub.
Windows works differently, it uses Event Data TRBs so if the transfers do actually occur but IOC/ISP handling is broken, Windows won't notice. And there is never such a thing as a transfer TRB immediately before an unchained link.
But implementing EDs properly seems like a bit of work; I think I will try some hacks like padding the ring with NOPs before the link...
I haven't seen this on ASM1142 and Promontory yet.
Signature · 2 lines
You are receiving this mail because: You are watching the assignee of the bug.
[Bug 222328] xhci: ASMedia ASM2142/ASM3142 [1b21:2142] skips transfer event for bulk TRB before link TRB -> UVC stream (Elgato 4K X, 10 Gbps) stalls with "not part of TD"
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=222328
--- Comment #2 from [email protected] --- (In reply to Michał Pecio from comment #1)
Quoted 15 lines
Fascinating, the same happens on my ASM3142 with a 5gbps UVC capture device, but I haven't seen it with other USB3 bulk IN devices. Typically for ASMedia, the bug is random (several TDs at 0x...fe0 succeed before the first missing event is logged). Or maybe it happens if the unreported transfer was short?
Patching uvcvideo to only submit one URB at a time (#define
UVC_URBS1) seems to fix it, but 2 URBs trigger it about as quickly as 5. Seems to happen faster if the device is behind a hub.Windows works differently, it uses Event Data TRBs so if the transfers do actually occur but IOC/ISP handling is broken, Windows won't notice. And there is never such a thing as a transfer TRB immediately before an unchained link.
Quoted 4 lines
But implementing EDs properly seems like a bit of work; I think I will try some hacks like padding the ring with NOPs before the link...
I haven't seen this on ASM1142 and Promontory yet.
Thanks for looking into this.
A few details from my side, in case they help:
- The Elgato is plugged directly into the ASM3142 card's port, not behind a hub.
- It also stalls when it enumerates at 5 Gbps (0fd9:009c), not just at 10 Gbps.
- In my trace, all completed bulk TDs were full length (16384/16384, apart from one 16104), so I can't tell
whether the unreported one was short.
- The same Elgato works normally on the board's AMD (Promontory/Matisse) ports.
I'm on Bazzite (immutable Fedora), so testing a custom kernel is harder for me, but I'm happy to test a patch if there's a practical way.
Signature · 2 lines
You are receiving this mail because: You are watching the assignee of the bug.