Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752033AbdHCTz2 (ORCPT ); Thu, 3 Aug 2017 15:55:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57138 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbdHCTzZ (ORCPT ); Thu, 3 Aug 2017 15:55:25 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B819C047B6E Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=bsd@redhat.com From: Bandan Das To: Paolo Bonzini Cc: David Hildenbrand , kvm@vger.kernel.org, rkrcmar@redhat.com, jmattson@google.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor References: <20170801232433.31749-1-bsd@redhat.com> <20170801232433.31749-4-bsd@redhat.com> <56d21524-1a08-8281-fb01-950fb7c10b2f@redhat.com> <179e5832-0dca-0b5f-b303-d5de18353f5e@redhat.com> Date: Thu, 03 Aug 2017 15:55:21 -0400 In-Reply-To: <179e5832-0dca-0b5f-b303-d5de18353f5e@redhat.com> (Paolo Bonzini's message of "Thu, 3 Aug 2017 14:41:04 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 03 Aug 2017 19:55:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1074 Lines: 37 Paolo Bonzini writes: > 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). Thanks Paolo, for the interesting tip. David, I sent a new version with the correct check for AD and using this instead of kmap(page). > Paolo