linux/drivers/cpuidle
Rafael J. Wysocki 124cf9117c PM / sleep: Make it possible to quiesce timers during suspend-to-idle
The efficiency of suspend-to-idle depends on being able to keep CPUs
in the deepest available idle states for as much time as possible.
Ideally, they should only be brought out of idle by system wakeup
interrupts.

However, timer interrupts occurring periodically prevent that from
happening and it is not practical to chase all of the "misbehaving"
timers in a whack-a-mole fashion.  A much more effective approach is
to suspend the local ticks for all CPUs and the entire timekeeping
along the lines of what is done during full suspend, which also
helps to keep suspend-to-idle and full suspend reasonably similar.

The idea is to suspend the local tick on each CPU executing
cpuidle_enter_freeze() and to make the last of them suspend the
entire timekeeping.  That should prevent timer interrupts from
triggering until an IO interrupt wakes up one of the CPUs.  It
needs to be done with interrupts disabled on all of the CPUs,
though, because otherwise the suspended clocksource might be
accessed by an interrupt handler which might lead to fatal
consequences.

Unfortunately, the existing ->enter callbacks provided by cpuidle
drivers generally cannot be used for implementing that, because some
of them re-enable interrupts temporarily and some idle entry methods
cause interrupts to be re-enabled automatically on exit.  Also some
of these callbacks manipulate local clock event devices of the CPUs
which really shouldn't be done after suspending their ticks.

To overcome that difficulty, introduce a new cpuidle state callback,
->enter_freeze, that will be guaranteed (1) to keep interrupts
disabled all the time (and return with interrupts disabled) and (2)
not to touch the CPU timer devices.  Modify cpuidle_enter_freeze() to
look for the deepest available idle state with ->enter_freeze present
and to make the CPU execute that callback with suspended tick (and the
last of the online CPUs to execute it with suspended timekeeping).

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
2015-02-15 19:40:09 +01:00
..
governors cpuidle: ladder: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID 2014-12-17 02:26:28 +01:00
coupled.c arch: Mass conversion of smp_mb__*() 2014-04-18 14:20:48 +02:00
cpuidle-arm64.c arm64: kernel: remove ARM64_CPU_SUSPEND config option 2015-01-27 11:35:33 +00:00
cpuidle-at91.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle-big_little.c drivers: cpuidle: Don't initialize big.LITTLE driver if MCPM is unavailable 2015-01-23 15:05:48 +01:00
cpuidle-calxeda.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle-clps711x.c cpuidle: drop owner assignment from platform_drivers 2014-10-20 16:20:24 +02:00
cpuidle-cps.c cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic 2014-11-12 21:17:27 +01:00
cpuidle-exynos.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle-kirkwood.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle-mvebu-v7.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle-powernv.c powerpc updates for 3.19 batch 2 2014-12-19 12:57:45 -08:00
cpuidle-pseries.c cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic 2014-11-12 21:17:27 +01:00
cpuidle-ux500.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle-zynq.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
cpuidle.c PM / sleep: Make it possible to quiesce timers during suspend-to-idle 2015-02-15 19:40:09 +01:00
cpuidle.h cpuidle: support multiple drivers 2012-11-15 00:34:23 +01:00
driver.c cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic 2014-11-12 21:17:27 +01:00
dt_idle_states.c Merge back earlier cpuidle material for 3.19-rc1. 2014-11-21 16:31:42 +01:00
dt_idle_states.h drivers: cpuidle: implement DT based idle states infrastructure 2014-09-25 10:52:20 +02:00
governor.c cpuidle: Replace strnicmp with strncasecmp 2014-09-25 01:17:10 +02:00
Kconfig drivers: cpuidle: CPU idle ARM64 driver 2014-09-25 10:52:21 +02:00
Kconfig.arm ACPI and power management updates for 3.18-rc1 2014-10-09 16:07:43 -04:00
Kconfig.arm64 arm64: kernel: remove ARM64_CPU_SUSPEND config option 2015-01-27 11:35:33 +00:00
Kconfig.mips MIPS: Kconfig: Add missing MIPS_CPS dependencies to PM and cpuidle 2014-10-23 19:58:05 +02:00
Kconfig.powerpc powerpc/powernv/cpuidle: Back-end cpuidle driver for powernv platform. 2014-01-29 17:02:24 +11:00
Makefile drivers: cpuidle: CPU idle ARM64 driver 2014-09-25 10:52:21 +02:00
sysfs.c cpuidle: fix permission for driver name sysfs node 2014-07-19 21:43:28 +02:00