WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Question on p2m table

To: MaoXiaoyun <tinnycloud@xxxxxxxxxxx>
Subject: Re: [Xen-devel] Question on p2m table
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Tue, 31 May 2011 10:42:18 +0100
Cc: xen devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 31 May 2011 07:35:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <BLU157-w20E0638269BC9F8D36679CDA7B0@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <SNT0-MC4-F36Ccpzvqk001553a4@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <BLU157-w20E0638269BC9F8D36679CDA7B0@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
Hi, 

At 00:15 +0800 on 31 May (1306800954), MaoXiaoyun wrote:
> Hi:
>  
>   Question might be simple but really confused me a long time.
>   
>   In my assumption, during VM running, the CPU sees the guest code 
> instruction,
> so when it want to asscess memory, it sees the guest virtual adress(GVA), so 
> it need to 
> first translate to guest physical adress(GPA), and then host physical 
> adress(HPA), and finally 
> access the real memory address.
>  
> Since GPA are always needs to translated to HPA, and p2m table only 
> accessable in Xen for 
> HVM guest, does this mean every memory access will need VMExit to Xen?

No, that would run awfully slowly!  

If the CPU has EPT/NPT support, the p2m table can be passed to the CPU along
with the guest pagetables, and the CPU does both translations.  (This is
called "hap", for hardware-assisited paging, in the Xen code.)  That
needs no extra VMEXITs for memory accesses, but TLB fills get a lot more
expensive.

The other way to do it is for Xen to maintain "shadow pagetables",
copies of the guest pagetables with the extra p->m translation already
applied.  That involves some extra VMEXITs, basically the first time a
VA is used, and when an in-use pagetable is modified, and it needs a
bunch of memory to keep the shadows in. 

The overheads of the two methods are roughly comparable; depending on
the workload it can make a few % difference either way to use shadows or
hap.

Because the code for fast shadow pagetables is quite complicated, some
of the more recent Xen features (page-sharing, paging, the new mem-event
interface) are only supported on HAP.

Cheers,

Tim.

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>