On Mon, Oct 24, 2022, Like Xu wrote: > From: Like Xu <likexu@xxxxxxxxxxx> > > Re-reading PERF_CAPABILITIES each time when needed, adding the > overhead of eimulating RDMSR isn't also meaningless in the grand > scheme of the test. > > Based on this, more helpers for full_writes and lbr_fmt can also > be added to increase the readability of the test cases. > > Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx> > Signed-off-by: Like Xu <likexu@xxxxxxxxxxx> > --- > lib/x86/pmu.c | 3 +++ > lib/x86/pmu.h | 18 +++++++++++++++--- > x86/pmu.c | 2 +- > x86/pmu_lbr.c | 7 ++----- > 4 files changed, 21 insertions(+), 9 deletions(-) > > diff --git a/lib/x86/pmu.c b/lib/x86/pmu.c > index e8b9ae9..35b7efb 100644 > --- a/lib/x86/pmu.c > +++ b/lib/x86/pmu.c > @@ -1,8 +1,11 @@ > #include "pmu.h" > > struct cpuid cpuid_10; > +struct pmu_caps pmu; > > void pmu_init(void) > { > cpuid_10 = cpuid(10); > + if (this_cpu_has(X86_FEATURE_PDCM)) > + pmu.perf_cap = rdmsr(MSR_IA32_PERF_CAPABILITIES); Tabs...