[PATCH v2 0/2] perf: Generic hotplug/cpumask for system PMUs

Robin Murphy posted 2 patches 2 hours ago
drivers/perf/arm-cmn.c     | 96 +++++++++-----------------------------
include/linux/perf_event.h | 19 ++++++++
kernel/events/core.c       | 78 +++++++++++++++++++++++++++----
3 files changed, 110 insertions(+), 83 deletions(-)
[PATCH v2 0/2] perf: Generic hotplug/cpumask for system PMUs
Posted by Robin Murphy 2 hours ago
v1: https://lore.kernel.org/linux-perf-users/cover.1784653319.git.robin.murphy@arm.com/

Hi all,

Here's my take on finally trying to clean up the longstanding PMUs vs.
CPU hotplug can of worms. Patch #1 is the thing to look at; patch #2
is included as an example of how it simplifies my "favourite" driver
(in fact arm-cmn actually gets one of the least-negative diffstats on
offer, but it's the one I can test on a box under my desk). I'll save
the remaining bulk-conversion noise for a follow-up if and when.

For simplicity I've framed this around the system PMU use-case, since
consolidating their whole cpumask/migration business is the big win
here, and isn't all that easy to do in separate stages. However, the
design does also allow for any driver to now benefit from implementing
the init_cpu/exit_cpu ops in place of managing their own cpuhp state;
only the automatic filtering and context migration is tied to the new
cpumask-specific scope.

v2 fixes the definite functional mishaps from v1; as for the comments
and other subtleties I'd rather know what real human maintainers think.
I'm still not entirely sure about trying to put ->exit_cpu() calls in
perf_pmu_free() for the sake of symmetry - it looks like it would be a
little fiddly to get right, and as far as the system PMU drivers go,
the ones which aren't already using _nocalls variants for remove/
probe-failure teardown anyway look to be just wrong and making
exactly the mistakes I'm trying to clean up: doing a bunch of busywork
chasing around the affinity of an IRQ that's about to be freed, plus
calling perf_pmu_migrate_context() with an unregistered PMU! I do see
at least arm-spe, coresight-trbe and riscv-sbi actually doing some kind
of vaguely meaningful per-CPU disable, so perhaps the question of
whether it's common enough to be generic or simple enough to open-code
can wait for a future generic hotplug conversion of those?

Thanks,
Robin.


Robin Murphy (2):
  perf: Generic hotplug/cpumask for system PMUs
  perf/arm-cmn: Switch to generic cpumask

 drivers/perf/arm-cmn.c     | 96 +++++++++-----------------------------
 include/linux/perf_event.h | 19 ++++++++
 kernel/events/core.c       | 78 +++++++++++++++++++++++++++----
 3 files changed, 110 insertions(+), 83 deletions(-)

-- 
2.54.0.dirty