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

From: Madhavan Srinivasan
Date: Thu Mar 16 2017 - 03:38:01 EST


From: Anju T Sudhakar <anju@xxxxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxx>
Cc: Balbir Singh <bsingharora@xxxxxxxxx>
Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Anton Blanchard <anton@xxxxxxxxx>
Cc: Sukadev Bhattiprolu <sukadev@xxxxxxxxxxxxxxxxxx>
Cc: Michael Neuling <mikey@xxxxxxxxxxx>
Cc: Stewart Smith <stewart@xxxxxxxxxxxxxxxxxx>
Cc: Daniel Axtens <dja@xxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Signed-off-by: Anju T Sudhakar <anju@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Madhavan Srinivasan <maddy@xxxxxxxxxxxxxxxxxx>
---
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