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] [Q] mfn_to_gmfn macro, log-dirty bitmap,

To: Min Lee <min.lee@xxxxxxxxxx>
Subject: Re: [Xen-devel] [Q] mfn_to_gmfn macro, log-dirty bitmap,
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Mon, 28 Jun 2010 16:27:56 +0100
Cc: "Xen-devel@xxxxxxxxxxxxxxxxxxx" <Xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 28 Jun 2010 08:28:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C28B700.2020904@xxxxxxxxxx>
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: <4C28A66B.6080103@xxxxxxxxxx> <20100628143248.GE30210@xxxxxxxxxxxxxxxxxxxxxxx> <4C28B700.2020904@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
At 15:51 +0100 on 28 Jun (1277740304), Min Lee wrote:
> Thanks! now it gives me good numbers. seems to be working.
> I thought M2P table is somehow enabled/disabled by 
> paging_mode_translate(_d)...
> So, does it mean M2P is working always regardless of 
> paging_mode_translate(_d) ?

Yes - the m2p is used by PV guests to look up the inverse of their p2m
maps.  They need to tell Xen what to put in it (and so it's no more
reliable than anything else that comes from the guest).  For HVM guests
the m2p is kept up to date by the code that handles the p2m in Xen.

The page-sharing code makes this all more complicated, of course, since
there's no longer a single answer for any MFN.

> Then what paging_mode_translate(_d) exactly indicates?

It indicates that the guest's pagetables are built using PFNs, and so
the shadow pagetable code (or hardware assistance) needs to do the extra
translation to MFNs.  On x86 it's almost always == is_hvm_domain(d) but 
there have been projects that used paging_mode_translate() with PV
guests (e.g. to help with deterministic replay).

Cheers,

Tim.

> Thanks a lot!
> Min
> 
> On 6/28/2010 10:32 AM, Tim Deegan wrote:
> > Hi,
> >
> > At 14:40 +0100 on 28 Jun (1277736059), Min Lee wrote:
> >> Hi, folks.
> >> I'm running 32bit PV-domu on 64bit xen&dom0 and I'm using
> >> XEN_DOMCTL_SHADOW_OP_PEEK to get log-dirty bitmap.
> >> First, I'm assuming this bitmap is indexed by gmfn, right? because we're
> >> passing p2m->size parameter to xen.
> >
> > The log-dirty bitmap is indexed by guest _PFN_, even for PV guests.
> > (see the comment at about line 400 of asm-x86/mm.h for an explanation of
> > the *fn terminology, and the confusion around "gmfn" in particular).
> >
> >> Second, I have mfn (not gmfn) which I want to translate to gmfn so that I
> >> can correctly read corresponding bit in log-dirty bitmap. so I've tried
> >> mfn_to_gmfn() macro below but it doesn't seem to work. (always mfn==gmfn)
> >> Maybe because m2p table is not enabled?
> >
> > The mfn_to_gmfn macro translates to GFNs (for historical reasons, IIRC
> > to do with earlier shadow pagetable implementations).  To inspect the
> > logdirty bitmap you want to translate to PFNs, so you should call
> > get_gpfn_from_mfn() directly.
> >
> > Cheers,
> >
> > Tim.
> >
> >> How can I properly do mfn_to_gmfn?
> >>
> >> #define mfn_to_gmfn(_d, mfn)                            \
> >>       ( (paging_mode_translate(_d))                       \
> >>         ? get_gpfn_from_mfn(mfn)                          \
> >>         : (mfn) )
> >>
> >>
> >> Thanks for any help.
> >> Min
> >>
> >> _______________________________________________
> >> Xen-devel mailing list
> >> Xen-devel@xxxxxxxxxxxxxxxxxxx
> >> http://lists.xensource.com/xen-devel
> >
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

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

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