From: Sudeep Holla <sudeep.holla@arm.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Benjamin Gaignard <benjamin.gaignard@st.com>,
linux-pm@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Lina Iyer <ilina@codeaurora.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
linux-arm-kernel@lists.infradead.org,
Sudeep Holla <sudeep.holla@arm.com>,
Lukasz Luba <lukasz.luba@arm.com>
Subject: Re: [PATCH 2/2] cpuidle: psci: Enable s2idle when using OSI with the PM domain topology
Date: Thu, 1 Oct 2020 11:17:56 +0100 [thread overview]
Message-ID: <20201001101756.GB906@bogus> (raw)
In-Reply-To: <20200901082707.106860-3-ulf.hansson@linaro.org>
On Tue, Sep 01, 2020 at 10:27:07AM +0200, Ulf Hansson wrote:
> To select domain idle states for cpuidle-psci, the PM domains via genpd are
> being managed by using runtime PM. This works fine for the regular idle
> path, but it doesn't when doing s2idle.
>
> More precisely, the domain idle states becomes temporarily disabled, which
> is because the PM core disables runtime PM for devices during system
> suspend.
When you refer system suspend above, you mean both S2R and S2I ?
> Even if genpd tries to power off the PM domain in the
> suspend_noirq phase, that doesn't help to properly select a domain idle
> state, as this needs to be done on per CPU basis.
>
And what prevents doing per CPU basis ?
> Let's address the issue by enabling the syscore flag for the attached CPU
> devices. This prevents genpd from trying to power off the corresponding PM
> domains in the suspend_noirq phase. Moreover, let's assign a specific
> ->enter_s2idle() callback for the corresponding domain idle state and let
> it invoke pm_genpd_syscore_poweroff|poweron(), rather than using runtime
> PM.
>
The syscore_suspend is not executed for S2I and using syscore APIs here
is bit confusing IMO. If Rafael is fine, I have no objections.
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
> drivers/cpuidle/cpuidle-psci-domain.c | 2 ++
> drivers/cpuidle/cpuidle-psci.c | 30 +++++++++++++++++++++++----
> 2 files changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index b6e9649ab0da..65437ba5fa78 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -324,6 +324,8 @@ struct device *psci_dt_attach_cpu(int cpu)
> if (cpu_online(cpu))
> pm_runtime_get_sync(dev);
>
> + dev_pm_syscore_device(dev, true);
> +
> return dev;
> }
>
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index 74463841805f..6322d55a0a7d 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
> @@ -19,6 +19,7 @@
> #include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/psci.h>
> +#include <linux/pm_domain.h>
> #include <linux/pm_runtime.h>
> #include <linux/slab.h>
> #include <linux/string.h>
> @@ -52,8 +53,9 @@ static inline int psci_enter_state(int idx, u32 state)
> return CPU_PM_CPU_IDLE_ENTER_PARAM(psci_cpu_suspend_enter, idx, state);
> }
>
> -static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
> - struct cpuidle_driver *drv, int idx)
> +static int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
> + struct cpuidle_driver *drv, int idx,
> + bool s2idle)
> {
> struct psci_cpuidle_data *data = this_cpu_ptr(&psci_cpuidle_data);
> u32 *states = data->psci_states;
> @@ -66,7 +68,10 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
> return -1;
>
> /* Do runtime PM to manage a hierarchical CPU toplogy. */
> - pm_runtime_put_sync_suspend(pd_dev);
> + if (s2idle)
> + pm_genpd_syscore_poweroff(pd_dev);
> + else
> + pm_runtime_put_sync_suspend(pd_dev);
Since CPU genpd is special and handled so in core, can this be moved to core ?
I mean pm_runtime_put_sync_suspend handle that based genpd_is_cpu_domain.
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-10-01 10:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 8:27 [PATCH 0/2] cpuidle: psci: Enable s2idle when using PSCI OSI Ulf Hansson
2020-09-01 8:27 ` [PATCH 1/2] PM / Domains: Enable locking for syscore devices for IRQ safe genpds Ulf Hansson
2020-09-01 8:27 ` [PATCH 2/2] cpuidle: psci: Enable s2idle when using OSI with the PM domain topology Ulf Hansson
2020-10-01 10:17 ` Sudeep Holla [this message]
2020-10-01 11:24 ` Rafael J. Wysocki
2020-10-01 11:32 ` Ulf Hansson
2020-10-01 11:44 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201001101756.GB906@bogus \
--to=sudeep.holla@arm.com \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=benjamin.gaignard@st.com \
--cc=bjorn.andersson@linaro.org \
--cc=daniel.lezcano@linaro.org \
--cc=ilina@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).