[PATCH v2 7/7] ARM: smp: Add runtime PM support for CPU hotplug
Lina Iyer
lina.iyer at linaro.org
Thu Sep 3 12:58:34 PDT 2015
Enable runtime PM for CPU devices. Do a runtime get of the CPU device
when the CPU is hotplugged in and a runtime put of the CPU device when
the CPU is hotplugged off. When all the CPUs in a domain are hotplugged
off, the domain may also be powered off and cluster_pm_enter/exit()
notifications are be sent out.
Cc: Catalin Marinas <catalin.marinas at arm.com>
Cc: Mark Rutland <mark.rutland at arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
Signed-off-by: Lina Iyer <lina.iyer at linaro.org>
---
arch/arm/kernel/smp.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 0496b48..077c55f 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -27,6 +27,7 @@
#include <linux/completion.h>
#include <linux/cpufreq.h>
#include <linux/irq_work.h>
+#include <linux/pm_runtime.h>
#include <linux/atomic.h>
#include <asm/smp.h>
@@ -137,7 +138,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
}
-
memset(&secondary_data, 0, sizeof(secondary_data));
return ret;
}
@@ -271,6 +271,16 @@ void __cpu_die(unsigned int cpu)
void __ref cpu_die(void)
{
unsigned int cpu = smp_processor_id();
+ struct device *cpu_dev;
+
+ /*
+ * We dont need the CPU device anymore.
+ * Lets do this before IRQs are disabled to allow
+ * runtime PM to suspend the domain as well.
+ */
+ cpu_dev = get_cpu_device(cpu);
+ if (cpu_dev)
+ pm_runtime_put_sync(cpu_dev);
idle_task_exit();
@@ -352,6 +362,7 @@ asmlinkage void secondary_start_kernel(void)
{
struct mm_struct *mm = &init_mm;
unsigned int cpu;
+ struct device *cpu_dev;
/*
* The identity mapping is uncached (strongly ordered), so
@@ -401,6 +412,11 @@ asmlinkage void secondary_start_kernel(void)
local_irq_enable();
local_fiq_enable();
+ /* We are running, enable runtime PM for the CPU. */
+ cpu_dev = get_cpu_device(cpu);
+ if (cpu_dev)
+ pm_runtime_get_sync(cpu_dev);
+
/*
* OK, it's off to the idle thread for us
*/
--
2.1.4
More information about the linux-arm-kernel
mailing list