[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0i0h1RZxr47AVdLsNp6xq1dbKE4xTw6AmEGOr+NPAqD0w@mail.gmail.com>
Date: Mon, 21 Jul 2025 18:04:22 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>, linux-pm@...r.kernel.org,
Kevin Hilman <khilman@...libre.com>, Pavel Machek <pavel@...nel.org>, Len Brown <len.brown@...el.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>, Saravana Kannan <saravanak@...gle.com>,
Maulik Shah <quic_mkshah@...cinc.com>, Prasad Sodagudi <psodagud@...cinc.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC/PATCH 3/3] cpuidle: Respect the system-wakeup QoS limit for s2idle
On Wed, Jul 16, 2025 at 2:33 PM Ulf Hansson <ulf.hansson@...aro.org> wrote:
>
> A system-wakeup QoS limit may have been requested by user-space. To avoid
> entering a too deep state during s2idle, let's start to take into account
> the QoS limit when selecting a suitable low-power-state.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>
> ---
> drivers/cpuidle/cpuidle.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 0835da449db8..5f6dacb5b134 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -190,14 +190,15 @@ static noinstr void enter_s2idle_proper(struct cpuidle_driver *drv,
> */
> int cpuidle_enter_s2idle(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> {
> + u64 constraint_ns = system_wakeup_latency_qos_limit() * NSEC_PER_USEC;
> int index;
>
> /*
> - * Find the deepest state with ->enter_s2idle present, which guarantees
> - * that interrupts won't be enabled when it exits and allows the tick to
> - * be frozen safely.
> + * Find the deepest state with ->enter_s2idle present that meets the
> + * system-wakeup QoS limit, which guarantees that interrupts won't be
> + * enabled when it exits and allows the tick to be frozen safely.
> */
> - index = find_deepest_state(drv, dev, U64_MAX, 0, true);
> + index = find_deepest_state(drv, dev, constraint_ns, 0, true);
> if (index > 0) {
> enter_s2idle_proper(drv, dev, index);
> local_irq_enable();
This is not the only place that needs to be patched this way.
cpuidle_idle_call() is another one AFAICS.
Powered by blists - more mailing lists