Re: [PATCH v6 1/8] KVM: x86/pmu: Do not map fixed counters >= 3 to generic perf events

From: Jim Mattson

Date: Wed Jul 22 2026 - 17:56:05 EST


On Mon, Jun 29, 2026 at 4:28 PM Zide Chen <zide.chen@xxxxxxxxx> wrote:
>
> Only fixed counters 0..2 have matching generic cross-platform
> hardware perf events (INSTRUCTIONS, CPU_CYCLES, REF_CPU_CYCLES).
> Therefore, perf_get_hw_event_config() is only applicable to these
> counters.
>
> KVM does not intend to emulate fixed counters >= 3 on legacy
> (non-mediated) vPMU, while for mediated vPMU, KVM does not care what
> the fixed counter event mappings are. Therefore, return 0 for their
> eventsel.
>
> The two BUILD_BUG_ON() checks are no longer needed, so drop them along
> with __always_inline.
>
> Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>