From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963AbcF3HWK (ORCPT ); Thu, 30 Jun 2016 03:22:10 -0400 Received: from mga14.intel.com ([192.55.52.115]:36791 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbcF3HWH (ORCPT ); Thu, 30 Jun 2016 03:22:07 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,550,1459839600"; d="scan'208";a="131075561" Subject: Re: [PATCH 3/5] mmu: don't set the present bit unconditionally To: Paolo Bonzini , Bandan Das , kvm@vger.kernel.org References: <1467088360-10186-1-git-send-email-bsd@redhat.com> <1467088360-10186-4-git-send-email-bsd@redhat.com> <57733DD3.7040404@linux.intel.com> <3b4a6bb6-4364-b188-48da-be79c0dc7534@redhat.com> Cc: linux-kernel@vger.kernel.org From: Xiao Guangrong Message-ID: <5774C7C7.2080501@linux.intel.com> Date: Thu, 30 Jun 2016 15:18:31 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <3b4a6bb6-4364-b188-48da-be79c0dc7534@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/29/2016 04:18 PM, Paolo Bonzini wrote: > > > 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. Yup, it is better.