Perf: arm64: Update PMU force reset

Bring all cores online before doing a force reset for PMU.
This is required in order to handle corner case related to
freeing of IRQs for offline cores.

Change-Id: I091d9039e6554099ff4dd80d4a69cabe8eff3138
Signed-off-by: Sheetal Sahasrabudhe <sheetals@codeaurora.org>
[satyap: trivial merge conflict resolution and move changes
         in arch/arm64/kernel/perf_event.c to drivers/perf/arm_pmu.c
         to align with kernel 4.4]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
Sheetal Sahasrabudhe 2014-08-14 10:51:43 -04:00 committed by David Keitel
parent 2c167c7786
commit 30fac71896
2 changed files with 22 additions and 1 deletions

View file

@ -26,6 +26,7 @@ static char *descriptions =
" 1 Perf: arm64: Add L1 counters to tracepoints\n"
" 5 Perf: arm64: add perf user-mode permissions\n"
" 6 Perf: arm64: Add debugfs node to clear PMU\n"
" 7 Perf: arm64: Update PMU force reset\n"
;
static ssize_t desc_read(struct file *fp, char __user *buf,

View file

@ -928,12 +928,32 @@ out_free:
}
#ifdef CONFIG_PERF_EVENTS_RESET_PMU_DEBUGFS
static void reset_pmu_force(void)
static __ref void reset_pmu_force(void)
{
int cpu, ret;
u32 save_online_mask = 0;
for_each_possible_cpu(cpu) {
if (!cpu_online(cpu)) {
save_online_mask |= BIT(cpu);
ret = cpu_up(cpu);
if (ret)
pr_err("Failed to bring up CPU: %d, ret: %d\n",
cpu, ret);
}
}
if (cpu_pmu && cpu_pmu->reset)
on_each_cpu(cpu_pmu->reset, NULL, 1);
if (cpu_pmu && cpu_pmu->plat_device)
armpmu_release_hardware(cpu_pmu);
for_each_possible_cpu(cpu) {
if ((save_online_mask & BIT(cpu)) && cpu_online(cpu)) {
ret = cpu_down(cpu);
if (ret)
pr_err("Failed to bring down CPU: %d, ret: %d\n",
cpu, ret);
}
}
}
static int write_enabled_perfpmu_action(void *data, u64 val)