[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Question on p2m table

  • To: MaoXiaoyun <tinnycloud@xxxxxxxxxxx>
  • 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
  • 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=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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?


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

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?


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.