[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <59951c2d-60e8-47a8-a43c-00b92e095043@rowland.harvard.edu>
Date: Wed, 3 Sep 2025 17:54:12 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
ryan zhou <ryanzhou54@...il.com>, Roy Luo <royluo@...gle.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH] drvier: usb: dwc3: Fix runtime PM trying to activate
child device xxx.dwc3 but parent is not active
On Wed, Sep 03, 2025 at 09:30:47PM +0200, Rafael J. Wysocki wrote:
> I personally think that it would be reasonable to simply preserve
> device states in error paths unless they have been changed already
> before the error (or suspend abort due to a wakeup signal).
The problem is complicated by the interaction between runtime-PM states
and system-sleep states. In the case, we've been considering, B changes
from runtime-suspended to runtime-suspended + system-suspended.
Therefore the error path is allowed to modify B's state.
> By this rule, B would be left in runtime suspend if it were still in
> runtime suspend when the error (or suspend abort in general) occurred
> and then it doesn't matter what happens to A.
More fully, B would be changed from runtime-suspended + system-suspended
back to simply runtime-suspended. Unfortunately, none of the PM
callbacks in the kernel are defined to make this change -- at least, not
without some cooperation from the driver.
> The PM core can do something like that for the drivers opting in for
> runtime PM integration assistance, so to speak. That is, drivers that
> point their ->suspend() and ->resume() callbacks to
> pm_runtime_force_suspend() and pm_runtime_force_resume(),
> respectively, or set DPM_FLAG_SMART_SUSPEND (or both at the same time
> which is now feasible). Otherwise, it is hard to say what the
> expectations of the driver are and some code between the driver and
> the PM core may be involved (say, the PCI bus type).
Setting DPM_FLAG_SMART_SUSPEND really does sound like the best answer.
But there still should be some way the PM core can make resumes easier
for drivers that don't set the flag. Something like: If the device is
in runtime suspend with SMART_SUSPEND clear, perform a runtime resume on
the device's parent (and anything else the device depends on) before
invoking ->resume.
Alan Stern
Powered by blists - more mailing lists