* [PATCH] ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
@ 2010-09-28 16:43 Kevin Hilman
2010-09-30 17:07 ` Kevin Hilman
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2010-09-28 16:43 UTC (permalink / raw)
To: linux-arm-kernel
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 <khilman@deeprootsystems.com>
---
arch/arm/Kconfig | 3 +++
arch/arm/include/asm/system.h | 2 ++
arch/arm/kernel/process.c | 19 +++++++++++++++++++
3 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 553b7cf..10ce6dc 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 8ba1ccf..48e360c 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -325,6 +325,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
extern 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
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 401e38b..23def52 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -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
--
1.7.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
2010-09-28 16:43 [PATCH] ARM: add cpu_idle_wait() to support CPUidle on SMP systems Kevin Hilman
@ 2010-09-30 17:07 ` Kevin Hilman
2010-09-30 18:04 ` Colin Cross
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2010-09-30 17:07 UTC (permalink / raw)
To: linux-arm-kernel
Russell,
Kevin Hilman <khilman@deeprootsystems.com> writes:
> 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 <khilman@deeprootsystems.com>
Are you OK with this for the patch system for 2.6.37?
Kevin
> ---
> arch/arm/Kconfig | 3 +++
> arch/arm/include/asm/system.h | 2 ++
> arch/arm/kernel/process.c | 19 +++++++++++++++++++
> 3 files changed, 24 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 553b7cf..10ce6dc 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -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
> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> index 8ba1ccf..48e360c 100644
> --- a/arch/arm/include/asm/system.h
> +++ b/arch/arm/include/asm/system.h
> @@ -325,6 +325,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
> extern 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
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index 401e38b..23def52 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
2010-09-30 17:07 ` Kevin Hilman
@ 2010-09-30 18:04 ` Colin Cross
2010-10-01 21:15 ` Kevin Hilman
0 siblings, 1 reply; 4+ messages in thread
From: Colin Cross @ 2010-09-30 18:04 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Sep 30, 2010 at 10:07 AM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> Russell,
>
> Kevin Hilman <khilman@deeprootsystems.com> writes:
>
>> 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 <khilman@deeprootsystems.com>
>
> Are you OK with this for the patch system for 2.6.37?
Tested-by: Colin Cross <ccross@android.com>
CPUidle works on Tegra2 with this patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: add cpu_idle_wait() to support CPUidle on SMP systems.
2010-09-30 18:04 ` Colin Cross
@ 2010-10-01 21:15 ` Kevin Hilman
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2010-10-01 21:15 UTC (permalink / raw)
To: linux-arm-kernel
Colin Cross <ccross@google.com> writes:
> On Thu, Sep 30, 2010 at 10:07 AM, Kevin Hilman
> <khilman@deeprootsystems.com> wrote:
>> Russell,
>>
>> Kevin Hilman <khilman@deeprootsystems.com> writes:
>>
>>> 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 <khilman@deeprootsystems.com>
>>
>> Are you OK with this for the patch system for 2.6.37?
>
> Tested-by: Colin Cross <ccross@android.com>
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-01 21:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28 16:43 [PATCH] ARM: add cpu_idle_wait() to support CPUidle on SMP systems Kevin Hilman
2010-09-30 17:07 ` Kevin Hilman
2010-09-30 18:04 ` Colin Cross
2010-10-01 21:15 ` Kevin Hilman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).