From: Alan Stern <stern@rowland.harvard.edu>
To: Brian Norris <briannorris@chromium.org>
Cc: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>,
"Fabrice Gasnier" <fabrice.gasnier@st.com>,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
"Ulf Hansson" <ulfh@kernel.org>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
"Andy Shevchenko" <andy@kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>
Subject: Re: [PATCH v2 3/5] PM: runtime: Propagate last_busy from dependent to dependency
Date: Tue, 10 Nov 2026 22:47:59 -0500 [thread overview]
Message-ID: <2c3bda2b-ccc3-4430-8e09-81b25f6fcda7@rowland.harvard.edu> (raw)
In-Reply-To: <avOw_4ZkqtKFHu1B@google.com>
On Tue, Nov 10, 2026 at 04:04:15PM -0800, Brian Norris wrote:
> (+CC Alan, since he wrote much of the autosuspend stuff, but also
> because he might(?) have better context for some of the .runtime_idle()
> + pm_runtime_mark_last_busy() questions)
I'm coming into this discussion in the middle, so I probably don't have
a good picture of all the issues you've been talking about. From what I
gather, it sounds like this is mostly a question of how long a parent
device should delay autosuspending after all its children go into
runtime suspend. Is that right?
The idea behind autosuspend was simple enough: Try to optimize energy
usage by putting a device into runtime suspend only when it seems likely
that the device will remain suspended for more than a brief period of
time -- long enough to make the extra work of suspending and resuming
worthwhile. In principle the driver core could collect statistics for
each device about how long it remains resumed and suspended, but the
benefits of such a detailed analysis didn't seem worth the effort. And
given that drivers know more about how their devices will tend to behave
than the core does, it made sense to let drivers determine the best
autosuspend delay time for each device individually.
In theory, a driver or bus type might want to have differing delay
values for the time after all children are suspended vs. the time after
the device had some other work to do (not related to its children). How
much of an advantage would that yield? I don't know, but I felt that it
wasn't large enough to put support for it into the first implementation
of autosuspend.
So yes, in the current scheme a parent's inactivity period doesn't start
until all its children are suspended (unless the ignore_children flag is
set, but never mind that now). The parent's autosuspend delay therefore
should take into account the expected time before one of the children
may have to be resumed, as well as the expected time before the parent
itself may be asked to do something that doesn't involve any children.
(Note that if a device has more than one child, the expected time before
any of its children will be resumed can be different from the expected
time before any single particular child will be resumed.)
The simplest way to carry this out is to do pm_runtime_mark_last_busy()
whenever a child suspends. But other approaches to the same goal are
conceivable.
Of course it's not possible to determine an "ideal" autosuspend delay
time. In fact, I suspect that in most cases we aren't even close. But
I think doing it this way is still better than anything else that isn't
a lot more complex.
> I don't think we should be treating current autosuspend delays for
> parent devices as meaningful at all, per the above. So I think this is a
> chance to try to improve the architecture so it makes sense, and then
> figure out if any existing delays should be tuned/reduced.
>
> Ideally, yes, we can avoid making significant system power changes to
> the negative, but I don't think that we should prioritize that above all
> else, as long as it's *possible* to tune the autosuspend delays in a way
> that makes sense.
Of course it's possible to tune the autosuspend delays. That's what
/sys/.../power/autosuspend_delay_ms is for. Whether it's possible to do
so in a way that makes sense will depend very heavily on the type of
device in question and the way the system is used. One possible
approach might be to have a userspace daemon that tracks all runtime PM
transitions and tries to do some sort of dynamic tuning. How well would
that work? I don't know, but it would be a good research project for
somebody.
> Side note: I think .runtime_idle() should be removed. As far as I can
> tell, it's only used for working around architectural problems in
> runtime PM (like $subject), or for implementing autosuspend without
> actually using autosuspend (usually because they predated autosuspend).
I have never given much thought to runtime_idle(). When we were doing
the initial implementation of runtime PM I didn't see any use for it,
but Rafael was quite certain that it had its place and the issue wasn't
important enough to argue about. I wouldn't mind a bit if it were
eliminated, but I also don't really mind the extra overhead of the idle
callback pointers and support routines.
> At the same time, it makes it harder to reason about the runtime PM API
> surface -- because currently, .runtime_idle() is a primary reason that
> pm_runtime_put() and pm_runtime_put_autosuspend() are different.
I wouldn't put it that way. My feeling is that pm_runtime_put() could
be replaced by pm_runtime_put_autosuspend(), since they should behave
identically for devices that don't use autosuspend. (If there are any
devices that _do_ use autosuspend and also use pm_runtime_put() -- well,
I'd say that sounds like either a design error or a simple oversight.)
The reason for having two different routines is mainly historical:
pm_runtime_put_autosuspend() was added some time after pm_runtime_put()
and we didn't want to mess up the existing callers. Maybe this
judgement was a mistake.
> "Last PM reference" can be a bit subtle; particularly, the child only
> drops a reference on its parent once it *completes* autosuspend (even if
> it was last "busy" much earlier). That means autosuspend delays become
> additive along the hierarchy. Is that desirable?
That's up to the maintainers of the device and its bus subsystem. They
can arrange the default autosuspend delays any way they like, taking the
children's autosuspend delays into account if they want -- and the user
can always override the defaults. But one thing that does _not_ make
sense would be to have non-additive delays where a parent's delay is
shorter than its child's.
Your email was fairly long, and I have touched on only a few of the
issues it brought up. Is there anything significant you still want to
discuss?
Alan Stern
next prev parent reply other threads:[~2026-11-11 3:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 22:14 [PATCH v2 0/5] PM: runtime: Improve autosuspend child to parent propagation Brian Norris
2026-11-03 22:14 ` [PATCH v2 1/5] PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2) Brian Norris
2026-11-04 14:44 ` Rafael J. Wysocki (Intel)
2026-11-03 22:14 ` [PATCH v2 2/5] PM: runtime: Convert last_busy to atomic64_t Brian Norris
2026-11-04 8:21 ` Joshua Crofts
2026-11-03 22:14 ` [PATCH v2 3/5] PM: runtime: Propagate last_busy from dependent to dependency Brian Norris
2026-11-03 23:17 ` Jonathan Cameron
2026-11-04 0:32 ` Brian Norris
2026-11-04 1:40 ` Jonathan Cameron
2026-11-04 13:34 ` Rafael J. Wysocki (Intel)
2026-11-04 19:31 ` Brian Norris
2026-11-05 11:59 ` Rafael J. Wysocki (Intel)
2026-11-05 20:21 ` Brian Norris
2026-11-05 21:18 ` Rafael J. Wysocki (Intel)
2026-11-06 1:06 ` Brian Norris
2026-11-09 15:24 ` Rafael J. Wysocki (Intel)
2026-11-11 0:04 ` Brian Norris
2026-11-11 3:47 ` Alan Stern [this message]
2026-11-11 16:42 ` Brian Norris
2026-11-03 22:14 ` [PATCH v2 4/5] PM: runtime: Add tests for last_busy propagation Brian Norris
2026-11-03 23:21 ` Jonathan Cameron
2026-11-03 22:14 ` [PATCH v2 5/5] iio: adc: stm32-adc: Drop runtime_idle() Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2c3bda2b-ccc3-4430-8e09-81b25f6fcda7@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=alexandre.torgue@foss.st.com \
--cc=andy@kernel.org \
--cc=briannorris@chromium.org \
--cc=dlechner@baylibre.com \
--cc=fabrice.gasnier@st.com \
--cc=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=nuno.sa@analog.com \
--cc=rafael@kernel.org \
--cc=ulfh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®