Re: xhci: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

Mathias Nyman
2025-04-04T14:25:32Z

On 3.4.2025 21.02, Paul Menzel wrote:
> Dear Linux folks,
>
>
> Just a heads-up, that connecting an LMP USB-C mini Dock [1] to the Intel Kaby Lake Dell XPS 13 9360 with
>
>     00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller [8086:9d2f] (rev 21)
>
> resulted in Linux 6.14.0-12966-ga2cc6ff5ec8f logging the warning and trace below.
>
> ```
> [   74.898485] usb 4-1.4: reset SuperSpeed USB device number 5 using xhci_hcd
> [   74.916241] sd 0:0:0:0: [sda] Media removed, stopped polling
> [   74.916634] sd 0:0:0:0: [sda] Attached SCSI removable disk
> [   98.803081] PM: suspend entry (deep)
> [   98.813999] Filesystems sync: 0.010 seconds
> [   98.819226] Freezing user space processes
> [  105.534176] xhci_hcd 0000:39:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
> [  105.606437] usb 4-1.4: reset SuperSpeed USB device number 5 using xhci_hcd
> [  118.822270] Freezing user space processes failed after 20.003 seconds (2 tasks refusing to freeze, wq_busy=0):

Thanks for the report.

Looks like it's triggered during system suspend.

"The Set TR Deq" command that fails here is queued when
- endpoint stops to remove cancelled transfers.
- endpoint resets to clear STALL or other halt due to transfer error.
- canceling a transfer while endpoint is mid stall or tt clearing.

Looks like there are at least some gaps in verifying endpoint state in endpoint
reset handler before queuing the "Set TR Deq" command,
this could be a possible reason.

If this case could be reproduces with xhci dynamic debug enabled it would help
narrowing down the real cause.

echo 'module xhci_hcd =p' >/sys/kernel/debug/dynamic_debug/control

Thanks
Mathias