linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle: warn and fixup on sanity check instead of rejecting the driver
@ 2025-11-21  1:06 Val Packett
  2025-11-21 13:10 ` Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Val Packett @ 2025-11-21  1:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Christian Loehle,
	Artem Bityutskiy
  Cc: Val Packett, linux-arm-kernel, linux-arm-msm, Rafael J. Wysocki,
	linux-pm, linux-kernel

On Device Tree platforms, the latency and target residency values come
directly from device trees, which are numerous and weren't all written
with cpuidle invariants in mind. For example, qcom/hamoa.dtsi currently
trips this check: exit latency 680000 > residency 600000.

Instead of harshly rejecting the entire cpuidle driver with a mysterious
error message, print a warning and set the target residency value to be
equal to the exit latency.

Fixes: 76934e495cdc ("cpuidle: Add sanity check for exit latency and target residency")
Signed-off-by: Val Packett <val@packett.cool>
---
 drivers/cpuidle/driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 1c295a93d582..06aeb59c1017 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -199,8 +199,11 @@ static int __cpuidle_driver_init(struct cpuidle_driver *drv)
 		 * exceed its target residency which is assumed in cpuidle in
 		 * multiple places.
 		 */
-		if (s->exit_latency_ns > s->target_residency_ns)
-			return -EINVAL;
+		if (s->exit_latency_ns > s->target_residency_ns) {
+			pr_warn("cpuidle: state %d: exit latency %lld > residency %lld (fixing)\n",
+				i, s->exit_latency_ns, s->target_residency_ns);
+			s->target_residency_ns = s->exit_latency_ns;
+		}
 	}
 
 	return 0;
-- 
2.51.0


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

end of thread, other threads:[~2025-11-26  5:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21  1:06 [PATCH] cpuidle: warn and fixup on sanity check instead of rejecting the driver Val Packett
2025-11-21 13:10 ` Rafael J. Wysocki
2025-11-25 16:23   ` [PATCH v1] cpuidle: Warn instead of bailing out if target residency check fails Rafael J. Wysocki
2025-11-25 16:50     ` Christian Loehle
2025-11-26  5:29     ` Val Packett
2025-11-21 13:16 ` [PATCH] cpuidle: warn and fixup on sanity check instead of rejecting the driver Artem Bityutskiy
2025-11-21 13:23   ` Rafael J. Wysocki
2025-11-21 14:50 ` Konrad Dybcio

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).