Re: [PATCH] usb: xhci: prevent spurious root hub resume during suspend
From: Pei Xiao
Date: Tue Jun 30 2026 - 21:10:37 EST
在 2026/6/30 18:30, Mathias Nyman 写道:
> On 6/30/26 11:43, Pei Xiao wrote:
>>
>>
>> 在 2026/6/30 16:10, Mathias Nyman 写道:
>>> On 6/30/26 10:36, Pei Xiao wrote:
>>>> handle_port_status() unconditionally resumes the root hub when
>>>> hcd->state is HC_STATE_SUSPENDED, regardless of whether a device is
>>>> actually attached to the port. This can cause system suspend to fail
>>>> with -EBUSY if a spurious port change event arrives on an empty port
>>>> after its bus has entered suspend.
>>>>
>>>> Fix this by checking PORT_CONNECT in handle_port_status() before
>>>> resuming the root hub. If no device is actually present on the port,
>>>> the event is spurious and should be silently ignored rather than
>>>> aborting suspend.
>>>
>>> Doesn't this change prevent handling device disconnects on suspended
>>> hosts?
>>>
>> *Thank you for your reply. I’m not familiar with xHCI or these
>> registers.
>> Can’t we tell the difference between a real unplug and a situation
>> where
>> the device is physically still attached but portsc reports a
>> disconnect?
>
> Not really. In your case it really looks like a disconnect.
>
> Port Status: 0x202a0
> Disconnected
> Disabled
> Link: Rx Detect
> Powered
> Unknown port speed
> Connect Status Change
>
> Is it only this specific device that disconnects on suspend, or can
> this be
> reproduced with any usb device?
>
It's specific devices—like USB flash drives and external hard drives.
A USB keyboard doesn't have the problem. And for the device that does
have the issue, if I plug it into a USB hub and then connect that hub to
the host,
the issue doesn't happen either.
Thanks
Pei.
> Thanks
> Mathias