linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle: psci: Fixup execution order when entering a domain idle state
@ 2020-05-11 13:33 Ulf Hansson
  2020-05-14 11:52 ` Rafael J. Wysocki
  2020-05-14 14:20 ` Sudeep Holla
  0 siblings, 2 replies; 10+ messages in thread
From: Ulf Hansson @ 2020-05-11 13:33 UTC (permalink / raw)
  To: Sudeep Holla, Lorenzo Pieralisi, linux-pm
  Cc: Ulf Hansson, Benjamin Gaignard, Stephen Boyd, Daniel Lezcano,
	Rafael J . Wysocki, Lina Iyer, Bjorn Andersson, linux-arm-kernel

Moving forward, platforms are going to need to execute specific "last-man"
operations before a domain idle state can be entered. In one way or the
other, these operations needs to be triggered while walking the
hierarchical topology via runtime PM and genpd, as it's at that point the
last-man becomes known.

Moreover, executing last-man operations needs to be done after the CPU PM
notifications are sent through cpu_pm_enter(), as otherwise it's likely
that some notifications would fail. Therefore, let's re-order the sequence
in psci_enter_domain_idle_state(), so cpu_pm_enter() gets called prior
pm_runtime_put_sync().

Fixes: ce85aef570df ("cpuidle: psci: Manage runtime PM in the idle path")
Reported-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/cpuidle/cpuidle-psci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index bae9140a65a5..d0fb585073c6 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -58,6 +58,10 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
 	u32 state;
 	int ret;
 
+	ret = cpu_pm_enter();
+	if (ret)
+		return -1;
+
 	/* Do runtime PM to manage a hierarchical CPU toplogy. */
 	pm_runtime_put_sync_suspend(pd_dev);
 
@@ -65,10 +69,12 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
 	if (!state)
 		state = states[idx];
 
-	ret = psci_enter_state(idx, state);
+	ret = psci_cpu_suspend_enter(state) ? -1 : idx;
 
 	pm_runtime_get_sync(pd_dev);
 
+	cpu_pm_exit();
+
 	/* Clear the domain state to start fresh when back from idle. */
 	psci_set_domain_state(0);
 	return ret;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-05-15 16:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-11 13:33 [PATCH] cpuidle: psci: Fixup execution order when entering a domain idle state Ulf Hansson
2020-05-14 11:52 ` Rafael J. Wysocki
2020-05-14 14:20 ` Sudeep Holla
2020-05-14 15:41   ` Ulf Hansson
2020-05-14 17:28     ` Sudeep Holla
2020-05-14 19:11       ` Ulf Hansson
2020-05-15 10:22         ` Sudeep Holla
2020-05-15 11:29           ` Ulf Hansson
2020-05-15 12:42             ` Sudeep Holla
2020-05-15 16:38             ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).