1
0
Fork 0
remarkable-linux/drivers/cpuidle
Daniel Lezcano c504b774bc cpuidle: Fix cpuidle_state_is_coupled() argument in cpuidle_enter()
[ Upstream commit e7387da520 ]

Commit 0b89e9aa28 (cpuidle: delay enabling interrupts until all
coupled CPUs leave idle) rightfully fixed a regression by letting
the coupled idle state framework to handle local interrupt enabling
when the CPU is exiting an idle state.

The current code checks if the idle state is coupled and, if so, it
will let the coupled code to enable interrupts. This way, it can
decrement the ready-count before handling the interrupt. This
mechanism prevents the other CPUs from waiting for a CPU which is
handling interrupts.

But the check is done against the state index returned by the back
end driver's ->enter functions which could be different from the
initial index passed as parameter to the cpuidle_enter_state()
function.

 entered_state = target_state->enter(dev, drv, index);

 [ ... ]

 if (!cpuidle_state_is_coupled(drv, entered_state))
	local_irq_enable();

 [ ... ]

If the 'index' is referring to a coupled idle state but the
'entered_state' is *not* coupled, then the interrupts are enabled
again. All CPUs blocked on the sync barrier may busy loop longer
if the CPU has interrupts to handle before decrementing the
ready-count. That's consuming more energy than saving.

Fixes: 0b89e9aa28 (cpuidle: delay enabling interrupts until all coupled CPUs leave idle)
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
[ rjw: Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-06-06 19:12:25 -04:00
..
governors cpuidle: menu: use DIV_ROUND_CLOSEST_ULL() 2015-04-17 09:03:55 -04:00
Kconfig ARM: cpuidle: Enable the ARM64 driver for both ARM32/ARM64 2015-03-24 10:16:11 +01:00
Kconfig.arm ARM: cpuidle: Enable the ARM64 driver for both ARM32/ARM64 2015-03-24 10:16:11 +01: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 ARM: cpuidle: Enable the ARM64 driver for both ARM32/ARM64 2015-03-24 10:16:11 +01:00
coupled.c cpuidle/coupled: Remove redundant 'dev' argument of cpuidle_state_is_coupled() 2016-06-06 19:12:25 -04:00
cpuidle-arm.c ARM: cpuidle: Pass on arm_cpuidle_suspend()'s return value 2016-05-17 13:42:47 -04:00
cpuidle-at91.c ARM: cpuidle: Remove duplicate header inclusion 2015-03-23 18:03:11 +01: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 ARM: SoC fixes for v4.1 2015-04-22 09:03:30 -07:00
cpuidle-kirkwood.c ARM: cpuidle: Remove duplicate header inclusion 2015-03-23 18:03:11 +01:00
cpuidle-mvebu-v7.c cpuidle: mvebu: Update cpuidle thresholds for Armada XP SOCs 2015-03-13 18:31:29 +01:00
cpuidle-powernv.c tick/idle/powerpc: Do not register idle states with CPUIDLE_FLAG_TIMER_STOP set in periodic mode 2015-07-10 09:49:35 -07:00
cpuidle-pseries.c cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic 2014-11-12 21:17:27 +01:00
cpuidle-ux500.c ARM: cpuidle: Remove duplicate header inclusion 2015-03-23 18:03:11 +01:00
cpuidle-zynq.c ARM: cpuidle: Remove duplicate header inclusion 2015-03-23 18:03:11 +01:00
cpuidle.c cpuidle: Fix cpuidle_state_is_coupled() argument in cpuidle_enter() 2016-06-06 19:12:25 -04:00
cpuidle.h cpuidle/coupled: Remove redundant 'dev' argument of cpuidle_state_is_coupled() 2016-06-06 19:12:25 -04:00
driver.c cpuidle: Use explicit broadcast control function 2015-04-03 08:44:32 +02: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
sysfs.c cpuidle: remove state_count field from struct cpuidle_device 2015-04-03 13:15:50 +02:00