Re: [PATCH v2 08/16] perf/x86: Plumb counter bitmap from x86_pmu to x86_pmu_cap

From: Jim Mattson

Date: Wed Oct 28 2026 - 13:44:47 EST


On Thu, Aug 27, 2026 at 3:51 PM Zide Chen <zide.chen@xxxxxxxxx> wrote:
>
> From: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
>
> Intel PerfMon v5 introduced CPUID.0AH:ECX to support non-contiguous
> fixed counters and Architectural PerfMon Extension leaf (0x23) further
> supports non-contiguous general-purpose counters.
>
> num_counters_{gp,fixed} indicates the total number of GP or fixed
> counters, but cannot represent non-contiguous counters.
>
> Add cntr_mask and fixed_cntr_mask unions so that KVM can get the
> accurate counter availability directly from x86_pmu_cap. The u64
> alias is convenient for mask arithmetic, while the bitmap form works
> with for_each_set_bit() and friends.
>
> num_counters_{gp,fixed} in x86_pmu_capability will be removed once
> callers have been converted to the use of {,fixed_}cntr_mask.
>
> Signed-off-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
> Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>