Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] cpuidle: psci: Assign domain callbacks to all CPU idle states
@ 2026-08-31 18:51 Kevin Hilman (TI)
  2026-09-01 11:33 ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman (TI) @ 2026-08-31 18:51 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Sudeep Holla, Ulf Hansson
  Cc: Scaria Kochidanadu, linux-pm, linux-arm-kernel, linux-kernel,
	linux-rt-devel

Previously, only the deepest CPU idle state had its enter and
enter_s2idle callbacks set to the domain-aware implementations. This
meant that if a QoS latency constraint excluded the deepest state during
s2idle, find_deepest_state() would find no state with enter_s2idle set
and skip the domain idle path entirely. Similarly, during normal runtime
idle, shallower CPU idle states could not trigger cluster-level domain
idle states.

Assign both enter_s2idle and enter (non-PREEMPT_RT) to all non-WFI CPU
idle states so that the domain-idle-state logic is triggered regardless
of which CPU idle state is selected. The genpd governor remains
responsible for honouring domain-level latency constraints independently.

The enter_s2idle path uses dev_pm_genpd_suspend() which is safe on
PREEMPT_RT. The enter path uses pm_runtime_put_sync_suspend() which may
sleep and is therefore still excluded on PREEMPT_RT.

Suggested-by: Scaria Kochidanadu <s-kochidanadu@ti.com>
Signed-off-by: Kevin Hilman (TI) <khilman@baylibre.com>
---
 drivers/cpuidle/cpuidle-psci.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index dcf20ea5ef5e..db9aa57c51f5 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -250,6 +250,8 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
 				     struct psci_cpuidle_data *data,
 				     unsigned int state_count, int cpu)
 {
+	int i;
+
 	/* Currently limit the hierarchical topology to be used in OSI mode. */
 	if (!psci_has_osi_support())
 		return 0;
@@ -261,14 +263,22 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
 	psci_cpuidle_use_syscore = true;
 
 	/*
-	 * Using the deepest state for the CPU to trigger a potential selection
-	 * of a shared state for the domain, assumes the domain states are all
-	 * deeper states. On PREEMPT_RT the hierarchical topology is limited to
-	 * s2ram and s2idle.
+	 * Assign the domain-aware callbacks to all CPU idle states so that the
+	 * domain-idle-state logic is triggered regardless of which CPU idle
+	 * state is selected.
+	 *
+	 * For s2idle, enter_s2idle uses dev_pm_genpd_suspend() which is safe
+	 * on PREEMPT_RT. find_deepest_state() will pick the deepest state
+	 * whose exit latency fits within the active QoS constraint.
+	 *
+	 * For the normal idle path, enter uses pm_runtime_put_sync_suspend()
+	 * which may sleep and is therefore not used on PREEMPT_RT.
 	 */
-	drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state;
-	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
-		drv->states[state_count - 1].enter = psci_enter_domain_idle_state;
+	for (i = 1; i < state_count; i++) {
+		drv->states[i].enter_s2idle = psci_enter_s2idle_domain_idle_state;
+		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+			drv->states[i].enter = psci_enter_domain_idle_state;
+	}
 
 	return 0;
 }

---
base-commit: e5e04726cdd043e309677071ab1b65a4b18f422b
change-id: 20260831-topic-lpm-psci-domain-callbacks-a8af0cd7df35

Best regards,
--  
Kevin Hilman (TI) <khilman@baylibre.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-03 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 18:51 [PATCH] cpuidle: psci: Assign domain callbacks to all CPU idle states Kevin Hilman (TI)
2026-09-01 11:33 ` Ulf Hansson
2026-09-01 18:46   ` Kevin Hilman
2026-09-03 12:03     ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox