From: Avi Kivity Subject: [PATCH v2 2/9] KVM: MMU: Optimize gpte_access() slightly Date: Sun, 16 Sep 2012 15:07:08 +0300 Message-ID: <1347797235-20732-3-git-send-email-avi@redhat.com> References: <1347797235-20732-1-git-send-email-avi@redhat.com> Cc: kvm@vger.kernel.org, Xiao Guangrong To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:6019 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437Ab2IPMHY (ORCPT ); Sun, 16 Sep 2012 08:07:24 -0400 In-Reply-To: <1347797235-20732-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: If nx is disabled, then is gpte[63] is set we will hit a reserved bit set fault before checking permissions; so we can ignore the setting of efer.nxe. Reviewed-by: Xiao Guangrong Signed-off-by: Avi Kivity --- arch/x86/kvm/paging_tmpl.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index bf7b4ff..064bcb3 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -106,10 +106,8 @@ static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte) unsigned access; access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK; - #if PTTYPE == 64 - if (vcpu->arch.mmu.nx) - access &= ~(gpte >> PT64_NX_SHIFT); + access &= ~(gpte >> PT64_NX_SHIFT); #endif return access; } -- 1.7.12