OpenCloudOS-Kernel/drivers/cpuidle
Daniel Lezcano ac34d7c8c8 cpuidle: fix lock contention in the idle path
Commit bf4d1b5 (cpuidle: support multiple drivers) introduced
locking in cpuidle_get_cpu_driver(), which is used in the
idle_call() function.

This leads to a contention problem with a large number of CPUs,
because they all try to run the idle routine at the same time.

The lock can be safely removed because of how is used the cpuidle
API.  Namely, cpuidle_register_driver() is called first, but the
cpuidle idle function is not entered before cpuidle_register_device()
is called, because the cpuidle device is not enabled then. Moreover,
cpuidle_unregister_driver(), which would reset the driver value to
NULL, is not called before cpuidle_unregister_device().

All of the cpuidle drivers use the API in the same way.

In general, a cleanup around the lock is necessary and a proper
refcounting mechanism should be used to ensure the consistency in the
API (for example, cpuidle_unregister_driver() should fail if the
driver's refcount is not 0). However, these modifications will require
some code reorganization and rewrite which will be too intrusive for
a fix.

For this reason, fix the contention problem introduced by commit
bf4d1b5 by simply removing the locking from cpuidle_get_cpu_driver(),
which restores the original behavior of that routine.

[rjw: Changelog.]
Reported-and-tested-by: Russ Anderson <rja@sgi.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-01-03 13:11:06 +01:00
..
governors cpuidle: Fix finding state with min power_usage 2013-01-03 13:11:05 +01:00
Kconfig ARM: arm-soc: SoC updates for 3.8 2012-12-12 12:05:15 -08:00
Makefile cpuidle: add Calxeda SOC idle support 2012-11-07 17:15:36 -06:00
coupled.c cpuidle / coupled: fix ready counter decrement 2013-01-03 13:11:05 +01:00
cpuidle-calxeda.c cpuidle: add Calxeda SOC idle support 2012-11-07 17:15:36 -06:00
cpuidle.c cpuidle: Fix finding state with min power_usage 2013-01-03 13:11:05 +01:00
cpuidle.h cpuidle: support multiple drivers 2012-11-15 00:34:23 +01:00
driver.c cpuidle: fix lock contention in the idle path 2013-01-03 13:11:06 +01:00
governor.c cpuidle: create bootparam "cpuidle.off=1" 2011-08-03 19:06:36 -04:00
sysfs.c cpuidle: support multiple drivers 2012-11-15 00:34:23 +01:00