lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0g_0D7-68eM6ofv3naSipvXEF4pLMknjwGaA6kLm1FzMg@mail.gmail.com>
Date: Thu, 11 Sep 2025 15:58:34 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: ryan zhou <ryanzhou54@...il.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Xu Yang <xu.yang_2@....com>, 
	Thinh Nguyen <Thinh.Nguyen@...opsys.com>, 
	"stern@...land.harvard.edu" <stern@...land.harvard.edu>, 
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, 
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>, 
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>, "royluo@...gle.com" <royluo@...gle.com>
Subject: Re: [PATCH v2] drvier: usb: dwc3: Fix runtime PM trying to activate
 child device xxx.dwc3 but parent is not active

On Thu, Sep 11, 2025 at 3:57 PM ryan zhou <ryanzhou54@...il.com> wrote:
>
> Rafael J. Wysocki <rafael@...nel.org> 于2025年9月11日周四 19:36写道:
> >
> > On Thu, Sep 11, 2025 at 12:58 PM Xu Yang <xu.yang_2@....com> wrote:
> > >
> > > Hi Ryan,
> > >
> > > On Thu, Sep 11, 2025 at 01:32:47AM +0000, Thinh Nguyen wrote:
> > > > On Wed, Sep 10, 2025, Ryan Zhou wrote:
> > > > > Issue description:During the wake-up sequence, if the system invokes
> > > > >  dwc3->resume and detects that the parent device of dwc3 is in a
> > > > > runtime suspend state, the system will generate an error: runtime PM
> > > > > trying to activate child device xxx.dwc3 but parent is not active.
> > > > >
> > > > > Solution:At the dwc3->resume entry point, if the dwc3 controller
> > > > > is detected in a suspended state, the function shall return
> > > > > immediately without executing any further operations.
> > > > >
> > > > > Signed-off-by: Ryan Zhou <ryanzhou54@...il.com>
> > > > > ---
> > > > >  drivers/usb/dwc3/core.c | 3 +++
> > > > >  1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > > > > index 370fc524a468..06a6f8a67129 100644
> > > > > --- a/drivers/usb/dwc3/core.c
> > > > > +++ b/drivers/usb/dwc3/core.c
> > > > > @@ -2687,6 +2687,9 @@ int dwc3_pm_resume(struct dwc3 *dwc)
> > > > >     struct device *dev = dwc->dev;
> > > > >     int             ret = 0;
> > > > >
> > > > > +   if (pm_runtime_suspended(dev))
> > > > > +           return ret;
> > > > > +
> > > >
> > > > Is this a documented behavior where the device should remain runtime
> > > > suspend on system resume? I feel that that this should be configurable
> > > > by the user or defined the PM core. I don't think we should change
> > > > default behavior here just to workaround the issue that we're facing.
> > > >
> > > > What if the user wants to keep the old behavior and resume up the device
> > > > on system resume?
> > >
> > > What about resume the device firstly if it's already runtime suspended when
> > > call dwc3_pm_suspend(). Therefor, the old behavior can be kept and the issue
> > > can be avoided.
> > >
> > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > > index 370fc524a468..1b8dbb260017 100644
> > > --- a/drivers/usb/dwc3/core.c
> > > +++ b/drivers/usb/dwc3/core.c
> > > @@ -2672,6 +2672,9 @@ int dwc3_pm_suspend(struct dwc3 *dwc)
> > >         struct device *dev = dwc->dev;
> > >         int             ret;
> > >
> > > +       if (pm_runtime_suspended(dev))
> > > +               pm_runtime_resume(dev);
> >
> > You can just call pm_runtime_resume() here without the preliminary check.
>
> If the device is active before sleep, skip runtime_resume after wakeup
> and just call dwc3->suspend.

But pm_runtime_resume() will not resume an active device, will it?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ