Skip to content

Commit f9901f6

Browse files
krzkrafaeljw
authored andcommitted
cpuidle: psci: Do not suspend topology CPUs on PREEMPT_RT
The runtime Power Management of CPU topology is not compatible with PREEMPT_RT: 1. Core cpuidle path disables IRQs. 2. Core cpuidle calls cpuidle-psci. 3. cpuidle-psci in __psci_enter_domain_idle_state() calls pm_runtime_put_sync_suspend() and pm_runtime_get_sync() which use spinlocks (which are sleeping on PREEMPT_RT). Deep sleep modes are not a priority of Realtime kernels because the latencies might become unpredictable. On the other hand the PSCI CPU idle power domain is a parent of other devices and power domain controllers, thus it cannot be simply skipped (e.g. on Qualcomm SM8250). Disable the idle callbacks in cpuidle-psci and mark the domain as always on. This is a trade-off between making PREEMPT_RT working and still having a proper power domain hierarchy in the system. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Tested-by: Adrien Thierry <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 41204a6 commit f9901f6

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

drivers/cpuidle/Kconfig.arm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ config ARM_PSCI_CPUIDLE
2424
It provides an idle driver that is capable of detecting and
2525
managing idle states through the PSCI firmware interface.
2626

27+
The driver has limitations when used with PREEMPT_RT:
28+
- If the idle states are described with the non-hierarchical layout,
29+
all idle states are still available.
30+
31+
- If the idle states are described with the hierarchical layout,
32+
only the idle states defined per CPU are available, but not the ones
33+
being shared among a group of CPUs (aka cluster idle states).
34+
2735
config ARM_PSCI_CPUIDLE_DOMAIN
2836
bool "PSCI CPU idle Domain"
2937
depends on ARM_PSCI_CPUIDLE

drivers/cpuidle/cpuidle-psci-domain.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
6464

6565
pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN;
6666

67-
/* Allow power off when OSI has been successfully enabled. */
68-
if (use_osi)
67+
/*
68+
* Allow power off when OSI has been successfully enabled.
69+
* PREEMPT_RT is not yet ready to enter domain idle states.
70+
*/
71+
if (use_osi && !IS_ENABLED(CONFIG_PREEMPT_RT))
6972
pd->power_off = psci_pd_power_off;
7073
else
7174
pd->flags |= GENPD_FLAG_ALWAYS_ON;

drivers/cpuidle/cpuidle-psci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
231231
if (!psci_has_osi_support())
232232
return 0;
233233

234+
if (IS_ENABLED(CONFIG_PREEMPT_RT))
235+
return 0;
236+
234237
data->dev = psci_dt_attach_cpu(cpu);
235238
if (IS_ERR_OR_NULL(data->dev))
236239
return PTR_ERR_OR_ZERO(data->dev);

0 commit comments

Comments
 (0)