[PATCH 13/13] powerpc/perf: Enable/disable core engine during cpuhotplug

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Thu Mar 16 18:35:07 AEDT 2017


From: Anju T Sudhakar <anju at linux.vnet.ibm.com>

This patch disables the core imc engine when we offline all the cpus available in
a core. Also it enables core imc when any of the cpu in that core comes back.
Enable/disable core imc is done through the opal calls OPAL_CORE_IMC_ENABLE
and OPAL_CORE_IMC_DISABLE respectively.

Cc: Gautham R. Shenoy <ego at linux.vnet.ibm.com>
Cc: Balbir Singh <bsingharora at gmail.com>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Cc: Paul Mackerras <paulus at samba.org>
Cc: Anton Blanchard <anton at samba.org>
Cc: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
Cc: Michael Neuling <mikey at neuling.org>
Cc: Stewart Smith <stewart at linux.vnet.ibm.com>
Cc: Daniel Axtens <dja at axtens.net>
Cc: Stephane Eranian <eranian at google.com>
Signed-off-by: Anju T Sudhakar <anju at linux.vnet.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
 arch/powerpc/perf/imc-pmu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 2ff39fe2a5ce..278c7a427b43 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -127,6 +127,7 @@ static int ppc_core_imc_cpu_online(unsigned int cpu)
 
 	/* Else, set the cpu in the mask, and change the context */
 	cpumask_set_cpu(cpu, &core_imc_cpumask);
+	opal_core_imc_counters_control(OPAL_CORE_IMC_ENABLE, 0, 0, 0);
 	core_imc_change_cpu_context(-1, cpu);
 	return 0;
 }
@@ -149,8 +150,10 @@ static int ppc_core_imc_cpu_offline(unsigned int cpu)
 	if (ncpu < nr_cpu_ids) {
 		target = ncpu;
 		cpumask_set_cpu(target, &core_imc_cpumask);
-	} else
+	} else {
+		opal_core_imc_counters_control(OPAL_CORE_IMC_DISABLE, 0, 0, 0);
 		target = -1;
+	}
 
 	/* migrate the context */
 	core_imc_change_cpu_context(cpu, target);
-- 
2.7.4



More information about the Linuxppc-dev mailing list