On Wed, Aug 28, 2024, Colton Lewis wrote: > Hi Mingwei, thanks for reviewing! > > Mingwei Zhang <mizhang@xxxxxxxxxx> writes: > > > On Tue, Aug 13, 2024, Colton Lewis wrote: > > > This defined the CPUID calls to determine what extensions and > > > properties are available. AMD reference manual names listed below. > > > > * PerfCtrExtCore (six core counters instead of four) > > > * PerfCtrExtNB (four counters for northbridge events) > > > * PerfCtrExtL2I (four counters for L2 cache events) > > > * PerfMonV2 (support for registers to control multiple > > > counters with a single register write) > > > * LbrAndPmcFreeze (support for freezing last branch recorded stack on > > > performance counter overflow) > > > * NumPerfCtrCore (number of core counters) > > > * NumPerfCtrNB (number of northbridge counters) > > > > Signed-off-by: Colton Lewis <coltonlewis@xxxxxxxxxx> > > > --- > > > tools/testing/selftests/kvm/include/x86_64/processor.h | 7 +++++++ > > > 1 file changed, 7 insertions(+) > > > > diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h > > > b/tools/testing/selftests/kvm/include/x86_64/processor.h > > > index a0c1440017bb..9d87b5f8974f 100644 > > > --- a/tools/testing/selftests/kvm/include/x86_64/processor.h > > > +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h > > > @@ -183,6 +183,9 @@ struct kvm_x86_cpu_feature { > > > #define X86_FEATURE_GBPAGES KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 26) > > > #define X86_FEATURE_RDTSCP KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 27) > > > #define X86_FEATURE_LM KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 29) > > > +#define X86_FEATURE_PERF_CTR_EXT_CORE KVM_X86_CPU_FEATURE(0x80000001, > > > 0, ECX, 23) > > > +#define X86_FEATURE_PERF_CTR_EXT_NB KVM_X86_CPU_FEATURE(0x80000001, > > > 0, ECX, 24) > > > +#define X86_FEATURE_PERF_CTR_EXT_L2I KVM_X86_CPU_FEATURE(0x80000001, > > > 0, ECX, 28) > > > You won't be testing Northbridge counters and L2I counters, so these two > > could be optional to the patch. > > That's correct. Since it was a small thing to include I thought it best > to include and save someone in the future from digging through the > reference manual again. +1. They're defines, i.e. have no meaningful cost. And anything that *might* save me from having to find CPUID entries in the SDM/APM is worth adding.