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: 56b991849009 ("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
..
2020-01-29 18:53:37 -08:00
2020-02-06 06:11:50 +00:00
2020-02-08 14:04:19 -08:00
2020-02-08 14:04:19 -08:00
2020-02-08 14:17:27 -08:00
2020-02-08 14:17:27 -08:00
2020-02-08 14:04:19 -08:00
2020-02-08 14:04:19 -08:00
2020-02-08 13:58:44 -08:00
2020-01-27 13:03:00 -08:00
2020-02-08 14:04:19 -08:00
2020-02-09 16:05:50 -08:00
2020-01-30 08:04:01 -08:00
2020-02-08 14:04:19 -08:00
2020-02-04 07:17:41 +00:00
2020-01-31 14:40:36 -08:00
2020-02-05 17:49:54 +00:00
2020-02-04 13:06:46 +00:00
2020-02-04 07:17:41 +00:00
2020-01-16 10:45:44 -08:00
2020-02-04 07:17:41 +00:00
2020-01-27 13:03:00 -08:00
2020-02-06 06:15:23 +00:00
2020-02-08 14:04:19 -08:00
2020-01-27 13:03:00 -08:00
2020-02-06 14:17:38 +00:00
2020-02-08 13:55:25 -08:00
2020-02-03 14:51:57 +00:00
2020-02-04 07:17:41 +00:00
2020-02-08 17:24:41 -08:00
2020-02-08 14:04:19 -08:00
2020-01-29 18:16:16 -08:00
2020-01-31 11:28:31 -08:00
2020-02-08 14:04:19 -08:00
2020-02-09 16:05:50 -08:00
2020-02-03 22:22:05 +00:00
2020-02-09 16:05:50 -08:00
2020-01-29 10:35:54 -08:00
2020-01-29 10:35:54 -08:00
2020-02-07 12:30:16 -08:00
2020-02-05 17:44:14 +00:00
2020-02-09 16:05:50 -08:00