Re: [RFC PATCH v3 4/7] KVM: x86: Let userspace re-enable previously disabled exits

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

 



On Wed, Jun 15, 2022, Chao Gao wrote:
> On Tue, Jun 14, 2022 at 06:16:19PM -0700, Kechen Lu wrote:
> > 7.14 KVM_CAP_S390_HPAGE_1M
> >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >index f31ebbb1b94f..7cc8ac550bc7 100644
> >--- a/arch/x86/kvm/x86.c
> >+++ b/arch/x86/kvm/x86.c
> >@@ -4201,11 +4201,10 @@ static inline bool kvm_can_mwait_in_guest(void)
> > 
> > static u64 kvm_get_allowed_disable_exits(void)
> > {
> >-	u64 r = KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE |
> >-		KVM_X86_DISABLE_EXITS_CSTATE;
> >+	u64 r = KVM_X86_DISABLE_VALID_EXITS;
> > 
> >-	if(kvm_can_mwait_in_guest())
> >-		r |= KVM_X86_DISABLE_EXITS_MWAIT;
> >+	if (!kvm_can_mwait_in_guest())
> >+		r &= ~KVM_X86_DISABLE_EXITS_MWAIT;
> 
> This hunk looks like a fix to patch 3; it can be squashed into that patch.

It's not a fix, just an inversion of the logic to make it easier to maintain
going forward.  I intentionally made the change in patch 4 so that adding the
kvm_get_allowed_disable_exits() is a more "pure" movement of code from the "check"
path to a common helper.

I agree it's kinda odd, but I still think splitting the changes is desirable.



[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