From: Paolo Bonzini Subject: Re: [PATCH 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor Date: Thu, 3 Aug 2017 14:41:04 +0200 Message-ID: <179e5832-0dca-0b5f-b303-d5de18353f5e@redhat.com> References: <20170801232433.31749-1-bsd@redhat.com> <20170801232433.31749-4-bsd@redhat.com> <56d21524-1a08-8281-fb01-950fb7c10b2f@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: rkrcmar@redhat.com, jmattson@google.com, linux-kernel@vger.kernel.org To: David Hildenbrand , Bandan Das , kvm@vger.kernel.org Return-path: In-Reply-To: <56d21524-1a08-8281-fb01-950fb7c10b2f@redhat.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 03/08/2017 13:39, David Hildenbrand wrote: >> + /* AD, if set, should be supported */ >> + if ((address & VMX_EPT_AD_ENABLE_BIT)) { >> + if (!enable_ept_ad_bits) >> + return false; > In theory (I guess) we would have to check here if > (vmx->nested.nested_vmx_ept_caps & VMX_EPT_AD_BIT) Yes, that's a more correct check than enable_ept_ad_bits. >> >> + page = nested_get_page(vcpu, vmcs12->eptp_list_address); >> + if (!page) >> + return 1; >> + >> + l1_eptp_list = kmap(page); >> + address = l1_eptp_list[index]; >> + accessed_dirty = !!(address & VMX_EPT_AD_ENABLE_BIT); > > Minor nit: Can't you directly do > > kunmap(page); > nested_release_page_clean(page); > > at this point? > > We can fix this up later. You actually can do simply kvm_vcpu_read_guest_page(vcpu, vmcs12->eptp_list_address >> PAGE_SHIFT, &address, index * 8, 8). Paolo