Commit c24d75b7 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Greg Kroah-Hartman

cpuidle / menu: Return (-1) if there are no suitable states

commit 3836785a upstream.

If there is a PM QoS latency limit and all of the sufficiently shallow
C-states are disabled, the cpuidle menu governor returns 0 which on
some systems is CPUIDLE_DRIVER_STATE_START and shouldn't be returned
if that C-state has been disabled.

Fix the issue by modifying the menu governor to return (-1) in such
situations.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
[shilpab: Backport to 3.10.y
 - adjust context
 - add a check if 'next_state' is less than 0 in 'cpuidle_idle_call()',
   this ensures that we exit 'cpuidle_idle_call()' if governor->select()
   returns  negative value]
Signed-off-by: default avatarShilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ec153c5
...@@ -135,6 +135,9 @@ int cpuidle_idle_call(void) ...@@ -135,6 +135,9 @@ int cpuidle_idle_call(void)
/* ask the governor for the next state */ /* ask the governor for the next state */
next_state = cpuidle_curr_governor->select(drv, dev); next_state = cpuidle_curr_governor->select(drv, dev);
if (next_state < 0)
return -EBUSY;
if (need_resched()) { if (need_resched()) {
dev->last_residency = 0; dev->last_residency = 0;
/* give the governor an opportunity to reflect on the outcome */ /* give the governor an opportunity to reflect on the outcome */
......
...@@ -269,7 +269,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) ...@@ -269,7 +269,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
data->needs_update = 0; data->needs_update = 0;
} }
data->last_state_idx = 0; data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1;
data->exit_us = 0; data->exit_us = 0;
/* Special case when user has set very strict latency requirement */ /* Special case when user has set very strict latency requirement */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment