From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: Understanding KVM nested paging theory Date: Fri, 13 Apr 2012 19:15:54 +0800 Message-ID: <4F880AEA.2090203@linux.vnet.ibm.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: xiaoguangrong@cn.fujitsu.com, ravi.bhargava@amd.com, benjamin.serebrin@amd.com, kvm@vger.kernel.org To: Steven Return-path: Received: from e28smtp08.in.ibm.com ([122.248.162.8]:41125 "EHLO e28smtp08.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751534Ab2DMLQ1 (ORCPT ); Fri, 13 Apr 2012 07:16:27 -0400 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Apr 2012 16:46:24 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3DBFwwD4157646 for ; Fri, 13 Apr 2012 16:45:58 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q3DGjcXl010387 for ; Fri, 13 Apr 2012 22:15:40 +0530 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 04/11/2012 02:03 PM, Steven wrote: > Hi, Guangrong, > I read your very nice slides at LCJ 2011, "KVM MMU virtualization". > However, I have some confusion about nested paging, > which you gave a simplified example to illustrate in slide 11. > The very first step is to use gCR3 as the input to the nested page I remember that i did not mention nested mmu in my presentation, the illustrate is about shadow mmu. > walk. So you mark gCR3 as the guest physical address (gpa). > So my first question is whether gCR3 is exactly the GPA as the input > to the nested paging? No, on nested mmu, the guest page table is from nested guest's vmcb.nested_cr3/vmcs.eptp which translates nested guest's gpa to L1 guest's gpa. > > Then after the nested page walk, we can have hpa. Now suppose we > use the first 10 bit of the gva to combine with the hpa to find the > guest table entry. Here is this step like traditional x86 paging, > ie.., hpa as the base to the guest page directory (guest page table > page) and gva is the offset? gva -> gpa The npt/ept table is walked base on gpa. > If so, I feel that this is contradict to figure 1(b) of the paper > "Accelerating Two-Dimensional Page Walks for Virtualized Systems". In > this paper, gva is used at the very beginning to combine with gCR3 to > generate a GPA, instead of after the nested paging. gCR3 stores the page table to translate gva to gpa on guest. And npt/ept table translate gpa to pfn, and the table is established by host. I find a paper on google, hope it is useful for you: http://researcher.ibm.com/files/us-bbfinkel/turtles_paper.pdf