ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
PATCH 1/1 ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
In order for CPUidle to work on SMP systems, an implementation of cpu_idle_wait() is needed.
This patch duplicates the x86 implementation of cpu_idle_wait() for ARM.
--- arch/arm/Kconfig | 3 +++ arch/arm/include/asm/system.h | 2 ++ arch/arm/kernel/process.c | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 0 deletions(-)
arch/arm/Kconfig +3 -0
@@ -145,6 +145,9 @@ config ARCH_HAS_CPUFREQ and that the relevant menu configurations are displayed for it. +config ARCH_HAS_CPU_IDLE_WAIT + def_bool y + config GENERIC_HWEIGHT bool default y
arch/arm/include/asm/system.h +2 -0
@@ -325,6 +325,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int sizeextern void disable_hlt (void );extern void enable_hlt (void ); +void cpu_idle_wait (void ); +#include <asm-generic/cmpxchg-local.h> #if __LINUX_ARM_ARCH__ <6
arch/arm/kernel/process.c +19 -0
@@ -135,6 +135,25 @@ EXPORT_SYMBOL(pm_power_off);void (*arm_pm_restart)(char str,const char *cmd) = arm_machine_restart;EXPORT_SYMBOL_GPL (arm_pm_restart); +static void do_nothing (void *unused) +{ +} + +/* +* cpu_idle_wait - Used to ensure that all the CPUs discard old value of +* pm_idle and update to new pm_idle value. Required while changing pm_idle +* handler on SMP systems. +* +* Caller must have changed pm_idle to the new value before the call. Old +* pm_idle value will not be used by any CPU after the return of this function. +*/ +void cpu_idle_wait (void ) +{ +smp_mb (); +/* kick all the CPUs so that they exit out of pm_idle */ +smp_call_function (do_nothing,NULL ,1 ); +} +EXPORT_SYMBOL_GPL (cpu_idle_wait);/* * This is our default idle handler. We need to disable
Signature · 1 line
1.7.2.1
PATCH 1/1 ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
Russell,
Quoted 7 lines · Kevin Hilman
In order for CPUidle to work on SMP systems, an implementation of
cpu_idle_wait()is needed.This patch duplicates the x86 implementation of
cpu_idle_wait()for ARM.Signed-off-by Kevin Hilman <[email protected]>
Are you OK with this for the patch system for 2.6.37?
Kevin
Quoted 63 lines
--- arch/arm/Kconfig | 3 +++ arch/arm/include/asm/system.h | 2 ++ arch/arm/kernel/process.c | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 0 deletions(-)arch/arm/Kconfig +3
-0@@ -145,6 +145,9 @@ config ARCH_HAS_CPUFREQ and that the relevant menu configurations are displayed for it. +config ARCH_HAS_CPU_IDLE_WAIT + def_bool y + config GENERIC_HWEIGHT bool default yarch/arm/include/asm/system.h +2
-0@@ -325,6 +325,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int sizeextern void disable_hlt (void );extern void enable_hlt (void ); +void cpu_idle_wait (void ); +#include <asm-generic/cmpxchg-local.h> #if __LINUX_ARM_ARCH__ <6 arch/arm/kernel/process.c +19
-0@@ -135,6 +135,25 @@ EXPORT_SYMBOL(pm_power_off);void (*arm_pm_restart)(char str,const char *cmd) = arm_machine_restart;EXPORT_SYMBOL_GPL (arm_pm_restart); +static void do_nothing (void *unused) +{ +} + +/* +* cpu_idle_wait - Used to ensure that all the CPUs discard old value of +* pm_idle and update to new pm_idle value. Required while changing pm_idle +* handler on SMP systems. +* +* Caller must have changed pm_idle to the new value before the call. Old +* pm_idle value will not be used by any CPU after the return of this function. +*/ +void cpu_idle_wait (void ) +{ +smp_mb (); +/* kick all the CPUs so that they exit out of pm_idle */ +smp_call_function (do_nothing,NULL ,1 ); +} +EXPORT_SYMBOL_GPL (cpu_idle_wait);/* * This is our default idle handler. We need to disable
PATCH 1/1 ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
Quoted 7 lines · Kevin Hilman
Russell,
Quoted 3 lines · Kevin Hilman
In order for CPUidle to work on SMP systems, an implementation of
cpu_idle_wait()is needed.
Quoted 6 lines
Quoted 4 lines
This patch duplicates the x86 implementation of
cpu_idle_wait()for ARM.Signed-off-by Kevin Hilman <[email protected]>Are you OK with this for the patch system for 2.6.37?
CPUidle works on Tegra2 with this patch.
PATCH 1/1 ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
Quoted 12 lines · Colin Cross
Quoted 10 lines · Kevin Hilman
Russell,
Quoted 6 lines · Kevin Hilman
In order for CPUidle to work on SMP systems, an implementation of
cpu_idle_wait()is needed.This patch duplicates the x86 implementation of
cpu_idle_wait()for ARM.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Kevin Hilman <[email protected]>Are you OK with this for the patch system for 2.6.37?
Tested-by Colin Cross <[email protected]>CPUidle works on Tegra2 with this patch.
Thanks for testing.
Patch is now queued in Russell's patch system as 6428/1
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6428/1
Kevin