cpuidle / menu: Return (-1) if there are no suitable states
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 30 Apr 2014 22:14:04 +0000 (00:14 +0200)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:09:07 +0000 (13:09 +0000)
commit9b0e6e22762be47e0177b85cea7d4b0b461731f1
treed6c5c669cd3d5d1bc66c2e486e7cb0cb20b92afe
parent1ff339930432d189e35852bc35b557c0627a1270
cpuidle / menu: Return (-1) if there are no suitable states

commit 3836785a1bdcd6706c68ad46bf53adc0b057b310 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: Rafael 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: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpuidle/cpuidle.c
drivers/cpuidle/governors/menu.c