linux/drivers/base/power
Rafael J. Wysocki a941384fba PM: s2idle: ACPI: Fix wakeup interrupts handling
commit cb1f65c1e1 upstream.

After commit e3728b50cd ("ACPI: PM: s2idle: Avoid possible race
related to the EC GPE") wakeup interrupts occurring immediately after
the one discarded by acpi_s2idle_wake() may be missed.  Moreover, if
the SCI triggers again immediately after the rearming in
acpi_s2idle_wake(), that wakeup may be missed too.

The problem is that pm_system_irq_wakeup() only calls pm_system_wakeup()
when pm_wakeup_irq is 0, but that's not the case any more after the
interrupt causing acpi_s2idle_wake() to run until pm_wakeup_irq is
cleared by the pm_wakeup_clear() call in s2idle_loop().  However,
there may be wakeup interrupts occurring in that time frame and if
that happens, they will be missed.

To address that issue first move the clearing of pm_wakeup_irq to
the point at which it is known that the interrupt causing
acpi_s2idle_wake() to tun will be discarded, before rearming the SCI
for wakeup.  Moreover, because that only reduces the size of the
time window in which the issue may manifest itself, allow
pm_system_irq_wakeup() to register two second wakeup interrupts in
a row and, when discarding the first one, replace it with the second
one.  [Of course, this assumes that only one wakeup interrupt can be
discarded in one go, but currently that is the case and I am not
aware of any plans to change that.]

Fixes: e3728b50cd ("ACPI: PM: s2idle: Avoid possible race related to the EC GPE")
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-16 12:54:22 +01:00
..
clock_ops.c
common.c
domain_governor.c PM: domains: Fix up terminology with parent/child 2020-07-09 14:24:00 +02:00
domain.c PM: domains: Fix build error for genpd notifiers 2020-10-20 19:40:54 +02:00
generic_ops.c
main.c PM: sleep: Do not let "syscore" devices runtime-suspend during system transitions 2021-11-18 14:03:46 +01:00
Makefile
power.h drivers/base/power: add dpm_sysfs_change_owner() 2020-02-26 20:07:25 -08:00
qos-test.c
qos.c
runtime.c PM: runtime: Add safety net to supplier device release 2022-01-27 10:54:17 +01:00
sysfs.c drivers core: Miscellaneous changes for sysfs_emit 2020-10-02 13:12:07 +02:00
trace.c PM: base: power: don't try to use non-existing RTC for storing data 2021-09-22 12:27:54 +02:00
wakeirq.c
wakeup_stats.c drivers core: Miscellaneous changes for sysfs_emit 2020-10-02 13:12:07 +02:00
wakeup.c PM: s2idle: ACPI: Fix wakeup interrupts handling 2022-02-16 12:54:22 +01:00