* [Q] mfn_to_gmfn macro, log-dirty bitmap,
@ 2010-06-28 13:40 Min Lee
2010-06-28 13:50 ` Keir Fraser
2010-06-28 14:32 ` Tim Deegan
0 siblings, 2 replies; 6+ messages in thread
From: Min Lee @ 2010-06-28 13:40 UTC (permalink / raw)
To: Xen-devel
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.
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?
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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Q] mfn_to_gmfn macro, log-dirty bitmap, 2010-06-28 13:40 [Q] mfn_to_gmfn macro, log-dirty bitmap, Min Lee @ 2010-06-28 13:50 ` Keir Fraser 2010-06-28 14:25 ` Min Lee 2010-06-28 14:32 ` Tim Deegan 1 sibling, 1 reply; 6+ messages in thread From: Keir Fraser @ 2010-06-28 13:50 UTC (permalink / raw) To: Min Lee, Xen-devel@lists.xensource.com On 28/06/2010 14:40, "Min Lee" <min.lee@gatech.edu> wrote: > 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. > 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? > How can I properly do mfn_to_gmfn? For a PV guest, GMFN and MFN are equivalent. -- Keir ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Q] mfn_to_gmfn macro, log-dirty bitmap, 2010-06-28 13:50 ` Keir Fraser @ 2010-06-28 14:25 ` Min Lee 0 siblings, 0 replies; 6+ messages in thread From: Min Lee @ 2010-06-28 14:25 UTC (permalink / raw) To: Xen-devel@lists.xensource.com Hi, thanks, but I don't understand. dinfo->p2m_size:67584, (XEN) addr:bff25000 accessible, mfn:5f8eb, gmfn:5f8eb (XEN) addr:bff26000 accessible, mfn:6e003, gmfn:6e003 (XEN) addr:bff27000 accessible, mfn:425da, gmfn:425da This domain has 256MB ram (67584 frames, slightly more than 65536) as p2m_size indicates, and I have dirty-bit bitmap which I believe has 67584 bits. but In this case above, three frames has mfn of 0x5f8eb, 0x6e003, 0x425da which I cannot use as index in my dirt_bit bitmap. I understand PV guest directly use mfn into page table entry, but regarding log-dirt-bit bitmap, I think I need gmfn index here. Am I misunderstanding something? What I'm doing is to read dirty bit for my virtual frame. so I need know which bit in log-dirty bit corresponds to my virtual frame. Thanks Min On 6/28/2010 9:50 AM, Keir Fraser wrote: > On 28/06/2010 14:40, "Min Lee"<min.lee@gatech.edu> wrote: > >> 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. >> 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? >> How can I properly do mfn_to_gmfn? > > For a PV guest, GMFN and MFN are equivalent. > > -- Keir > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Q] mfn_to_gmfn macro, log-dirty bitmap, 2010-06-28 13:40 [Q] mfn_to_gmfn macro, log-dirty bitmap, Min Lee 2010-06-28 13:50 ` Keir Fraser @ 2010-06-28 14:32 ` Tim Deegan 2010-06-28 14:51 ` Min Lee 1 sibling, 1 reply; 6+ messages in thread From: Tim Deegan @ 2010-06-28 14:32 UTC (permalink / raw) To: Min Lee; +Cc: Xen-devel@lists.xensource.com 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@lists.xensource.com > http://lists.xensource.com/xen-devel -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, XenServer Engineering Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Q] mfn_to_gmfn macro, log-dirty bitmap, 2010-06-28 14:32 ` Tim Deegan @ 2010-06-28 14:51 ` Min Lee 2010-06-28 15:27 ` Tim Deegan 0 siblings, 1 reply; 6+ messages in thread From: Min Lee @ 2010-06-28 14:51 UTC (permalink / raw) To: Xen-devel@lists.xensource.com 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) ? Then what paging_mode_translate(_d) exactly indicates? 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@lists.xensource.com >> http://lists.xensource.com/xen-devel > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Q] mfn_to_gmfn macro, log-dirty bitmap, 2010-06-28 14:51 ` Min Lee @ 2010-06-28 15:27 ` Tim Deegan 0 siblings, 0 replies; 6+ messages in thread From: Tim Deegan @ 2010-06-28 15:27 UTC (permalink / raw) To: Min Lee; +Cc: Xen-devel@lists.xensource.com 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@lists.xensource.com > >> http://lists.xensource.com/xen-devel > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, XenServer Engineering Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-06-28 15:27 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-06-28 13:40 [Q] mfn_to_gmfn macro, log-dirty bitmap, Min Lee 2010-06-28 13:50 ` Keir Fraser 2010-06-28 14:25 ` Min Lee 2010-06-28 14:32 ` Tim Deegan 2010-06-28 14:51 ` Min Lee 2010-06-28 15:27 ` Tim Deegan
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.