mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] PM: runtime: Improve autosuspend child to parent propagation
@ 2026-10-02 23:03 Brian Norris
  2026-10-02 23:03 ` [PATCH 1/5] PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2) Brian Norris
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Brian Norris @ 2026-10-02 23:03 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-pm, linux-iio, Andy Shevchenko, Alexandre Torgue,
	Nuno Sá,
	linux-stm32, Jonathan Cameron, David Lechner, Maxime Coquelin,
	linux-kernel, Fabrice Gasnier, linux-arm-kernel, Brian Norris

See patch 3 for the primary change here.

In short: today, children can resume/suspend without extending the
autosuspend expiration of their parent. For parents where their activity
is largely driven by their children, this makes it easy to experience
"premature" suspend.

Many .runtime_idle() implementations seem to try to work around this
problem, and one in particular (stm32-adc) documented their problems
heavily in c537d3457542 ("iio: adc: stm32-adc: fix runtime autosuspend
delay when slow polling").

This is an attempt to improve the PM core, as suggested in review for that
change:
https://lore.kernel.org/all/CAPDyKFp=KTf8=zGBSzPYqhjnZpY8xwvjCeM1e-WTKT1QLSxaDA@mail.gmail.com/

This will make it easier to simplify many other drivers too, as a
significant use of .runtime_idle() is to simply extend a parent's
last_busy timestamp, as a proxy for "last activity performed by a
child".

The changes:

1) Preparatory fix, noticed while making the following changes

2) Because the last_busy mathematics get a little more complex, I have
   to change last_busy to use an atomic64_t type

3) Propagate last_busy from dependent devices (children, consumers) to
   their dependencies (parent, suppliers)

4) Add KUnit tests

5) Remove the pm_runtime_mark_last_busy() workaround from the stm32-adc
   driver

To follow on with #5: I believe almost every other .runtime_idle()
implementation in the tree can be removed after patch 3. (There are a
handful of drivers that should just use autosuspend. And perhaps 2 or 3
other drivers that do other non-trivial work with .runtime_idle(). But
most are redundant.) I may work on that next, if this works out.

- Brian


Brian Norris (5):
  PM: runtime: Only queue an idle check for RPM-linked suppliers (part
    2)
  PM: runtime: Convert last_busy to atomic64_t
  PM: runtime: Propagate last_busy from dependent to dependency
  PM: runtime: Add tests for last_busy propagation
  iio: adc: stm32-adc: Drop runtime_idle()

 drivers/base/power/runtime-test.c | 101 ++++++++++++++++++++++++++++++
 drivers/base/power/runtime.c      |  29 ++++++++-
 drivers/iio/adc/stm32-adc-core.c  |   9 +--
 include/linux/pm.h                |   3 +-
 include/linux/pm_runtime.h        |   2 +-
 5 files changed, 132 insertions(+), 12 deletions(-)

-- 
2.56.0.rc1.315.gc6ed9934b7-goog


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-10-06 12:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-02 23:03 [PATCH 0/5] PM: runtime: Improve autosuspend child to parent propagation Brian Norris
2026-10-02 23:03 ` [PATCH 1/5] PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2) Brian Norris
2026-10-02 23:03 ` [PATCH 2/5] PM: runtime: Convert last_busy to atomic64_t Brian Norris
2026-10-02 23:03 ` [PATCH 3/5] PM: runtime: Propagate last_busy from dependent to dependency Brian Norris
2026-10-03 15:21   ` Andy Shevchenko
2026-10-05 18:05     ` Brian Norris
2026-10-02 23:03 ` [PATCH 4/5] PM: runtime: Add tests for last_busy propagation Brian Norris
2026-10-02 23:03 ` [PATCH 5/5] iio: adc: stm32-adc: Drop runtime_idle() Brian Norris
2026-10-06 12:42   ` Fabrice Gasnier

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®