Re: [PATCH v1] PM: runtime: Update last_busy before calling rpm_suspend() in rpm_idle()
From: Rafael J. Wysocki (Intel)
Date: Tue Nov 17 2026 - 15:36:54 EST
On Tue, Nov 17, 2026 at 12:12 AM Brian Norris <briannorris@xxxxxxxxxxxx> wrote:
>
> On Sun, Nov 15, 2026 at 06:35:04PM +0100, Rafael J. Wysocki (Intel) wrote:
> > On Sat, Nov 14, 2026 at 1:59 AM Brian Norris <briannorris@xxxxxxxxxxxx> wrote:
> > > Is it worthwhile to note (or at least hint at) how many other things
> > > change along with this? e.g., how pm_runtime_allow() (and therefore
> > > auto > control/power), all non-autosuspend pm_runtime_put() variants,
> > > etc, also extend the autosuspend timer? I think we agreed these are
> > > acceptable effects, and likely even desireable, but I'd say these are
> > > fairly major changes.
> >
> > Fair enough, I'll add the following to the changelog when applying the patch:
> >
> > "This potentially changes observable behavior in all situations in
> > which pm_runtime_put(), pm_runtime_put_sync(), pm_runtime_idle(), or
> > pm_request() idle is used on a device with an autosuspend delay. That
>
> nit: you split "pm_request_idle()" oddly
I noticed that too and fixed it up. Not sure what happened here.
> > includes changing a device's "power/control" sysfs attribute value
> > from "on" to "auto" (if there are no other active runtime PM
> > references to the given device), accessing PCI configuration space
> > from user space etc. Namely, in all of those cases, the runtime
> > suspend of the device following the runtime PM helper call (if it
> > causes a runtime suspend to occur) will be deferred by the full
> > autosuspend delay, which arguably is more consistent and predictable
> > than deferring the runtime suspend in question by a more-or-less
> > unknown (and basically random) time depending on when the most recent
> > update of the device's last_busy timestamp has occurred.
> >
> > It will also cause the majority of the direct
> > pm_runtime_mark_last_busy() calls to become redundant, and they will
> > be taken care of later."
>
> Seems good, thanks! Who knows if anybody will actually read the
> changelogs, but at least it leaves a paper trail for future cleanups
> that will likely reference this change.
>
> > > In any case, the change looks good to me:
> > >
> > > Reviewed-by: Brian Norris <briannorris@xxxxxxxxxxxx>
> >
> > Thank you!
> >
> > > I meant to make time to test this out a bit more, but ran out; maybe
> > > next week.
> >
> > That will be much appreciated.
>
> OK, I made some time:
>
> Tested-by: Brian Norris <briannorris@xxxxxxxxxxxx>
>
> It tests out well (passing) with:
>
> (a) the KUnit tests that try to imitate the stm32-adc parent/child
> structure from commit c537d3457542 [1]
>
> (b) my original KUnit test [2]. I've appended a slightly-updated v3, in
> case you want to merge it
>
> (c) some targeted PCIe tests on Pixel phones. Specifically, I see that
> the portdrv.c 100ms autosuspend delay is now consistently applied
> after both lspci (this used to work OK, simply because rpm_resume()
> would also update last_busy) and after endpoint suspend (this
> previously did not apply the autosuspend delay, as the endpoint
> tended to stay active for a long time)
>
> [1] https://lore.kernel.org/all/auzlLwlleGLPsLcw@xxxxxxxxxx/
> This test is inherently timing sensitive and therefore flaky. It
> just serves as an example, not something to commit.
>
> [2] [PATCH v2 4/5] PM: runtime: Add tests for last_busy propagation
> https://lore.kernel.org/all/20261103141442.v2.4.I8ab8b7f662fe1921c7084a47d554535597cc2702@changeid/
Thank you!