From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754013AbdEJQA1 (ORCPT ); Wed, 10 May 2017 12:00:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42554 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753632AbdEJQAZ (ORCPT ); Wed, 10 May 2017 12:00:25 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 714473B714 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bsd@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 714473B714 From: Bandan Das To: Paolo Bonzini Cc: "Huang\, Kai" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] nVMX: Implement emulated Page Modification Logging References: <20170505192515.27833-1-bsd@redhat.com> <20170505192515.27833-3-bsd@redhat.com> <85f58713-67f6-fb06-9426-8d03809cea07@linux.intel.com> <9a3fb181-6bba-9488-114d-fd0fcdd6c92a@redhat.com> Date: Wed, 10 May 2017 12:00:21 -0400 In-Reply-To: <9a3fb181-6bba-9488-114d-fd0fcdd6c92a@redhat.com> (Paolo Bonzini's message of "Wed, 10 May 2017 16:46:39 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (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.30]); Wed, 10 May 2017 16:00:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paolo Bonzini writes: ... >> Is the purpose of returning 1 to make upper layer code to inject PML >> full VMEXIt to L1 in nested_ept_inject_page_fault? > > Yes, it triggers a fault >>> + >>> + gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS) & ~0xFFFull; >>> + >>> + page = nested_get_page(vcpu, vmcs12->pml_address); >>> + if (!page) >>> + return 0; >> >> If PML is enabled in L1, I think nested_get_page should never return a >> NULL PML page (unless L1 does something wrong)? Probably better to >> return 1 rather than 0, and handle error in nested_ept_inject_page_fault >> according to vmcs12->pml_address? > > This happens if the PML address is invalid (where on real hardware, the > write would just be "eaten") or MMIO (where we expect to diverge from Yes, that was my motivation. On real hardware, the hypervisor would still run except that the PML buffer is corrupt. Bandan > real hardware behavior). > >>> + >>> + pml_address = kmap(page); >>> + pml_address[vmcs12->guest_pml_index--] = gpa; >> >> This gpa is L2 guest's GPA. Do we also need to mark L1's GPA (which is >> related to L2 guest's GPA above) in to dirty-log? Or has this already >> been done? > > L1's PML contains L1 host physical addresses, i.e. L0 guest physical > addresses. This GPA comes from vmcs02 and hence it is L0's GPA. > > L0's HPA is marked by hardware through PML, as usual. If L0 has EPT A/D > but not PML, it can still provide emulated PML to L1, but L0's HPA will > be marked as dirty via write protection. > > Paolo