On Fri, Jun 24, 2022, Yang Weijiang wrote: > Use new helper to check whether pmu is available and Perfmon/Debug > capbilities are supported before read MSR_IA32_PERF_CAPABILITIES to > avoid test failure. The issue can be captured when enable_pmu=0. > > Signed-off-by: Yang Weijiang <weijiang.yang@xxxxxxxxx> > --- > lib/x86/processor.h | 2 +- > x86/pmu_lbr.c | 32 +++++++++++++------------------- > 2 files changed, 14 insertions(+), 20 deletions(-) > > diff --git a/lib/x86/processor.h b/lib/x86/processor.h > index 70b9193..bb917b0 100644 > --- a/lib/x86/processor.h > +++ b/lib/x86/processor.h > @@ -193,7 +193,7 @@ static inline bool is_intel(void) > #define X86_FEATURE_PAUSEFILTER (CPUID(0x8000000A, 0, EDX, 10)) > #define X86_FEATURE_PFTHRESHOLD (CPUID(0x8000000A, 0, EDX, 12)) > #define X86_FEATURE_VGIF (CPUID(0x8000000A, 0, EDX, 16)) > - > +#define X86_FEATURE_PDCM (CPUID(0x1, 0, ECX, 15)) Please try to think critically about the code you're writing. All of the existing X86_FEATURE_* definitions are organized by leaf, sub-leaf, register _and_ bit position. And now there's X86_FEATURE_PDCM...