Skip to content

PM: runtime: Fix issues related to autosuspend

Rafael J. Wysocki driver-core linux-pm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 12 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4PM: runtime: Add memory barrier before reading last_busydrivers/base/power/runtime.c+7 -03 replies
2/4PM: runtime: Avoid suspends without respecting autosuspend delaydrivers/base/power/runtime.c+47 -63 replies
3/4PM: runtime: Update last_busy in all rpm_idle() pathsdrivers/base/power/runtime.c+7 -01 reply
4/4PM: runtime: Update stale pm_runtime_put_sync() kerneldoc commentinclude/linux/pm_runtime.h+3 -32 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchBrian NorrisUlf Hansson
SeriesR-b
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] PM: runtime: Fix issues related to autosuspend

Hi All,

This is a follow-up series for

https://web.git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=26236a3e8803f7e1ace104020d7f006edb220116

which is in linux-next and it replaces

https://lore.kernel.org/linux-pm/[email protected]/

(hence v2).

First of all, there is a potential issue with respecting autosuspend delays in pm_runtime_put_autosuspend() and pm_runtime_put_sync_autosuspend() that existed before the above commit, which is addressed in the first patch, and that fix is relevant for the other patches in the series.

Second, the commit above overlooked some cases in which a running autosuspend timer may trigger between dropping a runtime PM reference to a device and updating its last_busy timestamp, which may cause the device to suspend without respecting its autosuspend delay. Those cases are addressed by the second patch.

Next, I was mistaken when I wrote this in the changelog of the above commit:

Updating the last_busy timestamp when rpm_idle() returns an error without calling rpm_suspend() is not useful because the device is then going to remain active for an unknown amount of time and its autosuspend delay needs to take effect later.

There actually is a reason for doing this which is that an autosuspend timer (left behind by an intermediate runtime resume) may be running when rpm_idle() runs and that autosuspend timer needs to be prevented from using a soon-to-be-stale last_busy timestamp value. That is addressed by the 3rd patch.

Finally, the last patch updates a kerneldoc comment that has become outdated after the commit above.

For details, please see the patch changelogs.

Thanks!