mfn_to_gmfn macro, log-dirty bitmap,
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
Quoted 9 lines · Min Lee
I'm running 32bit PV-domu on 64bit xen&dom0 and I'm using
XEN_DOMCTL_SHADOW_OP_PEEKto get log-dirty bitmap.
First, I'm assuming this bitmap is indexed by gmfn, right? because we're passingp2m->sizeparameter 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 triedmfn_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 domfn_to_gmfn?
For a PV guest, GMFN and MFN are equivalent.
-- Keir
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
Quoted 18 lines · Keir Fraser
Quoted 9 lines · Min Lee
I'm running 32bit PV-domu on 64bit xen&dom0 and I'm using
XEN_DOMCTL_SHADOW_OP_PEEKto get log-dirty bitmap.
First, I'm assuming this bitmap is indexed by gmfn, right? because we're passingp2m->sizeparameter 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 triedmfn_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 domfn_to_gmfn?For a PV guest, GMFN and MFN are equivalent.
-- Keir
Hi,
Quoted 5 lines · Min Lee
Hi, folks.
I'm running 32bit PV-domu on 64bit xen&dom0 and I'm usingXEN_DOMCTL_SHADOW_OP_PEEKto get log-dirty bitmap.
First, I'm assuming this bitmap is indexed by gmfn, right? because we're passingp2m->sizeparameter 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).
Quoted 4 lines
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.
Quoted 15 lines
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
[email protected]
http://lists.xensource.com/xen-devel
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, XenServer Engineering Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
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
Quoted 43 lines · Tim Deegan
Hi,
Quoted 5 lines · Min Lee
Hi, folks.
I'm running 32bit PV-domu on 64bit xen&dom0 and I'm usingXEN_DOMCTL_SHADOW_OP_PEEKto get log-dirty bitmap.
First, I'm assuming this bitmap is indexed by gmfn, right? because we're passingp2m->sizeparameter 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.hfor an explanation of the *fn terminology, and the confusion around "gmfn" in particular).Quoted 4 lines
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_gmfnmacro 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 callget_gpfn_from_mfn()directly.Cheers,
Tim.
Quoted 15 lines
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
[email protected]
http://lists.xensource.com/xen-devel
Quoted 4 lines · Min Lee
Thanks! now it gives me good numbers. seems to be working.
I thought M2P table is somehow enabled/disabled bypaging_mode_translate(_d)... So, does it mean M2P is working always regardless ofpaging_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.
Quoted 1 line
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.
Quoted 52 lines
Thanks a lot!
MinQuoted 18 lines · Tim Deegan
Hi,
Quoted 5 lines · Min Lee
Hi, folks.
I'm running 32bit PV-domu on 64bit xen&dom0 and I'm usingXEN_DOMCTL_SHADOW_OP_PEEKto get log-dirty bitmap.
First, I'm assuming this bitmap is indexed by gmfn, right? because we're passingp2m->sizeparameter 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.hfor an explanation of the *fn terminology, and the confusion around "gmfn" in particular).Quoted 4 lines
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?Quoted 25 lines
The
mfn_to_gmfnmacro 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 callget_gpfn_from_mfn()directly.Cheers,
Tim.
Quoted 15 lines
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
[email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, XenServer Engineering Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)