Skip to content

RFC PM / sleep: Avoid resuming runtime-suspended devices during system suspend

Rafael J. Wysocki linux-acpi linux-pm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 37 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3PM / sleep: Move runtime PM barrier invocation to device_prepare()drivers/base/power/main.c+13 -185 replies
1/3PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarilydrivers/base/power/main.c include/linux/pm.h include/linux/pm_runtime.h+85 -232 replies
2/3PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarilydrivers/base/power/main.c include/linux/pm.h+29 -1727 replies
2/3PM / sleep: Update device PM documentation to cover direct_completeDocumentation/power/devices.txt Documentation/power/runtime_pm.txt+47 -40 replies
3/3ACPI / PM: Avoid resuming devices in ACPI PM domain during system suspenddrivers/acpi/device_pm.c drivers/acpi/scan.c include/acpi/acpi_bus.h+42 -80 replies
3/3ACPI / PM: Avoid resuming devices in ACPI PM domain during system suspenddrivers/acpi/device_pm.c drivers/acpi/scan.c include/acpi/acpi_bus.h+48 -50 replies
3/3ACPI / PM: Avoid resuming devices in ACPI PM domain during system suspenddrivers/acpi/device_pm.c drivers/acpi/scan.c include/acpi/acpi_bus.h+42 -80 replies

Reviews trailers per patch

4 of 7 patches have a Reviewed-by or Acked-by.

PatchUlf HanssonAlan Stern
1/3A-b
1/3A-b
2/3R-b
2/3R-b
3/3
3/3
3/3

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

Read the v1 thread

Cover letter [RFC][PATCH 0/3] PM / sleep: Avoid resuming runtime-suspended devices during system suspend

Hi All,

We've discussed that at length here:

http://marc.info/?t=139950469000003&r=1&w=4

but I'm starting a new thread to refresh things a bit.

This is about adding a mechanism allowing us to avoid runtime-suspended devices during system suspend. The reason why it has to touch the PM core is because that needs to be coordinated across the device hierarchy.

The idea is to add a new device PM flag and to modify the PM core as follows.

- If ->prepare() returns a positive number for a device, that means "this device is runtime-suspended and you can leave it like that if you do the same for all of its descendants".

- If that happens, the PM core sets the new flag for the device in question *if* the device is indeed runtime-suspended *and* *if* the transition is a suspend (and not hibernation, for example). Otherwise, it clears the flag for the device. All of that happens in device_prepare().

- In __device_suspend() the PM core clears the new flag for the device's parent if it is clear for the device to ensure that the flag will only be set for a device if it is also set for all of its descendants.

- PM core skips ->suspend/late/noirq and ->resume/early/noirq for all devices having the flag set - so the flag can be called "direct_complete" as it causes the PM core to go directy for the ->complete() callback when set.

- The ->complete() callback has to check direct_complete if ->prepare() returned a positive number previously and is responsible for further handling of the device.

That is introduced by patch [2/3].

To simplify things slightly it is helpful to move the invocation of pm_runtime_barrier() from __device_suspend() to device_prepare(), but still under pm_runtime_get_noresume() beforehand (patch [1/3]).

Patch [3/3] shows how this can be used by adding support for it to the ACPI PM comain.

Thanks!

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.