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] guest physical to xen machine copy?

To: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, "Xen-Devel (E-mail)" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Tian, Kevin" <kevin.tian@xxxxxxxxx>
Subject: Re: [Xen-devel] guest physical to xen machine copy?
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Mon, 29 Sep 2008 21:11:34 +0100
Delivery-date: Mon, 29 Sep 2008 13:11:57 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <3260af91-f84d-40c3-84f0-a75ddb625cc3@default>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Ackib5HS0Jumco5iEd2xvgAWy6hiGQ==
Thread-topic: [Xen-devel] guest physical to xen machine copy?
User-agent: Microsoft-Entourage/
On 29/9/08 19:50, "Dan Magenheimer" <dan.magenheimer@xxxxxxxxxx> wrote:

> Hmmm...  gfn_to_mfn() when used as below seems to just
> return the original gfn, e.g.
> guest_mfn = gfn_to_mfn(current->domain,gpfn,&t);
> Is this correct?  Note that current->domain is a 32-bit
> paravirtualized domain and xen is 64-bit, if that matters.
> (Is there a better way if one knows that the domain is
> always pv?)

Xen doesn't do pfn-to-mfn translation for PV guests. They do it themselves
with their own p2m table. So, for a PV guest, gfn==mfn.

>> Use p2m_is_ram() instead of checking individual p2m ram type
> In copying the other direction (e.g. copy_page_TO_guest),
> I think I need to check for t==p2m_ram_rw, right?

You need to check for not p2m_ram_ro. You also should page_mark_dirty()
(__hvm_copy() does it unconditionally on pages it modifies).

 -- Keir

> If so, the "Not necessarily true" comment in static
> inline _gfn_to_mfn in include/asm-x86/p2m.h worries me.
> Should it?

Xen-devel mailing list