Skip to content

xhci: clean up endpoint rings after disconnect detect

Mathias Nyman linux-usb lkml regressions 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xhci: give back all TDs when skipping endpoint reset after disconnectdrivers/usb/host/xhci-ring.c drivers/usb/host/xhci.c+17 -80 replies
2/2xhci: clean up ep0 ring after disconnect instead of leaving stale TRBsdrivers/usb/host/xhci-ring.c+59 -180 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchDiogo ChavesDennis WisselYiyu Zhou
SeriesT-b T-b
1/2T-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [RFT PATCH 0/2] xhci: clean up endpoint rings after disconnect detect

Yiyu Zhou wrote PATCH 1/2, fixing a regression in USB HID device enumeration caused by the endpoint recovery prevention code added in v7.3-rc1. Some HID devices that used to enumerate after a brief disconnect during enumeration now got stuck until URBs timed out.

PATCH 1/2 gives back the pending URBs right away, which solves most of the problem, but it leaves the TRBs of the given back URBs on the ep0 ring. ep0 survives a brief disconnect during a port reset, so the xHC may later process those TRBs during an enumeration retry, writing into buffers that were already given back, or ep0 stays halted and the next control transfer times out.

PATCH 2/2 cleans up the ep0 ring by resetting ep0 and moving its dequeue pointer past the cancelled TDs, even if a disconnect or link error is detected. Only Reset Endpoint and Set TR Dequeue Pointer commands are issued; ep0 is not restarted while the disconnect is pending. The rapid endpoint reset, restart and stop sequence that made some xHC hosts fail Stop Endpoint commands is still avoided. Other endpoints are still given back without resetting them, but their TRBs are turned into no-ops first.

If you have seen the HID enumeration issue, or the xHC Stop Endpoint failures with rapid endpoint state changes, testing these two patches would be greatly appreciated.

If these patches work, they might be squashed into one before going upstream.

[This message, and PATCH 2/2 commit message were cleaed up by LLM, Code is still 'organic'.]

Thanks
Mathias

Mathias Nyman (1):
xhci: clean up ep0 ring after disconnect instead of leaving stale TRBs

Yiyu Zhou (1):
xhci: give back all TDs when skipping endpoint reset after disconnect

 drivers/usb/host/xhci-ring.c | 71 ++++++++++++++++++++++++++++++------
 drivers/usb/host/xhci.c      | 13 ++++---
 2 files changed, 67 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0