linux-stable/kernel/power
Rafael J. Wysocki e3728b50cd ACPI: PM: s2idle: Avoid possible race related to the EC GPE
It is theoretically possible for the ACPI EC GPE to be set after the
s2idle_ops->wake() called from s2idle_loop() has returned and before
the subsequent pm_wakeup_pending() check is carried out.  If that
happens, the resulting wakeup event will cause the system to resume
even though it may be a spurious one.

To avoid that race, first make the ->wake() callback in struct
platform_s2idle_ops return a bool value indicating whether or not
to let the system resume and rearrange s2idle_loop() to use that
value instad of the direct pm_wakeup_pending() call if ->wake() is
present.

Next, rework acpi_s2idle_wake() to process EC events and check
pm_wakeup_pending() before re-arming the SCI for system wakeup
to prevent it from triggering prematurely and add comments to
that function to explain the rationale for the new code flow.

Fixes: 56b9918490 ("PM: sleep: Simplify suspend-to-idle control flow")
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-02-11 10:11:02 +01:00
..
Kconfig PM: suspend: Add sysfs attribute to control the "sync on suspend" behavior 2020-01-16 21:47:03 +01:00
Makefile PM: Introduce an Energy Model management framework 2018-12-11 15:16:58 +01:00
autosleep.c PM / wakeup: Show wakeup sources stats in sysfs 2019-08-21 00:20:40 +02:00
console.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
energy_model.c sched/topology: Remove unused 'sd' parameter from arch_scale_cpu_capacity() 2019-06-24 19:23:39 +02:00
hibernate.c PM: hibernate: Add more logging on hibernation failure 2020-01-07 13:31:12 +01:00
main.c PM: suspend: Add sysfs attribute to control the "sync on suspend" behavior 2020-01-16 21:47:03 +01:00
power.h y2038: syscalls: change remaining timeval to __kernel_old_timeval 2019-11-15 14:38:29 +01:00
poweroff.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 248 2019-06-19 17:09:08 +02:00
process.c PM / sleep: Show freezing tasks that caused a suspend abort 2018-09-10 12:09:10 +02:00
qos.c PM / QoS: Restore DEV_PM_QOS_MIN/MAX_FREQUENCY 2019-11-29 12:04:50 +01:00
snapshot.c Merge back new material related to system-wide PM for v5.6. 2020-01-23 16:00:56 +01:00
suspend.c ACPI: PM: s2idle: Avoid possible race related to the EC GPE 2020-02-11 10:11:02 +01:00
suspend_test.c PM: sleep: Switch to rtc_time64_to_tm()/rtc_tm_to_time64() 2019-12-20 09:58:08 +01:00
swap.c kernel: power: swap: use kzalloc() instead of kmalloc() followed by memset() 2019-06-28 10:20:39 +02:00
user.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
wakelock.c PM / wakeup: Show wakeup sources stats in sysfs 2019-08-21 00:20:40 +02:00