Skip to content

PM / ACPI: sleep: Simplify the suspend-to-idle control flow

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

Get series with b4
b4 am 71085220.z6FKkvYQPX@kreacher

Versions newest first

  1. v1 Latest8 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8PCI: irq: Introduce rearm_wake_irq()include/linux/interrupt.h kernel/irq/pm.c+21 -00 replies
2/8ACPICA: Return u32 from acpi_dispatch_gpe()drivers/acpi/acpica/evxfgpe.c include/acpi/acpixf.h+10 -40 replies
3/8ACPI: EC: Return bool from acpi_ec_dispatch_gpe()drivers/acpi/ec.c drivers/acpi/internal.h+9 -42 replies
4/8PM: sleep: Fix possible overflow in pm_system_cancel_wakeup()drivers/base/power/wakeup.c+1 -10 replies
5/8ACPI: PM: Set s2idle_wakeup earlier and clear it laterdrivers/acpi/sleep.c+4 -20 replies
6/8PM: sleep: Simplify suspend-to-idle control flowdrivers/acpi/sleep.c drivers/base/power/main.c include/linux/suspend.h +1 more+48 -580 replies
7/8PM: sleep: Integrate suspend-to-idle with generig suspend flowkernel/power/suspend.c+5 -160 replies
8/8PM: sleep: Drop dpm_noirq_begin() and dpm_noirq_end()drivers/base/power/main.c include/linux/pm.h+12 -220 replies

Reviews trailers per patch

None of the 8 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchThomas Gleixner
SeriesA-b
1/8
2/8
3/8
4/8
5/8
6/8
7/8
8/8

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

Read the v1 thread

Cover letter [PATCH 0/8] PM / ACPI: sleep: Simplify the suspend-to-idle control flow

Hi All,

The rationale for these changes is explained in the changelog of patch [6/8] as follows:

"After commit 33e4f80ee69b ("ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle") the "noirq" phases of device suspend and resume may run for multiple times during suspend-to-idle, if there are spurious system wakeup events while suspended. However, this is complicated and fragile and actually unnecessary.

The main reason for doing this is that on some systems the EC may signal system wakeup events (power button events, for example) as well as events that should not cause the system to resume (spurious system wakeup events). Thus, in order to determine whether or not a given event signaled by the EC while suspended is a proper system wakeup one, the EC GPE needs to be dispatched and to start with that was achieved by allowing the ACPI SCI action handler to run, which was only possible after calling resume_device_irqs().

However, dispatching the EC GPE this way turned out to take too much time in some cases and some EC events might be missed due to that, so commit 68e22011856f ("ACPI: EC: Dispatch the EC GPE directly on s2idle wake") started to dispatch the EC GPE right after a wakeup event has been detected, so in fact the full ACPI SCI action handler doesn't need to run any more to deal with the wakeups coming from the EC.

Use this observation to simplify the suspend-to-idle control flow so that the "noirq" phases of device suspend and resume are each run only once in every suspend-to-idle cycle, which is reported to significantly reduce power drawn by some systems when suspended to idle (by allowing them to reach a deep platform-wide low-power state through the suspend-to-idle flow)."

A bonus is that after the essential changes the s2idle flow can be integrated back into the generic suspend/resume one (patch [7/8]) and some simplifications can be made in drivers/base/power/main.c after that (patch [8/8]).

Patches [1-5/8] are pre-requisite and the changes made by the first three of them really take effect after applying patch [6/8]. Patch [4/8], in turn, is a fix and patch [5/8] is an extra simplification.

Please refer to the changelogs for details.

For easier testing, this series is available from the git branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git pm-s2idle-rework

Thanks,
Rafael