perf/x86/amd/uncore: Add group exclusivity
authorSandipan Das <sandipan.das@amd.com>
Thu, 5 Oct 2023 05:23:14 +0000 (10:53 +0530)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 9 Oct 2023 14:12:24 +0000 (16:12 +0200)
commit83a43c622123e714b0317a57176b336187f5deb3
treec0620919be19a858d873079585cad209bcc0a6c6
parent7ef0343855dc23a979a53b3143540f93f3e5bef8
perf/x86/amd/uncore: Add group exclusivity

In some cases, it may be necessary to restrict opening PMU events to a
subset of CPUs. E.g. Unified Memory Controller (UMC) PMUs are specific
to each active memory channel and the MSR address space for the PERF_CTL
and PERF_CTR registers is reused on each socket. Thus, opening events
for a specific UMC PMU should be restricted to CPUs belonging to the
same socket as that of the UMC. The "cpumask" of the PMU should also
reflect this accordingly.

Uncore PMUs which require this can use the new group attribute in struct
amd_uncore_pmu to set a valid group ID during the scan() phase. Later,
during init(), an uncore context for a CPU will be unavailable if the
group ID does not match.

Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/937d6d71010a48ea4e069f4904b3116a5f99ecdf.1696425185.git.sandipan.das@amd.com
arch/x86/events/amd/uncore.c