linux/drivers/base/power
Rafael J. Wysocki 7585946243 PM: sleep: core: Restrict power.set_active propagation
Commit 3775fc538f ("PM: sleep: core: Synchronize runtime PM status of
parents and children") exposed an issue related to simple_pm_bus_pm_ops
that uses pm_runtime_force_suspend() and pm_runtime_force_resume() as
bus type PM callbacks for the noirq phases of system-wide suspend and
resume.

The problem is that pm_runtime_force_suspend() does not distinguish
runtime-suspended devices from devices for which runtime PM has never
been enabled, so if it sees a device with runtime PM status set to
RPM_ACTIVE, it will assume that runtime PM is enabled for that device
and so it will attempt to suspend it with the help of its runtime PM
callbacks which may not be ready for that.  As it turns out, this
causes simple_pm_bus_runtime_suspend() to crash due to a NULL pointer
dereference.

Another problem related to the above commit and simple_pm_bus_pm_ops is
that setting runtime PM status of a device handled by the latter to
RPM_ACTIVE will actually prevent it from being resumed because
pm_runtime_force_resume() only resumes devices with runtime PM status
set to RPM_SUSPENDED.

To mitigate these issues, do not allow power.set_active to propagate
beyond the parent of the device with DPM_FLAG_SMART_SUSPEND set that
will need to be resumed, which should be a sufficient stop-gap for the
time being, but they will need to be properly addressed in the future
because in general during system-wide resume it is necessary to resume
all devices in a dependency chain in which at least one device is going
to be resumed.

Fixes: 3775fc538f ("PM: sleep: core: Synchronize runtime PM status of parents and children")
Closes: https://lore.kernel.org/linux-pm/1c2433d4-7e0f-4395-b841-b8eac7c25651@nvidia.com/
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/6137505.lOV4Wx5bFT@rjwysocki.net
2025-02-09 14:41:48 +01:00
..
clock_ops.c PM: clk: make pm_clk_add_notifier() take a const pointer 2024-01-04 14:35:57 +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
main.c PM: sleep: core: Restrict power.set_active propagation 2025-02-09 14:41:48 +01: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: add tracepoint for runtime_status changes 2024-02-22 20:27:39 +01:00
sysfs.c PM: sleep: sysfs: don't include 'pm_wakeup.h' directly 2024-12-05 12:15:56 +01: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.c PM: wakeup: make device_wakeup_disable() return void 2024-04-03 16:51:37 +02:00
wakeup_stats.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00