I am learning xen's memory management recently. I find most docs is how to use the hypercall related memory management. Can somesome tell me where is the implementation of the them in the xen source. Or some docs explaining it will be ideal. 年少不惧江湖老,放歌四海任逍遥。未解前路多少事,欲与青天试比高。 _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
On Tue, 2013-12-10 at 13:58 +0800, 张云霄 wrote:> I am learning xen's memory management recently. I find most docs is > how to use the hypercall related memory management. Can somesome tell > me where is the implementation of the them in the xen source.Have you tried using e.g. grep? Ian. _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
Thankyou for your reply! I use vim + ctags. I have tagged, but get this: static inline int HYPERVISOR_mmu_update( mmu_update_t *req, int count, int *success_count, domid_t domid) { return _hypercall4(int, mmu_update, req, count, success_count, domid); } and this: #define _hypercall4(type, name, a1, a2, a3, a4) \ ({ \ long __res, __ign1, __ign2, __ign3; \ asm volatile ( \ "movq %7,%%r10; " \ "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\ : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ "=d" (__ign3) \ : "1" ((long)(a1)), "2" ((long)(a2)), \ "3" ((long)(a3)), "g" ((long)(a4)) \ : "memory", "r10" ); \ (type)__res; \ }) But what's the content (src code) of hypercall_page? How is the hypercall implemented? _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
On Tue, 2013-12-10 at 18:55 +0800, 张云霄 wrote:> But what's the content (src code) of hypercall_page? > How is the hypercall implemented?You need to be looking on the hypervisor side for that. It is a page of code which is mapped into the guest kernel and contains the necessary instructions (int 0x82, syscall, vmcall, etc) depending on the guest type etc. For a PV guest it is populated by the Xen tools asking the hypervisor to do so during guest build and for a PVHVM guest it is populated by the guest writing to a special MSR, see enlighten.c in the Linux kernel, specifically init_hvm_pv_info(). Ian. _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
I talked about PV. I know the hypercall's implementation mechanism, but hypercall's call tree. From the book, The Definitive Guide to Xen Hypervisor, I known that the "generic builder" will automatically map the hypercall page at one page indicated by the key "HYPERCALL_PAGE" in the guest kernel elf's section "__xen_guest " into the guest os' address space. I have searched the Xen source code. I can't find the hypercall page's source code. Where is it? In addition, The book mentioned above describes xen' internals well mainly in English. In order to know Xen exactly, I think I must read Xen's source code. Is there some resource(book, blog, paper, etc) descriping Xen hypervisor mainly in C language. I need a start point in Xen's source code to explore Xen hypervisor or a path through it. Do you have some suggestion ? Thangks. Cloud Zhang. 年少不惧江湖老,放歌四海任逍遥。未解前路多少事,欲与青天试比高。 在2013年12月10 19时01分,"Ian Campbell"<Ian.Campbell@citrix.com>写道: On Tue, 2013-12-10 at 18:55 +0800, 张云霄 wrote:> But what's the content (src code) of hypercall_page? > How is the hypercall implemented?You need to be looking on the hypervisor side for that. It is a page of code which is mapped into the guest kernel and contains the necessary instructions (int 0x82, syscall, vmcall, etc) depending on the guest type etc. For a PV guest it is populated by the Xen tools asking the hypervisor to do so during guest build and for a PVHVM guest it is populated by the guest writing to a special MSR, see enlighten.c in the Linux kernel, specifically init_hvm_pv_info(). Ian. _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
On Tue, 2013-12-10 at 20:46 +0800, 张云霄 wrote:> > I talked about PV. > > I know the hypercall's implementation mechanism, but hypercall's call > tree. > > From the book, The Definitive Guide to Xen Hypervisor, I known that > the "generic builder" will automatically map the hypercall page at one > page indicated by the key "HYPERCALL_PAGE" in the guest kernel elf's > section "__xen_guest " into the guest os' address space. I have > searched the Xen source code. I can't find the hypercall page's source > code. Where is it?If you had grepped for "hypercall_page" in the hypervisor source code then you would have found hypercall_page_initialise_*.> In addition, The book mentioned above describes xen' internals well > mainly in English. In order to know Xen exactly, I think I must read > Xen's source code. Is there some resource(book, blog, paper, etc) > descriping Xen hypervisor mainly in C language.The code itself is in C. I'm not aware of any books etc "mainly in C language".> I need a start point in Xen's source code to explore Xen hypervisor > or a path through it. Do you have some suggestion ? Thangks.grep, less, vim or emacs depending on your preference. Ian. _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users