Re: [PATCH v3 5/5] KVM: selftests: Handle Intel Atom errata that leads to PMU event overcount
From: Sean Christopherson
Date: Fri Sep 19 2025 - 12:42:52 EST
On Fri, Sep 19, 2025, Sean Christopherson wrote:
> On Fri, Sep 19, 2025, Dapeng Mi wrote:
> > Or better, directly define INSTRUCTIONS_RETIRED_OVERCOUNT as a bitmap, like
> > this.
> >
> > diff --git a/tools/testing/selftests/kvm/include/x86/pmu.h
> > b/tools/testing/selftests/kvm/include/x86/pmu.h
> > index 25d2b476daf4..9af448129597 100644
> > --- a/tools/testing/selftests/kvm/include/x86/pmu.h
> > +++ b/tools/testing/selftests/kvm/include/x86/pmu.h
> > @@ -106,8 +106,8 @@ extern const uint64_t intel_pmu_arch_events[];
> > extern const uint64_t amd_pmu_zen_events[];
> >
> > enum pmu_errata {
> > - INSTRUCTIONS_RETIRED_OVERCOUNT,
> > - BRANCHES_RETIRED_OVERCOUNT,
> > + INSTRUCTIONS_RETIRED_OVERCOUNT = (1 << 0),
> > + BRANCHES_RETIRED_OVERCOUNT = (1 << 1),
>
> I want to utilize the auto-incrementing behavior of enums, without having to
> resort to double-defines or anything.
The counter-argument to that is we need to remember to use BIT_ULL() when
generating the mask in get_pmu_errata(). But I think overall I prefer hiding
the use of a bitmask.