Re: [RFC PATCH] usb: xhci: report USB2 resume-exit timeout as an error
From: Mathias Nyman
Date: Fri Jun 26 2026 - 07:06:38 EST
On 6/23/26 17:05, Pengpeng Hou wrote:
xhci_handle_usb2_port_link_resume() waits for the USB2 resume exit
completion after requesting U0. If that wait times out, it only logs a
warning and then continues through the normal resume-done path, ending
the port resume and marking the suspend change as completed.
Return -ETIMEDOUT on resume-exit timeout so the port status path reports
an error instead of a successful resume. The patch still ends the
usbcore port-resume accounting before returning. This is intended as an
RFC patch because xHCI resume state handling is policy-sensitive.
Does this resolve some issue you are seeing?
xhci_handle_usb2_port_link_resume() is only called when xhci roothub
responds to hub driver GetPortStatus() request while port is in a xhci resume state.
Returning -ETIMEDOUT here will cause the GetPortStatus() request to complete
with -EPIPE status. This does not seem like the right choice here.
If resuming the port to U0 timed out then there was no xhci port event, and port
should still be in xhci resume state. USB2 does not have a "resume" state so
returning portstatus as USB_PORT_STAT_SUSPEND seems appropriate.
Ee should also reconsider if calling usb_hcd_end_port_resume() is right in
the timeout case.
It also looks like we accept any port event as a successful rexit_done completion.
If the event was due to a disconnect we will incorrectly still report port status
as connected , enabled and non-suspended for this usb2 device.
Thanks
Mathias