lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251121010756.6687-1-val@packett.cool>
Date: Thu, 20 Nov 2025 22:06:25 -0300
From: Val Packett <val@...kett.cool>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
	Daniel Lezcano <daniel.lezcano@...aro.org>,
	Christian Loehle <christian.loehle@....com>,
	Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>
Cc: Val Packett <val@...kett.cool>,
	linux-arm-kernel@...ts.infradead.org,
	linux-arm-msm@...r.kernel.org,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] cpuidle: warn and fixup on sanity check instead of rejecting the driver

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@...kett.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ