2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/drivers/base/power
Rafael J. Wysocki ebd6884167 PM: sleep: Update power.completion for all devices on errors
After commit aa7a9275ab ("PM: sleep: Suspend async parents after
suspending children"), the following scenario is possible:

 1. Device A is async and it depends on device B that is sync.
 2. Async suspend is scheduled for A before the processing of B is
    started.
 3. A is waiting for B.
 4. In the meantime, an unrelated device fails to suspend and returns
    an error.
 5. The processing of B doesn't start at all and its power.completion is
    not updated.
 6. A is still waiting for B when async_synchronize_full() is called.
 7. Deadlock ensues.

To prevent this from happening, update power.completion for all devices
on errors in all suspend phases, but do not do it directly for devices
that are already being processed or are waiting for the processing to
start because in those cases it may be necessary to wait for the
processing to actually complete before updating power.completion for
the device.

Fixes: aa7a9275ab ("PM: sleep: Suspend async parents after suspending children")
Fixes: 443046d1ad ("PM: sleep: Make suspend of devices more asynchronous")
Closes: https://lore.kernel.org/linux-pm/e13740a0-88f3-4a6f-920f-15805071a7d6@linaro.org/
Reported-and-tested-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://patch.msgid.link/6191258.lOV4Wx5bFT@rjwysocki.net
2025-07-15 14:55:11 +02:00
..
clock_ops.c PM: clk: Remove unused pm_clk_remove() 2025-03-12 21:28:48 +01:00
common.c PM: domains: Support required OPPs in dev_pm_domain_attach_list() 2024-10-10 14:13:49 +02:00
generic_ops.c PM: sleep: Remove unused pm_generic_ wrappers 2025-03-12 21:02:50 +01:00
main.c PM: sleep: Update power.completion for all devices on errors 2025-07-15 14:55:11 +02:00
Makefile PM: domains: Move genpd and its governor to the pmdomain subsystem 2023-12-18 12:49:48 +01:00
power.h PM: sleep: wakeirq: fix wake irq arming 2023-07-24 09:51:51 +02:00
qos-test.c kunit: allow kunit tests to be loaded as a module 2020-01-09 16:42:29 -07:00
qos.c PM: QoS: Export dev_pm_qos_read_value 2024-10-25 10:17:37 -05:00
runtime.c PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() 2025-05-16 22:05:43 +02:00
sysfs.c PM: sysfs: Move debug runtime PM attributes to runtime_attrs[] 2025-05-09 15:59:27 +02:00
trace.c rtc: Extend timeout for waiting for UIP to clear to 1s 2023-12-17 22:33:55 +01:00
wakeirq.c PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq() 2025-01-17 20:27:46 +01:00
wakeup_stats.c PM: wakeup: Add missing wakeup source attribute relax_count 2025-05-09 15:41:34 +02:00
wakeup.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00