Re: [PATCH v2] drvier: usb: dwc3: Fix runtime PM trying to activate child device xxx.dwc3 but parent is not active
From: ryan zhou
Date: Thu Sep 11 2025 - 09:26:03 EST
Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> 于2025年9月10日周三 21:07写道:
>
> On Wed, Sep 10, 2025 at 08:56:36PM +0800, ryan zhou wrote:
> > Hi Greg KH,
> > Sorry, I didn't understand your question. Are you asking for my patch
> > commit ID? I've resubmitted patch v3, and the commit details are as
> > follows:
> >
> > commit 92bc5086f53404f6d14d8550209d1c8cd3fa9036 (HEAD -> usb-next-develop)
> >
> > Or do you need the commit that introduced this issue?
>
> Sorry, I mean "what commit does this fix", so that you can add a
> "Fixes:" tag to it.
I initially targeted these two issues:
commit1: 0227cc84c44417a29c8102e41db8ec2c11ebc6b2
usb: dwc3: core: don't do suspend for device mode if already suspended
commit2: 68c26fe58182f5af56bfa577d1cc0c949740baab
usb: dwc3: set pm runtime active before resume common
When the DWC3 controller is in a runtime suspend state, an interruption occurs
during the system sleep transition, resulting in USB failure to resume
properly after wakeup.
The detailed sequence is as follows:(refer to commit e3a9bd247cddf
merged by Ray Chi)
EX.
RPM suspend: ... -> dwc3_runtime_suspend()
-> rpm_suspend() of parent device
...
PM suspend: ... -> dwc3_suspend() -> pm_suspend of parent device
^ interrupt, so resume suspended device
... <- dwc3_resume() <-/
^ pm_runtime_set_active() returns erro
Post-analysis reveals:
Commit 2 generates unexpected error logs ( runtime PM trying to
activate child device xxx.dwc3 but parent is not active).
Commit 1 disrupts USB recovery in this context, attributable to
the following factors:
EX.
RPM suspend: ... -> dwc3_runtime_suspend()
-> rpm_suspend() of parent device
...
PM suspend: ... -> dwc3_suspend()
|___dwc3_suspend_common()
^ if
(pm_runtime_suspended(dwc->dev)) then skip suspend process
|___dwc3_core_exit()
|___dwc3_phy_exit()
PM resume ... <- dwc3_resume()
|___dwc3_resume_common()
^ pm_runtime_set_active()
report error(error logs : runtime PM trying to activate child device
xxx.dwc3 but parent is not active).
|___dwc3_core_init_for_resume()
|___dwc3_core_init()
|___dwc3_phy_init()
^ phy->init_count++ and
phy->power_count++
... Next,usb connect (Note: dwc3 is always in runtime suspend)
RPM resume ... <- dwc3_runtime_resume()
|___dwc3_resume_common()
|___dwc3_core_init_for_resume()
|___dwc3_core_init()
|___dwc3_phy_init()
^PHY reinitialization is
prevented due to non-zero values in phy->init_count and phy->power_on.
However, during my submission process, I found that Ray Chi
encountered the same issue and has already merged commit e3a9bd247cddf
(usb: dwc3:
Skip resume if pm_runtime_set_active() fails), which fixed the problem
introduced by commit 2. But the error logs (runtime PM trying to
activate child
device xxx.dwc3 but parent is not active) introduced by commit 1 still remains.
I will now evaluate whether to proceed with further fixes for the
issue introduced by commit 1, based on Ray Chi's submission. And also
I will incorporate
the relevant background details in the subsequent commit.In my view,
commit e3a9bd247cddf (usb: dwc3:Skip resume if pm_runtime_set_active()
fails)
appears to be more of a workaround solution.
thanks,
Ryan