Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpuidle: Warn instead of bailing out if target residency check fails

It turns out that the change in commit 76934e495cdc ("cpuidle: Add
sanity check for exit latency and target residency") goes too far
because there are systems in the field on which the check introduced
by that commit does not pass.

For this reason, change __cpuidle_driver_init() return type back to void
and make it print a warning when the check mentioned above does not
pass.

Fixes: 76934e495cdc ("cpuidle: Add sanity check for exit latency and target residency")
Reported-by: Val Packett <val@packett.cool>
Closes: https://lore.kernel.org/linux-pm/20251121010756.6687-1-val@packett.cool/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/2808566.mvXUDI8C0e@rafael.j.wysocki

+8 -10
+8 -10
drivers/cpuidle/driver.c
··· 8 8 * This code is licenced under the GPL. 9 9 */ 10 10 11 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 12 + 11 13 #include <linux/mutex.h> 12 14 #include <linux/module.h> 13 15 #include <linux/sched.h> ··· 154 152 * __cpuidle_driver_init - initialize the driver's internal data 155 153 * @drv: a valid pointer to a struct cpuidle_driver 156 154 */ 157 - static int __cpuidle_driver_init(struct cpuidle_driver *drv) 155 + static void __cpuidle_driver_init(struct cpuidle_driver *drv) 158 156 { 159 157 int i; 160 158 ··· 197 195 s->exit_latency = div_u64(s->exit_latency_ns, NSEC_PER_USEC); 198 196 199 197 /* 200 - * Ensure that the exit latency of a CPU idle state does not 201 - * exceed its target residency which is assumed in cpuidle in 202 - * multiple places. 198 + * Warn if the exit latency of a CPU idle state exceeds its 199 + * target residency which is assumed to never happen in cpuidle 200 + * in multiple places. 203 201 */ 204 202 if (s->exit_latency_ns > s->target_residency_ns) 205 - return -EINVAL; 203 + pr_warn("Idle state %d target residency too low\n", i); 206 204 } 207 - 208 - return 0; 209 205 } 210 206 211 207 /** ··· 233 233 if (cpuidle_disabled()) 234 234 return -ENODEV; 235 235 236 - ret = __cpuidle_driver_init(drv); 237 - if (ret) 238 - return ret; 236 + __cpuidle_driver_init(drv); 239 237 240 238 ret = __cpuidle_set_driver(drv); 241 239 if (ret)