Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I understand that xen allocates all the physical memory requirement of the guest when started. Also it maintain a shadowing page table (I'm assuming it uses struct page_info to maintain this. Am I correct? If not can anyone explain?) which I wish to access because I need to traverse that list checking whether the guest to which this page is assigned has atleast accessed it once.

Can anyone explain me how I can acheive this?

share|improve this question

1 Answer 1

Ravi,

To answer your question, I am assuming you want to modify the hypervisor source code and that you are an experienced Linux kernel coder. If you do not have experience with kernel coding, then you should probably first try a simpler kernel coding project to gain some experience. Explaining how to modify the Xen shadow memory code is beyond the scope of AskUbuntu. The answer will certainly not fit one of these replies. What you want to do is very complicated.

First of all, struct page_info is not a list. It is a building block abstract data type that is used in more than one list in the Xen hypervisor. So please tell us which list you are looking at that uses page_info.

As you have already seen, there is a reference count in a page_info structure, but it cannot be used to directly to do what you want, AFAIK. The back pointer _domain that you see as part of the page_info struct is only defined for pages not being used as shadow pages.

Xen can be configured to do what you say, allocate all memory when the guest is started, but it can also be configured to use ballooning and allocate memory later, both up and down. To learn about balloon driver and this kind of memory allocation, see the Xen wiki at http://wiki.xen.org/wiki/Main_Page.

There is also a feature called transcendental memory, referred to as "tmem" in the source. If configured to use tmem, Xen will take memory away from a guest that is not using it, to give it to another guest that needs it more. So there is more work if you want to modify the Xen hypervisor to track guest access of all shadow memory, running in all possible memory management modes.

If you are not kernel coding but just trouble shooting, you can connect a serial terminal to the hardware that is running Xen (see the Xen wiki for how to do that) to see memory usage. Once you have the serial terminal running correctly you can not only talk to dom0 but by hitting Ctrl-A 3 times, you can talk to the hypervisor directly. Keypress 'h' to get a help list of commands.

Sincerely,

Segfaultreloaded

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.