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/
Home Products Support Community News


Re: [Xen-devel] question about machine-to-physic table and phy-to-machin

To: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] question about machine-to-physic table and phy-to-machine table
From: tgh <tianguanhua@xxxxxxxxxx>
Date: Tue, 27 Mar 2007 14:14:07 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Daniel Stodden <stodden@xxxxxxxxxx>
Delivery-date: Mon, 26 Mar 2007 23:35:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <200703270514.53524.mark.williamson@xxxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <45F93B96.76E4.0078.0@xxxxxxxxxx> <460333B8.70307@xxxxxxxxxx> <200703270514.53524.mark.williamson@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird (Windows/20060909)
Thank you for your detail reply
your explanation is really helpful

p2m and m2p are all lazily allocated ,that is when the guestos deal with page fault for using ,say writing, a page which is virtual-mapped but not allocated machine page ,is it right?

Mark Williamson 写道:
 I read the code ,there are machine-to-physic table and
physic-to-machine table
there are machine address for hardward address ,physic address for
guestos's view hardware and virtual address ,is it right?

phy-to-machine table is a mapping for guestos's view hardware to real
hardward ,is it right?
I am confused about the meaning and function of  machine-to-physic address

* Machine addresses represent real RAM in the host. The memory a guest owns will certainly not start at 0 and will not necessarily be contiguous - it might be in a number of chunks with big gaps between.

* (pseudo)physical addresses represent the memory the guest owns. This address space starts at 0 and is contiguous.

* Virtual addresses are used by software running in the guest, and by the guest kernel. They're translated by the host CPU into machine addresses so that it can access the correct RAM.

Guests use physical addresses as an abstraction: most operating system memory management code assumes that the RAM owned by the OS starts at 0 and is contiguous. Because this is not the case for Machine addresses under Xen, most of the guest's code is "tricked" by giving it pseudophysical addresses that look like it expects memory to look.

The P2M and M2P tables record the relationship between pseudophysical page frames (which the core OS code uses) and machine page frames (which the host really uses). The Xen "architecture" code within the guest OS uses these tables to manage the translation between pseudophysical and machine page frames so that the guest's page tables can be handled correctly. For paravirtualised guests, page tables must contain machine addresses - these must be translated from the pseudophysical addresses used by core OS code.

Hope that helps clarify how this all fits together, tgh.


Xen-devel mailing list