This patch extracts the common code of the cpu hotplug feature across
arm platforms. The goal is to only keep the specific stuff of the
platform in the sub-architecture. I have created a hotplug.c file in
the arm/common directory after studying the cpu hotplug code of
omap2, realview, s5pv310, ux500 and tegra. I have extracted 3 main
platform dependent functions:
-platform_enter_lowpower which prepares the platform for low power.
-platform_do_lowpower on which the cpu will loop until it becomes
really plugged (spurious wake up). This function must returned the cpu
Id in order to leave the unplug state.
-platform_leave_lowpower which restore the platform context.
An ux500 patch is available which uses the common/hotplug.c code.
This patch is quite short because the idle / power down functions are
not yet upstreamed
Signed-off-by: Vincent Guittot <vincent.guittot(a)stericsson.com>
---
arch/arm/Kconfig | 1 +
arch/arm/mach-ux500/Makefile | 2 +-
arch/arm/mach-ux500/hotplug.c | 68 +++++++++-------------------------------
arch/arm/mach-ux500/platsmp.c | 2 +
4 files changed, 20 insertions(+), 53 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ca96a44..ee74cf9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -797,6 +797,7 @@ config ARCH_U8500
select GENERIC_CLOCKEVENTS
select COMMON_CLKDEV
select ARCH_REQUIRE_GPIOLIB
+ select USE_COMMON_ARM_HOTPLUG if HOTPLUG_CPU
help
Support for ST-Ericsson's Ux500 architecture
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 0612013..cb86197 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -8,7 +8,7 @@ obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o
devices-db8500.o prcmu.o
obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o
obj-$(CONFIG_MACH_U5500) += board-u5500.o
obj-$(CONFIG_SMP) += platsmp.o headsmp.o
-obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
+obj-$(CONFIG_USE_COMMON_ARM_HOTPLUG) += hotplug.o
obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
obj-$(CONFIG_REGULATOR_AB8500) += board-mop500-regulators.o
obj-$(CONFIG_U5500_MODEM_IRQ) += modem_irq.o
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
index b782a03..14a614f 100644
--- a/arch/arm/mach-ux500/hotplug.c
+++ b/arch/arm/mach-ux500/hotplug.c
@@ -6,70 +6,34 @@
* Based on ARM realview platform
*
* Author: Sundar Iyer <sundar.iyer(a)stericsson.com>
+ * Author: Vincent Guittot <vincent.guittot(a)stericsson.com>
*
+ * We only keep platform related code in the subarchitecture directory.
+ * The common code across platform has been moved into kernel/common directory
*/
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/smp.h>
-#include <linux/completion.h>
-#include <asm/cacheflush.h>
+#include <asm/hotplug.h>
extern volatile int pen_release;
-static DECLARE_COMPLETION(cpu_killed);
-
-static inline void platform_do_lowpower(unsigned int cpu)
-{
- flush_cache_all();
-
- /* we put the platform to just WFI */
- for (;;) {
- __asm__ __volatile__("dsb\n\t" "wfi\n\t"
- : : : "memory");
- if (pen_release == cpu) {
- /*
- * OK, proper wakeup, we're done
- */
- break;
- }
- }
-}
-
-int platform_cpu_kill(unsigned int cpu)
+/* Default implementation that will be used if not override
+ * by power specific implementation
+ */
+void __attribute__((weak)) platform_enter_lowpower(unsigned int cpu)
{
- return wait_for_completion_timeout(&cpu_killed, 5000);
+ return;
}
-/*
- * platform-specific code to shutdown a CPU
- *
- * Called with IRQs disabled
- */
-void platform_cpu_die(unsigned int cpu)
+int __attribute__((weak)) platform_do_lowpower(unsigned int cpu)
{
-#ifdef DEBUG
- unsigned int this_cpu = hard_smp_processor_id();
-
- if (cpu != this_cpu) {
- printk(KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n",
- this_cpu, cpu);
- BUG();
- }
-#endif
-
- printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
- complete(&cpu_killed);
+ __asm__ __volatile__("dsb\n\t" "wfi\n\t"
+ : : : "memory");
- /* directly enter low power state, skipping secure registers */
- platform_do_lowpower(cpu);
+ return pen_release;
}
-int platform_cpu_disable(unsigned int cpu)
+void __attribute__((weak)) platform_leave_lowpower(unsigned int cpu)
{
- /*
- * we don't allow CPU 0 to be shutdown (it is still too special
- * e.g. clock tick interrupts)
- */
- return cpu == 0 ? -EPERM : 0;
+ return;
}
+
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index 9e4c678..3074260 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -51,6 +51,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
* pen, then head off into the C entry point
*/
pen_release = -1;
+ smp_wmb();
/*
* Synchronise with the boot thread.
@@ -82,6 +83,7 @@ int __cpuinit boot_secondary(unsigned int cpu,
struct task_struct *idle)
timeout = jiffies + (1 * HZ);
while (time_before(jiffies, timeout)) {
+ smp_rmb();
if (pen_release == -1)
break;
}
--
1.7.0.4
Greetings,
Enclosed you'll find a link to the agenda, notes and actions from the
Linaro User Platforms Weekly Status meeting dated November 24th held in
#linaro-meeting on irc.freenode.net at 13:00 UTC.
https://wiki.linaro.org/Platform/UserPlatforms/WeeklyStatus/2010-11-24
Status Summary:
* Good progress on discussions with upstream Cairo team
* Confirmed with upstream Unity team that there is no plan to add
gles2 support to compiz/nux
* Focus continues in refining Blueprints and Specifications across
Multimedia and Graphics WGs
* Seeds for linaro-development, linaro-multimedia-engineering and
linaro-graphical-engineering either merged or in a proposed state in
prep for natty-alpha-1
Regards,
Tom (tgall_foo)
User Platforms Team
"We want great men who, when fortune frowns will not be discouraged."
- Colonel Henry Knox
w) tom.gall att linaro.org
w) tom_gall att vnet.ibm.com
h) tom_gall att mac.com
Hi,
I was trying to investigate performance issues that we were seeing
with some usecases like Video playback on OMAP Platforms with ondemand
governor.
As part of this, I found a tool called cpufreq-bench
(http://lwn.net/Articles/339862) which can be used determine the
performance impact of ondemand governor compared to performacne
governor.
When I ran this tool on OMAP3 (ZOOM3) platform using 2.6.36 kernel
with below command, the worstcase ondemand performance is 35% compared
to performance governor.
cpufreq-bench -l 50000 -s 100000 -x 50000 -y 100000 -g ondemand -r 5 -n 5 -v
I tried the same on x86 platforms and there the worstcase performance
is around 88%.
Attached are the cpufreq-bench logs for x86 and omap3.
Questions:
1. Is this is known limitaiton of ondemand governor?
2. How do we support system usecases (like video playback etc) with
ondemand governor if governor is not able to scale the frequencies in
realtime? Are applications expected to play with scaling_min_freq to
increase mpu frequency?
Regards
Vishwa
All,
I am trying to investigate ondemand governor's limitation in Linux kernel. As part of that, I have found a tool called cpufreq-bench which can be used to determine the performance degradation due to ondemand governor compared to performance governor.
I have used this tool on OMAP platforms and able to see the issue. Now I would like to demonstrate this issue on x86 platform to conclude that it's a generic governor problem and nothing specific to ARM based SOCs.
I would need some of your help to run this test bench on some of recent X86 platforms that have support for many P states. (My PC is little old which has only 2 p-states (2.8GHz & 3.4 GHz), so performance degradation is not much visible).
More details on the tool and test procedure can be found at
https://blueprints.edge.launchpad.net/linaro-pm-wg/+spec/cpufreq-ondemand-g…
Pls ping me if you need any assistance in testing.
Looking forward for your test results.
Regards
Vishwanath
This patch extracts the common code of the cpu hotplug feature across
arm platforms. The goal is to only keep the specific stuff of the
platform in the sub-architecture. I have created a hotplug.c file in
the arm/common directory after studying the cpu hotplug code of
omap2, realview, s5pv310, ux500 and tegra. I have extracted 3 main
platform dependent functions:
-platform_enter_lowpower which prepares the platform for low power.
-platform_do_lowpower on which the cpu will loop until it becomes
really plugged (spurious wake up). This function must returned the cpu
Id in order to leave the unplug state.
-platform_leave_lowpower which restore the platform context.
An ux500 patch is available which uses the common/hotplug.c code.
This patch is quite short because the idle / power down functions are
not yet upstreamed
Signed-off-by: Vincent Guittot <vincent.guittot(a)linaro.org>
---
arch/arm/common/Kconfig | 4 ++
arch/arm/common/Makefile | 1 +
arch/arm/common/hotplug.c | 85 ++++++++++++++++++++++++++++++++++++++++
arch/arm/include/asm/hotplug.h | 8 ++++
4 files changed, 98 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/common/hotplug.c
create mode 100644 arch/arm/include/asm/hotplug.h
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 0a34c81..b1c5f6b 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -41,3 +41,7 @@ config SHARP_SCOOP
config COMMON_CLKDEV
bool
select HAVE_CLK
+
+config USE_COMMON_ARM_HOTPLUG
+ bool
+ depends on HOTPLUG_CPU
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index e6e8664..d8a66d7 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_ARCH_IXP2000) += uengine.o
obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o
+obj-$(CONFIG_USE_COMMON_ARM_HOTPLUG) += hotplug.o
diff --git a/arch/arm/common/hotplug.c b/arch/arm/common/hotplug.c
new file mode 100644
index 0000000..05f39f9
--- /dev/null
+++ b/arch/arm/common/hotplug.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) STMicroelectronics 2009
+ * Copyright (C) ST-Ericsson SA 2010
+ *
+ * License Terms: GNU General Public License v2
+ * Based on ARM realview platform
+ *
+ * Author: Sundar Iyer <sundar.iyer(a)stericsson.com>
+ * Author: Vincent Guittot <vincent.guittot(a)stericsson.com>
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/smp.h>
+#include <linux/completion.h>
+
+#include <asm/cacheflush.h>
+#include <asm/hotplug.h>
+
+static DECLARE_COMPLETION(cpu_killed);
+
+int platform_cpu_kill(unsigned int cpu)
+{
+ int err;
+ err = wait_for_completion_timeout(&cpu_killed, 5000);
+#ifdef DEBUG
+ printk(KERN_INFO "platform_cpu_kill %d err %d\n", cpu, err);
+#endif
+ return err;
+}
+
+/*
+ * architecture-specific code to shutdown a CPU
+ *
+ * Called with IRQs disabled
+ */
+void platform_cpu_die(unsigned int cpu)
+{
+ unsigned long spurious = 0;
+#ifdef DEBUG
+ unsigned int this_cpu = hard_smp_processor_id();
+
+ if (cpu != this_cpu) {
+ printk(KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n",
+ this_cpu, cpu);
+ BUG();
+ }
+
+ printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
+#endif
+ complete(&cpu_killed);
+
+ flush_cache_all();
+ wmb();
+
+ platform_enter_lowpower(cpu);
+
+ for (;;) {
+
+ if (platform_do_lowpower(cpu) == cpu) {
+ /*
+ * OK, proper wakeup, we're done
+ */
+ break;
+ }
+ spurious++;
+ }
+
+ platform_leave_lowpower(cpu);
+
+#ifdef DEBUG
+ printk(KERN_NOTICE "CPU%u: wake up (%lu spurious wake up)\n",
+ cpu, spurious);
+#endif
+
+}
+
+int platform_cpu_disable(unsigned int cpu)
+{
+ /*
+ * we don't allow CPU 0 to be shutdown (it is still too special
+ * e.g. clock tick interrupts)
+ */
+ return cpu == 0 ? -EPERM : 0;
+}
diff --git a/arch/arm/include/asm/hotplug.h b/arch/arm/include/asm/hotplug.h
new file mode 100644
index 0000000..b38e737
--- /dev/null
+++ b/arch/arm/include/asm/hotplug.h
@@ -0,0 +1,8 @@
+#ifndef __ASM_MACH_HOTPLUG_H
+#define __ASM_MACH_HOTPLUG_H
+
+extern void platform_enter_lowpower(unsigned int cpu);
+extern int platform_do_lowpower(unsigned int cpu);
+extern void platform_leave_lowpower(unsigned int cpu);
+
+#endif
--
1.7.0.4
Loïc,
And here is the meta package pull request.
Thanks,
John
The following changes since commit 9af23910a5f4134e4ffc4485d3780bbbe53019c8:
LINARO: Linaro-2.6.36.1000.1 (2010-11-19 09:45:12 -0700)
are available in the git repository at:
git://git.linaro.org/ubuntu/linux-meta-linaro-natty.git master
John Rigby (1):
LINARO: Linaro-2.6.37.1000.1
meta-source/debian/changelog | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)