From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 7/9] KVM: VMX: Refactor vmx_complete_atomic_exit() Date: Tue, 15 Mar 2011 18:40:00 -0300 Message-ID: <20110315214000.GA31424@amt.cnet> References: <1299592665-12325-1-git-send-email-avi@redhat.com> <1299592665-12325-8-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Gleb Natapov , Jan Kiszka To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:19198 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752230Ab1COVlS (ORCPT ); Tue, 15 Mar 2011 17:41:18 -0400 Content-Disposition: inline In-Reply-To: <1299592665-12325-8-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Mar 08, 2011 at 03:57:43PM +0200, Avi Kivity wrote: > Move the exit reason checks to the front of the function, for early > exit in the common case. > > Signed-off-by: Avi Kivity > --- > arch/x86/kvm/vmx.c | 15 +++++++++------ > 1 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 6eadeaf..36fbe11 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -3879,17 +3879,20 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) > > static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx) > { > - u32 exit_intr_info = vmx->exit_intr_info; > + u32 exit_intr_info; > + > + if (!(vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY > + || vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI)) > + return; > + > + exit_intr_info = vmx->exit_intr_info; So you're saving a vmread on exception and mce_during_vmentry exits? Managing nmi_known_unmasked appears tricky... perhaps worthwhile to have it in a helper that sets the bit in interruptibility info + nmi_known_unmasked.