]> git.baikalelectronics.ru Git - kernel.git/commit
drivers/perf: arm_pmu: split irq request from enable
authorMark Rutland <mark.rutland@arm.com>
Fri, 10 Mar 2017 10:46:15 +0000 (10:46 +0000)
committerWill Deacon <will.deacon@arm.com>
Fri, 31 Mar 2017 17:20:29 +0000 (18:20 +0100)
commit980e8f3267d021064f84e99faba9e2ed31c90603
treee8421a72c4547b0a573219579fa3c63eec16855e
parent6daa4747f1eb248a53014de8762decf6b9223371
drivers/perf: arm_pmu: split irq request from enable

For historical reasons, we lazily request and free interrupts in the
arm pmu driver. This requires us to refcount use of the pmu (by way of
counting the active events) in order to request/free interrupts at the
correct times, which complicates the driver somewhat.

The existing logic is flawed, as it only considers currently online CPUs
when requesting, freeing, or managing the affinity of interrupts.
Intervening hotplug events can result in erroneous IRQ affinity, online
CPUs for which interrupts have not been requested, or offline CPUs whose
interrupts are still requested.

To fix this, this patch splits the requesting of interrupts from any
per-cpu management (i.e. per-cpu enable/disable, and configuration of
cpu affinity). We now request all interrupts up-front at probe time (and
never free them, since we never unregister PMUs).

The management of affinity, and per-cpu enable/disable now happens in
our cpu hotplug callback, ensuring it occurs consistently. This means
that we must now invoke the CPU hotplug callback at boot time in order
to configure IRQs, and since the callback also resets the PMU hardware,
we can remove the duplicate reset in the probe path.

This rework renders our event refcounting unnecessary, so this is
removed.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
[will: make armpmu_get_cpu_irq static]
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/perf/arm_pmu.c
include/linux/perf/arm_pmu.h