Re: [PATCH v3 1/2] KVM: x86: Provide a capability to disable APERF/MPERF read intercepts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 5, 2025 at 9:34 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Mon, May 05, 2025, Jim Mattson wrote:
> > On Mon, Apr 28, 2025 at 3:58 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> > > index 88a9475899c8..1675017eea88 100644
> > > --- a/arch/x86/kvm/x86.h
> > > +++ b/arch/x86/kvm/x86.h
> > > @@ -481,25 +481,15 @@ static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec)
> > >             __rem;                                              \
> > >          })
> > >
> > > -static inline bool kvm_mwait_in_guest(struct kvm *kvm)
> > > -{
> > > -       return kvm->arch.mwait_in_guest;
> > > -}
> > > -
> > > -static inline bool kvm_hlt_in_guest(struct kvm *kvm)
> > > -{
> > > -       return kvm->arch.hlt_in_guest;
> > > -}
> > > -
> > > -static inline bool kvm_pause_in_guest(struct kvm *kvm)
> > > -{
> > > -       return kvm->arch.pause_in_guest;
> > > -}
> > > -
> > > -static inline bool kvm_cstate_in_guest(struct kvm *kvm)
> > > -{
> > > -       return kvm->arch.cstate_in_guest;
> > > -}
> > > +#define BUILD_DISABLED_EXITS_HELPER(lname, uname)                              \
> > > +static inline bool kvm_##lname##_in_guest(struct kvm *kvm)                     \
> > > +{                                                                              \
> > > +       return kvm->arch.disabled_exits & KVM_X86_DISABLE_EXITS_##uname;        \
> > > +}
> > > +BUILD_DISABLED_EXITS_HELPER(hlt, HLT);
> > > +BUILD_DISABLED_EXITS_HELPER(pause, PAUSE);
> > > +BUILD_DISABLED_EXITS_HELPER(mwait, MWAIT);
> > > +BUILD_DISABLED_EXITS_HELPER(cstate, CSTATE);
> >
> > The boilerplate is bad, but that's abhorrent.
>
> Assuming it's the macros you hate, keep the "u64 disabled_exits" change but
> manually code all of the getters?

Sounds good. I'll try to get a V4 out this week.





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux