1
0
Fork 0
remarkable-linux/drivers/cpuidle
Gautham R. Shenoy 3b185e667b cpuidle: powernv: Fix promotion from snooze if next state disabled
commit 0a4ec6aa03 upstream.

The commit 78eaa10f02 ("cpuidle: powernv/pseries: Auto-promotion of
snooze to deeper idle state") introduced a timeout for the snooze idle
state so that it could be eventually be promoted to a deeper idle
state. The snooze timeout value is static and set to the target
residency of the next idle state, which would train the cpuidle
governor to pick the next idle state eventually.

The unfortunate side-effect of this is that if the next idle state(s)
is disabled, the CPU will forever remain in snooze, despite the fact
that the system is completely idle, and other deeper idle states are
available.

This patch fixes the issue by dynamically setting the snooze timeout
to the target residency of the next enabled state on the device.

Before Patch:
  POWER8 : Only nap disabled.
  $ cpupower monitor sleep 30
  sleep took 30.01297 seconds and exited with status 0
                |Idle_Stats
  PKG |CORE|CPU | snoo | Nap  | Fast
     0|   8|   0| 96.41|  0.00|  0.00
     0|   8|   1| 96.43|  0.00|  0.00
     0|   8|   2| 96.47|  0.00|  0.00
     0|   8|   3| 96.35|  0.00|  0.00
     0|   8|   4| 96.37|  0.00|  0.00
     0|   8|   5| 96.37|  0.00|  0.00
     0|   8|   6| 96.47|  0.00|  0.00
     0|   8|   7| 96.47|  0.00|  0.00

  POWER9: Shallow states (stop0lite, stop1lite, stop2lite, stop0, stop1,
  stop2) disabled:
  $ cpupower monitor sleep 30
  sleep took 30.05033 seconds and exited with status 0
                |Idle_Stats
  PKG |CORE|CPU | snoo | stop | stop | stop | stop | stop | stop | stop | stop
     0|  16|   0| 89.79|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00
     0|  16|   1| 90.12|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00
     0|  16|   2| 90.21|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00
     0|  16|   3| 90.29|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00

After Patch:
  POWER8 : Only nap disabled.
  $ cpupower monitor sleep 30
  sleep took 30.01200 seconds and exited with status 0
                |Idle_Stats
  PKG |CORE|CPU | snoo | Nap  | Fast
     0|   8|   0| 16.58|  0.00| 77.21
     0|   8|   1| 18.42|  0.00| 75.38
     0|   8|   2|  4.70|  0.00| 94.09
     0|   8|   3| 17.06|  0.00| 81.73
     0|   8|   4|  3.06|  0.00| 95.73
     0|   8|   5|  7.00|  0.00| 96.80
     0|   8|   6|  1.00|  0.00| 98.79
     0|   8|   7|  5.62|  0.00| 94.17

  POWER9: Shallow states (stop0lite, stop1lite, stop2lite, stop0, stop1,
  stop2) disabled:

  $ cpupower monitor sleep 30
  sleep took 30.02110 seconds and exited with status 0
                |Idle_Stats
  PKG |CORE|CPU | snoo | stop | stop | stop | stop | stop | stop | stop | stop
     0|   0|   0|  0.69|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  9.39| 89.70
     0|   0|   1|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.05| 93.21
     0|   0|   2|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00| 89.93
     0|   0|   3|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|  0.00| 93.26

Fixes: 78eaa10f02 ("cpuidle: powernv/pseries: Auto-promotion of snooze to deeper idle state")
Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-03 11:24:51 +02:00
..
governors cpuidle: Eliminate the CPUIDLE_DRIVER_STATE_START symbol 2017-08-30 03:05:29 +02:00
Kconfig cpuidle: Don't enable all governors by default 2016-01-15 22:39:58 +01:00
Kconfig.arm ARM: cpuidle: Support asymmetric idle definition 2017-06-24 01:51:00 +02:00
Kconfig.mips cpuidle: cpuidle-cps: Enable use with MIPSr6 CPUs. 2016-10-04 16:13:57 +02:00
Kconfig.powerpc powerpc/powernv/cpuidle: Back-end cpuidle driver for powernv platform. 2014-01-29 17:02:24 +11:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
coupled.c smp: Avoid using two cache lines for struct call_single_data 2017-08-29 15:14:38 +02:00
cpuidle-arm.c ARM: cpuidle: Correct driver unregistration if init fails 2017-12-10 13:40:41 +01:00
cpuidle-at91.c drivers/cpuidle: Convert non-modular drivers to use builtin_platform_driver 2015-06-16 14:12:38 -04:00
cpuidle-big_little.c ARM: MCPM: remove residency argument from mcpm_cpu_suspend() 2015-05-06 11:47:10 -04:00
cpuidle-calxeda.c ARM: migrate to common PSCI client code 2015-08-03 15:38:39 +01:00
cpuidle-clps711x.c drivers/cpuidle: make cpuidle-clps711x.c explicitly non-modular 2015-12-15 00:22:21 +01:00
cpuidle-cps.c Update MIPS email addresses 2017-11-03 09:02:30 -07:00
cpuidle-exynos.c drivers/cpuidle: make cpuidle-exynos.c explicitly non-modular 2015-12-15 00:22:22 +01:00
cpuidle-kirkwood.c ARM: cpuidle: Remove duplicate header inclusion 2015-03-23 18:03:11 +01:00
cpuidle-mvebu-v7.c cpuidle: mvebu: disable the bind/unbind attributes and use builtin_platform_driver 2015-10-23 12:40:48 +02:00
cpuidle-powernv.c cpuidle: powernv: Fix promotion from snooze if next state disabled 2018-07-03 11:24:51 +02:00
cpuidle-pseries.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpuidle-ux500.c drivers/cpuidle: make cpuidle-ux500.c explicitly non-modular 2015-12-15 00:22:22 +01:00
cpuidle-zynq.c drivers/cpuidle: Convert non-modular drivers to use builtin_platform_driver 2015-06-16 14:12:38 -04:00
cpuidle.c cpuidle: fix broadcast control when broadcast can not be entered 2017-12-25 14:26:30 +01:00
cpuidle.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
driver.c cpuidle: Make drivers initialize polling state 2017-08-30 03:06:33 +02:00
dt_idle_states.c Merge branch 'pm-sleep' 2017-09-04 00:06:02 +02:00
dt_idle_states.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
governor.c cpuidle: governors: Remove remaining old module code 2016-10-21 14:49:51 +02:00
poll_state.c cpuidle: Make drivers initialize polling state 2017-08-30 03:06:33 +02:00
sysfs.c cpuidle: Validate cpu_dev in cpuidle_add_sysfs() 2017-03-21 22:26:37 +01:00