aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf/imc-pmu.c
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2018-01-21 23:21:14 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2018-01-21 23:21:14 +1100
commitebf0b6a8b1e445d2be66087732aafcda12ab9f59 (patch)
treef00716a1dbde6b54dea5469ef209baac01883ec3 /arch/powerpc/perf/imc-pmu.c
parentMerge branch 'topic/ppc-kvm' into next (diff)
parentpowerpc/pseries: include linux/types.h in asm/hvcall.h (diff)
downloadlinux-dev-ebf0b6a8b1e445d2be66087732aafcda12ab9f59.tar.xz
linux-dev-ebf0b6a8b1e445d2be66087732aafcda12ab9f59.zip
Merge branch 'fixes' into next
Merge our fixes branch from the 4.15 cycle. Unusually the fixes branch saw some significant features merged, notably the RFI flush patches, so we want the code in next to be tested against that, to avoid any surprises when the two are merged. There's also some other work on the panic handling that was reverted in fixes and we now want to do properly in next, which would conflict. And we also fix a few other minor merge conflicts.
Diffstat (limited to 'arch/powerpc/perf/imc-pmu.c')
-rw-r--r--arch/powerpc/perf/imc-pmu.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 671aa20d8dd8..d7532e7b9ab5 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -323,6 +323,19 @@ static int ppc_nest_imc_cpu_offline(unsigned int cpu)
return 0;
/*
+ * Check whether nest_imc is registered. We could end up here if the
+ * cpuhotplug callback registration fails. i.e, callback invokes the
+ * offline path for all successfully registered nodes. At this stage,
+ * nest_imc pmu will not be registered and we should return here.
+ *
+ * We return with a zero since this is not an offline failure. And
+ * cpuhp_setup_state() returns the actual failure reason to the caller,
+ * which in turn will call the cleanup routine.
+ */
+ if (!nest_pmus)
+ return 0;
+
+ /*
* Now that this cpu is one of the designated,
* find a next cpu a) which is online and b) in same chip.
*/
@@ -1179,7 +1192,6 @@ static void imc_common_mem_free(struct imc_pmu *pmu_ptr)
kfree(pmu_ptr->attr_groups[IMC_EVENT_ATTR]->attrs);
kfree(pmu_ptr->attr_groups[IMC_EVENT_ATTR]);
kfree(pmu_ptr);
- kfree(per_nest_pmu_arr);
}
/*
@@ -1195,6 +1207,7 @@ static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr)
if (nest_pmus == 1) {
cpuhp_remove_state(CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE);
kfree(nest_imc_refc);
+ kfree(per_nest_pmu_arr);
}
if (nest_pmus > 0)
@@ -1330,6 +1343,8 @@ int init_imc_pmu(struct device_node *parent, struct imc_pmu *pmu_ptr, int pmu_id
ret = nest_pmu_cpumask_init();
if (ret) {
mutex_unlock(&nest_init_lock);
+ kfree(nest_imc_refc);
+ kfree(per_nest_pmu_arr);
goto err_free;
}
}