]> git.baikalelectronics.ru Git - kernel.git/commit
PM: sleep: Fix runtime PM based cpuidle support
authorUlf Hansson <ulf.hansson@linaro.org>
Fri, 29 Oct 2021 12:38:55 +0000 (14:38 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 4 Nov 2021 18:45:38 +0000 (19:45 +0100)
commit14c38e69b7937da2cfd4713c25f852fdd059445e
tree96a2d9c3c90602f25889b7e856dac4ceb0252f5a
parente182c390b640ae340126c2ea751b80af491439ed
PM: sleep: Fix runtime PM based cpuidle support

In the cpuidle-psci case, runtime PM in combination with the generic PM
domain (genpd), may be used when entering/exiting a shared idlestate. More
precisely, genpd relies on runtime PM to be enabled for the attached device
(in this case it belongs to a CPU), to properly manage the reference
counting of its PM domain.

This works fine most of the time, but during system suspend in
dpm_suspend_late(), the PM core disables runtime PM for all devices. Beyond
this point, calls to pm_runtime_get_sync() to runtime resume a device may
fail and therefore it could also mess up the reference counting in genpd.

To fix this problem, let's call wake_up_all_idle_cpus() in
dpm_suspend_late(), prior to disabling runtime PM. In this way a device
that belongs to a CPU, becomes runtime resumed through cpuidle-psci and
stays like that, because the runtime PM usage count has been bumped in
device_prepare().

Diagnosed-by: Maulik Shah <mkshah@codeaurora.org>
Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/main.c