mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Rafael J . Wysocki" <rafael@kernel.org>, linux-pm@vger.kernel.org
Cc: Kevin Hilman <khilman@baylibre.com>,
	Pavel Machek <pavel@kernel.org>, Len Brown <len.brown@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Saravana Kannan <saravanak@google.com>,
	Maulik Shah <quic_mkshah@quicinc.com>,
	Prasad Sodagudi <psodagud@quicinc.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: [RFC/PATCH 3/3] cpuidle: Respect the system-wakeup QoS limit for s2idle
Date: Wed, 16 Jul 2025 14:33:19 +0200	[thread overview]
Message-ID: <20250716123323.65441-4-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20250716123323.65441-1-ulf.hansson@linaro.org>

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@linaro.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();
-- 
2.43.0


  parent reply	other threads:[~2025-07-16 12:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16 12:33 [RFC/PATCH 0/3] PM: QoS: Introduce a system-wakeup QoS limit for s2idle and genpd Ulf Hansson
2025-07-16 12:33 ` [RFC/PATCH 1/3] PM: QoS: Introduce a system-wakeup QoS limit Ulf Hansson
2025-07-21 16:39   ` Rafael J. Wysocki
2025-08-11 17:15     ` Kevin Hilman
2025-08-11 19:16       ` Rafael J. Wysocki
2025-08-12  9:26         ` Ulf Hansson
2025-09-12 13:57           ` Ulf Hansson
2025-09-17 19:24             ` Rafael J. Wysocki
2025-09-18 15:33               ` Ulf Hansson
2025-09-22 18:55                 ` Rafael J. Wysocki
2025-09-23  9:42                   ` Ulf Hansson
2025-09-23 11:38                     ` Rafael J. Wysocki
2025-09-23 12:36                       ` Ulf Hansson
2025-09-23 16:43                         ` Dhruva Gole
2025-09-25 10:24                           ` Ulf Hansson
2025-07-16 12:33 ` [RFC/PATCH 2/3] pmdomain: Respect the system-wakeup QoS limit at system-wide suspend Ulf Hansson
2025-07-16 12:33 ` Ulf Hansson [this message]
2025-07-21 16:04   ` [RFC/PATCH 3/3] cpuidle: Respect the system-wakeup QoS limit for s2idle Rafael J. Wysocki

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=20250716123323.65441-4-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=khilman@baylibre.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=psodagud@quicinc.com \
    --cc=quic_mkshah@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=saravanak@google.com \
    /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

all inboxes | Powered by JetHome®