lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82D7661F83C1A047AF7DC287873BF1E1737F7871@SHSMSX104.ccr.corp.intel.com>
Date:   Fri, 30 Aug 2019 00:01:56 +0000
From:   "Kang, Luwei" <luwei.kang@...el.com>
To:     Jim Mattson <jmattson@...gle.com>
CC:     Paolo Bonzini <pbonzini@...hat.com>,
        Radim Krcmár <rkrcmar@...hat.com>,
        "Christopherson, Sean J" <sean.j.christopherson@...el.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Joerg Roedel <joro@...tes.org>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "Borislav Petkov" <bp@...en8.de>,
        "H . Peter Anvin" <hpa@...or.com>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        kvm list <kvm@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Stephane Eranian <eranian@...gle.com>
Subject: RE: [RFC v1 1/9] KVM: x86: Add base address parameter for
 get_fixed_pmc function

> > PEBS output Inte PT introduces some new MSRs (MSR_RELOAD_FIXED_CTRx)
> > for fixed function counters that use for autoload the preset value
> > after writing out a PEBS event.
> >
> > Introduce base MSRs address parameter to make this function can get
> > performance monitor counter structure by MSR_RELOAD_FIXED_CTRx
> registers.
> >
> > Signed-off-by: Luwei Kang <luwei.kang@...el.com>
> > ---
> >  arch/x86/kvm/pmu.h           |  5 ++---
> >  arch/x86/kvm/vmx/pmu_intel.c | 14 +++++++++-----
> >  2 files changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h index
> > 58265f7..c62a1ff 100644
> > --- a/arch/x86/kvm/pmu.h
> > +++ b/arch/x86/kvm/pmu.h
> > @@ -93,10 +93,9 @@ static inline struct kvm_pmc *get_gp_pmc(struct
> > kvm_pmu *pmu, u32 msr,  }
> >
> >  /* returns fixed PMC with the specified MSR */ -static inline struct
> > kvm_pmc *get_fixed_pmc(struct kvm_pmu *pmu, u32 msr)
> > +static inline struct kvm_pmc *get_fixed_pmc(struct kvm_pmu *pmu, u32
> msr,
> > +                                                               int
> > +base)
> >  {
> > -       int base = MSR_CORE_PERF_FIXED_CTR0;
> > -
> >         if (msr >= base && msr < base + pmu->nr_arch_fixed_counters)
> >                 return &pmu->fixed_counters[msr - base];
> 
> IIUC, these new MSRs aren't new fixed PMCs, but are values to be reloaded
> into the existing fixed PMCs when a PEBS event has been written. This change
> makes it look like you are introducing an additional set of fixed PMCs.

Yes, you are right. They are not new fixed counters.
Each fixed/general purpose counters have a "kvm_pmc" structure in KVM. We already have a function to get general purpose counter by event selectors and gp counters, as below:
pmc = get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0)		//by gp counter
pmc = get_gp_pmc(pmu, msr, MSR_P6_EVNTSEL0) 		//by gp event selector
So I extended the " get_fixed_pmc " function to support get fixed counters by MSR_RELOAD_FIXED_CTRx. Actually, they are all get "kvm_pmc" structure by offset.

Thanks,
Luwei Kang



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ