Re: [PATCH v3 09/11] perf: x86/core: Add interface to query perfmon_event_map[] directly

From: Peter Zijlstra
Date: Fri Apr 15 2022 - 04:26:06 EST


On Mon, Apr 11, 2022 at 05:35:35PM +0800, Like Xu wrote:
> From: Like Xu <likexu@xxxxxxxxxxx>
>
> Currently, we have [intel|knc|p4|p6]_perfmon_event_map on the Intel
> platforms and amd_[f17h]_perfmon_event_map on the AMD platforms.
>
> Early clumsy KVM code or other potential perf_event users may have
> hard-coded these perfmon_maps (e.g., arch/x86/kvm/svm/pmu.c), so
> it would not make sense to program a common hardware event based
> on the generic "enum perf_hw_id" once the two tables do not match.
>
> Let's provide an interface for callers outside the perf subsystem to get
> the counter config based on the perfmon_event_map currently in use,
> and it also helps to save bytes.
>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Signed-off-by: Like Xu <likexu@xxxxxxxxxxx>

Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>