Skip to content

Commit 4bf944f

Browse files
committed
cpuidle: Warn instead of bailing out if target residency check fails
It turns out that the change in commit 76934e4 ("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: 76934e4 ("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
1 parent 6d96cef commit 4bf944f

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

drivers/cpuidle/driver.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* This code is licenced under the GPL.
99
*/
1010

11+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
12+
1113
#include <linux/mutex.h>
1214
#include <linux/module.h>
1315
#include <linux/sched.h>
@@ -152,7 +154,7 @@ static void cpuidle_setup_broadcast_timer(void *arg)
152154
* __cpuidle_driver_init - initialize the driver's internal data
153155
* @drv: a valid pointer to a struct cpuidle_driver
154156
*/
155-
static int __cpuidle_driver_init(struct cpuidle_driver *drv)
157+
static void __cpuidle_driver_init(struct cpuidle_driver *drv)
156158
{
157159
int i;
158160

@@ -195,15 +197,13 @@ static int __cpuidle_driver_init(struct cpuidle_driver *drv)
195197
s->exit_latency = div_u64(s->exit_latency_ns, NSEC_PER_USEC);
196198

197199
/*
198-
* Ensure that the exit latency of a CPU idle state does not
199-
* exceed its target residency which is assumed in cpuidle in
200-
* multiple places.
200+
* Warn if the exit latency of a CPU idle state exceeds its
201+
* target residency which is assumed to never happen in cpuidle
202+
* in multiple places.
201203
*/
202204
if (s->exit_latency_ns > s->target_residency_ns)
203-
return -EINVAL;
205+
pr_warn("Idle state %d target residency too low\n", i);
204206
}
205-
206-
return 0;
207207
}
208208

209209
/**
@@ -233,9 +233,7 @@ static int __cpuidle_register_driver(struct cpuidle_driver *drv)
233233
if (cpuidle_disabled())
234234
return -ENODEV;
235235

236-
ret = __cpuidle_driver_init(drv);
237-
if (ret)
238-
return ret;
236+
__cpuidle_driver_init(drv);
239237

240238
ret = __cpuidle_set_driver(drv);
241239
if (ret)

0 commit comments

Comments
 (0)