From: Paolo Bonzini Subject: Re: [PATCH 3/5] mmu: don't set the present bit unconditionally Date: Wed, 29 Jun 2016 10:18:34 +0200 Message-ID: <3b4a6bb6-4364-b188-48da-be79c0dc7534@redhat.com> References: <1467088360-10186-1-git-send-email-bsd@redhat.com> <1467088360-10186-4-git-send-email-bsd@redhat.com> <57733DD3.7040404@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org To: Xiao Guangrong , Bandan Das , kvm@vger.kernel.org Return-path: In-Reply-To: <57733DD3.7040404@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 29/06/2016 05:17, Xiao Guangrong wrote: >> >> +++ b/arch/x86/kvm/mmu.c >> @@ -2516,13 +2516,17 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 >> *sptep, >> gfn_t gfn, kvm_pfn_t pfn, bool speculative, >> bool can_unsync, bool host_writable) >> { >> - u64 spte; >> + u64 spte = 0; >> int ret = 0; >> + struct kvm_mmu *context = &vcpu->arch.mmu; >> + bool execonly = !(context->guest_rsvd_check.bad_mt_xwr & >> + (1ull << VMX_EPT_EXECUTABLE_MASK)); > > Could we introduce a new field, say execonly, to "struct kvm_mmu"? > That would make the code be more clearer. Given how execonly is used, let's add shadow_present_mask instead. Paolo