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: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Tue, 31 May 2011 10:29:11 +0100
Cc: xen devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 31 May 2011 09:20:54 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=xKEe6ymgqnpWqUr/aHwVbR5nNoM5t0jpTPN11xTvO3I=; b=Up0/iR1QMBSa2QNHIJG057Yral2AmhSklg43RFOTgkGrNcUCcG9q2qImiFuXzzgrs8 tjAb8b8XqxPTbccf7R2PlzIcWBP5seYBiR5vD/tYgbdU5c4ItLofVOuMwJTHN+NZQ5Wa uJbWfxl5Q03ndePabDErRA6lt2YTQgkUlmhZA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=QRGkJfAZzfaWy5bHCaN280kjDp27twZYMUTE5ibJJtrx/h5ylOW4CnJ+jNEsZHvYFn ojnX4EyHC2XrWjI39x4W9NQKAx8hK7OClqX9m50euLRKfyiaxr6cXeeRyTMC2UqTGpWf F2XjbS/8twpLzipRWvGJMpRHMB1eBAIO2Sfos=
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
2011/5/30 MaoXiaoyun <tinnycloud@xxxxxxxxxxx>:
> 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.

How the translation happens depends on the mode you're running in:
shadow or HAP.

As you know, in non-virtualization mode, the hardware will translate a
virtual address to a physical address by walking the page tables, and
placing the resulting translation in the TLB.

For fully virtualized VMs, as you say, the guest page tables are using
guest PFNs, which need to be translated into hardware pages (MFNs)
before they can be used.

In shadow mode, the hypervisor keeps a set of "shadow" pagetables,
which are translated versions of the guest pagetables.  The hardware
walks these shadow page tables in exactly the same way as it does when
not virtualized.  This means that Xen has to be involved whenever the
guest's *page tables* are changed, but not on every access to guest
memory.

In HAP mode, the hypervisor tells the hardware where to find the p2m
table, and the hardware does the translation itself -- walking Xen's
p2m table just as it walks the guest's page tables.

In neither case is Xen involved on every memory access.

Does that make sense?

 -George

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

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