Meng Xu
2013-Nov-22 20:04 UTC
Question about the memory layout of xen hypervisor, dom0 and domU
Hi, I have a question about the memory layout of the Xen hypervisor, dom0 and domU. *The goal I want to achieve is: I want to show which RAM area is used by hypervisor, which RAM area is used by dom0, which RAM area is used by each domU (PV guest domain). I hope to know the above information when xen is booted as well as when xen is running some domUs. I already know that we can dedicate a fix size of RAM to dom0 according to ( http://wiki.xen.org/wiki/Xen_Best_Practices). But it''s unclear which RAM area is allocated. I read the paravirtualised memory management on http://wiki.xen.org/wiki/X86_Paravirtualised_Memory_Management; but it only shows the virtual address range of each domain. I also looked at the xen/common/page_alloc.c; I think the function alloc_domheap_pages() is used to allocate machine pages to doms, and alloc_xenheap_pages() is used to allocate machine pages to hypervisor. Maybe I can just print out the machine address when each machine page is allocated and freed. But it seems too nasty. *My question is: Is there any command or tool showing the RAM layout of hypervisor, dom0 and domUs? If not, is there any better way to achieve the goal of showing the RAM layout? For example, if there is any structure I can traverse to get all machine address used by hypervisor, dom0 and domUs, that will be great! Thank you very much for your help and advice! Best, Meng ----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Dario Faggioli
2013-Nov-23 17:13 UTC
Re: Question about the memory layout of xen hypervisor, dom0 and domU
On ven, 2013-11-22 at 15:04 -0500, Meng Xu wrote:> Hi, >Hi,> I have a question about the memory layout of the Xen hypervisor, dom0 > and domU. > > > *The goal I want to achieve is: > I want to show which RAM area is used by hypervisor, which RAM area is > used by dom0, which RAM area is used by each domU (PV guest domain). > > I hope to know the above information when xen is booted as well as > when xen is running some domUs. >Mmm... Where (hypervisor, dom0/domu kernel space, user space) and for what reason you need that? I''m asking because, at some point, I needed a _similar_ information, and wrote this: http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=ae763e4224304983a1cde2fbb3d6e0c4d60b2688 It''s probably not exactly what you mean, but it has the capability of showing who is using some MFNs. The point is I only needed it for debugging/understanding purposes so, if your aim is different, it may not fit. Regards, Dario -- <<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Meng Xu
2013-Dec-12 21:46 UTC
Re: Question about the memory layout of xen hypervisor, dom0 and domU
Hi Dario, Thank you so much for your help and information! It is really helpful!> > I have a question about the memory layout of the Xen hypervisor, dom0 > > and domU. > > > > > > *The goal I want to achieve is: > > I want to show which RAM area is used by hypervisor, which RAM area is > > used by dom0, which RAM area is used by each domU (PV guest domain). > > > > I hope to know the above information when xen is booted as well as > > when xen is running some domUs. > > > Mmm... Where (hypervisor, dom0/domu kernel space, user space) and for > what reason you need that? > >I''m doing research on real time systems, especially on real time scheduling and analysis. I''m considering the cache effect on the scheduling. For example, what is the performance of different scheduling policies when cache effect is considered. As you know, the cache location of a program/domain depends on the memory address of the program/domain, so I''m interested in the memory layout of domains/hypervisor and want to investigate the cache interference among domains and hypervisor.> I''m asking because, at some point, I needed a _similar_ information, and > wrote this: > > > http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=ae763e4224304983a1cde2fbb3d6e0c4d60b2688 > > It''s probably not exactly what you mean, but it has the capability of > showing who is using some MFNs. >The point is I only needed it for debugging/understanding purposes so,> if your aim is different, it may not fit. > >Thank you very much for your pointer! I applied your patch and it works very well for the guest domains! I can dump the pfn->mfn for each guest domain. But I also have several questions about your patch and the output of the program: 1) I can use the command "xen-mfndump dump-p2m 3" to dump dom3''s pfn->mfn; But when I use the command "xen-mfndump dump-p2m 0" to dump the domain 0''s pfn->mfn, it reports error as follows: xc: error: Could not map the shared info frame (MFN 0xcecfd) (3 = No such process): Internal error xc: error: Could not map domain 0 memory information: Internal error Did I miss something if xen-mfndump does have such function. If the xen-mfndump cannot be used to dump the machine address of dom0 and hypervisor, is there any other tool I can use? 2) I found that the page frames that are used as L1 table are not always continuous (some of them are continuous). For example: pfn=0x3844 ==> mfn=0x13d1be (type 0x9) [mapped] [pinned] L1 table pfn=0x3845 ==> mfn=0x13d1bd (type 0x0) [mapped] pfn=0x3846 ==> mfn=0x13d1bc (type 0x0) [mapped] pfn=0x3847 ==> mfn=0x13d1bb (type 0x0) [mapped] pfn=0x3848 ==> mfn=0x13d1ba (type 0x0) [mapped] pfn=0x3849 ==> mfn=0x13d1b9 (type 0x0) [mapped] pfn=0x384a ==> mfn=0x13d1b8 (type 0x0) [mapped] pfn=0x384b ==> mfn=0x13d1b7 (type 0x0) [mapped] pfn=0x384c ==> mfn=0x13d1b6 (type 0x0) [mapped] pfn=0x384d ==> mfn=0x13d1b5 (type 0x0) [mapped] pfn=0x384e ==> mfn=0x13d1b4 (type 0x0) [mapped] pfn=0x384f ==> mfn=0x13d1b3 (type 0x0) [mapped] pfn=0x3850 ==> mfn=0x13d1b2 (type 0x9) [mapped] [pinned] L1 table I don''t quite understand the reason why the page frames that are used as L1 table are not continuous. In my understanding, the memory allocation will try to allocate a bulk of memory first instead of distribute them. I think I must misunderstand something. Could you help me point it out? Thank you so much for your help! Best, Meng ----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania www.cis.upenn.edu/~mengxu/ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Reasonably Related Threads
- [xen-unstable bisection] complete build-i386
- Error getting mfn
- Doubt regarding virtual memory mapping from hypervisor to a domain
- [PATCH] xen/grant-table: Refactor gnttab_[un]map_refs to avoid m2p_override
- [PATCH] xen/grant-table: Refactor gnttab_[un]map_refs to avoid m2p_override