* [ Help! ] how is ctx->xch in xen/tools/libxl/xl_cmdimpl.c initialized? @ 2013-04-11 13:06 Li Yechen 2013-04-11 18:41 ` Wei Liu 0 siblings, 1 reply; 5+ messages in thread From: Li Yechen @ 2013-04-11 13:06 UTC (permalink / raw) To: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 801 bytes --] I try to trap the xl command: main_memset() in tools/libxl/xl.h and it goes to do_xen_hypercall(xch, *hypercall) on line 246, xen4.1.2/tools/libxc/xc_private.c this function then call: xch->ops->u.privcmd.hypercall() which is a function pointer the xch is a member of global varible: libxl_ctx *ctx, which is in line66, tools/libxl/xl_cmdimpl.c then I can't find where the function pointer goes to, nor does the place where this function pointer is initialized. Any one is familiar with this variable? Help me please! Thank you very much! -- Yechen Li Team of System Virtualization and Cloud Computing School of Electronic Engineering and Computer Science, Peking University, China Nothing is impossible because impossible itself says: " I'm possible " lccycc From PKU [-- Attachment #1.2: Type: text/html, Size: 2202 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ Help! ] how is ctx->xch in xen/tools/libxl/xl_cmdimpl.c initialized? 2013-04-11 13:06 [ Help! ] how is ctx->xch in xen/tools/libxl/xl_cmdimpl.c initialized? Li Yechen @ 2013-04-11 18:41 ` Wei Liu 2013-04-16 15:17 ` Li Yechen 0 siblings, 1 reply; 5+ messages in thread From: Wei Liu @ 2013-04-11 18:41 UTC (permalink / raw) To: Li Yechen; +Cc: wei.liu2, xen-devel@lists.xen.org On Thu, Apr 11, 2013 at 02:06:58PM +0100, Li Yechen wrote: > I try to trap the xl command: main_memset() in tools/libxl/xl.h > and it goes to do_xen_hypercall(xch, *hypercall) on line 246, xen4.1.2/tools/libxc/xc_private.c > > this function then call: xch->ops->u.privcmd.hypercall() which is a function pointer > the xch is a member of global varible: libxl_ctx *ctx, which is in line66, tools/libxl/xl_cmdimpl.c > > then I can't find where the function pointer goes to, nor does the place where this function pointer is initialized. > Any one is familiar with this variable? Help me please! Thank you very much! > xch is a handle to Xen privcmd. Please look at OS dependent code in libxc such as xc_linux_osdep.c Wei. > -- > Yechen Li > > Team of System Virtualization and Cloud Computing > School of Electronic Engineering and Computer Science, > Peking University, China > > Nothing is impossible because impossible itself says: " I'm possible " > lccycc From PKU > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ Help! ] how is ctx->xch in xen/tools/libxl/xl_cmdimpl.c initialized? 2013-04-11 18:41 ` Wei Liu @ 2013-04-16 15:17 ` Li Yechen 2013-04-16 15:31 ` Wei Liu 2013-04-23 17:23 ` Dario Faggioli 0 siblings, 2 replies; 5+ messages in thread From: Li Yechen @ 2013-04-16 15:17 UTC (permalink / raw) To: Wei Liu; +Cc: Dario Faggioli, xen-devel@lists.xen.org [-- Attachment #1.1: Type: text/plain, Size: 2194 bytes --] Thank you very much! I find the function pointer point to : .u.privcmd.hypercall = &linux_privcmd_hypercall on Line 423 but this function:linux_privcmd_hypercall() in xen4.2.1/tools/libxc/xc_linux _osdep.c, Line 113 goes to a python script: xen4.2.1/tools/python/xen/util/SSHTransport.py, Line 26 then it seems to call a function name lwip_ioctl: > return lwip_ioctl(files[fd],socket.fd, FIONBIO, &nblock); this function does not belong to xen I just want to find out how xl comnand works, does it actually call this function? The code of Xen of this part have no any commons..It's too hard to understand. Help me please Orz On Fri, Apr 12, 2013 at 2:41 AM, Wei Liu <wei.liu2@citrix.com> wrote: > On Thu, Apr 11, 2013 at 02:06:58PM +0100, Li Yechen wrote: > > I try to trap the xl command: main_memset() in tools/libxl/xl.h > > and it goes to do_xen_hypercall(xch, *hypercall) on line 246, > xen4.1.2/tools/libxc/xc_private.c > > > > this function then call: xch->ops->u.privcmd.hypercall() which is a > function pointer > > the xch is a member of global varible: libxl_ctx *ctx, which is in > line66, tools/libxl/xl_cmdimpl.c > > > > then I can't find where the function pointer goes to, nor does the place > where this function pointer is initialized. > > Any one is familiar with this variable? Help me please! Thank you very > much! > > > > xch is a handle to Xen privcmd. Please look at OS dependent code in > libxc such as xc_linux_osdep.c > > > Wei. > > > -- > > Yechen Li > > > > Team of System Virtualization and Cloud Computing > > School of Electronic Engineering and Computer Science, > > Peking University, China > > > > Nothing is impossible because impossible itself says: " I'm possible " > > lccycc From PKU > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xen.org > > http://lists.xen.org/xen-devel > > -- Yechen Li Team of System Virtualization and Cloud Computing School of Electronic Engineering and Computer Science, Peking University, China Nothing is impossible because impossible itself says: " I'm possible " lccycc From PKU [-- Attachment #1.2: Type: text/html, Size: 4331 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ Help! ] how is ctx->xch in xen/tools/libxl/xl_cmdimpl.c initialized? 2013-04-16 15:17 ` Li Yechen @ 2013-04-16 15:31 ` Wei Liu 2013-04-23 17:23 ` Dario Faggioli 1 sibling, 0 replies; 5+ messages in thread From: Wei Liu @ 2013-04-16 15:31 UTC (permalink / raw) To: Li Yechen; +Cc: Dario Faggioli, Wei Liu, xen-devel@lists.xen.org Please don't top-post. On Tue, Apr 16, 2013 at 04:17:46PM +0100, Li Yechen wrote: > Thank you very much! > I find the function pointer point to : > .u.privcmd.hypercall = &linux_privcmd_hypercall on Line 423 > > but this function:linux_privcmd_hypercall() in xen4.2.1/tools/libxc/xc_linux_osdep.c, Line 113 > goes to a python script: > xen4.2.1/tools/python/xen/util/SSHTransport.py, Line 26 > then it seems to call a function name lwip_ioctl: > > return lwip_ioctl(files[fd],socket.fd, FIONBIO, &nblock); > this function does not belong to xen > It looks like your indexing utility screwed you. That's not a funciton, is a structure defined in the same file. That structure contains a bunch of function pointers. Wei. > I just want to find out how xl comnand works, does it actually call this function? > The code of Xen of this part have no any commons..It's too hard to understand. > Help me please Orz > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ Help! ] how is ctx->xch in xen/tools/libxl/xl_cmdimpl.c initialized? 2013-04-16 15:17 ` Li Yechen 2013-04-16 15:31 ` Wei Liu @ 2013-04-23 17:23 ` Dario Faggioli 1 sibling, 0 replies; 5+ messages in thread From: Dario Faggioli @ 2013-04-23 17:23 UTC (permalink / raw) To: Li Yechen; +Cc: Wei Liu, xen-devel@lists.xen.org [-- Attachment #1.1: Type: text/plain, Size: 2663 bytes --] On mar, 2013-04-16 at 23:17 +0800, Li Yechen wrote: > Thank you very much! > I find the function pointer point to : > .u.privcmd.hypercall = &linux_privcmd_hypercall on Line 423 > > [snip] > > I just want to find out how xl comnand works, does it actually call > this function? > The code of Xen of this part have no any commons..It's too hard to > understand. > Ok (first, sorry for the delay), you said you're interested in what main_memset(), in xl_cmdimpl.c, end up doing at the hypervisor level, right? Up to what I can see, the call chain is this: main_memset() [tools/libxl/xl_cmdimpl.c] | --> set_memory_target() [tools/libxl/xl_cmdimpl.c] | --> xc_domain_setmaxmem() ? xc_domain_set_pod_target() [tools/libxl/libxl.c] | --> xc_domain_setmaxmem() [tools/libxc/xc_domain.c]: domctl.cmd = XEN_DOMCTL_max_mem; domctl.u.max_mem.max_memkb = max_memkb; return do_domctl(xch, &domctl); So, here is when the hypercall is invoked (Assuming that you're interested in the path that calls xc_domain_setmaxmem, otherwise, the hypercall invoked within xc_domain_set_pod_target() is XENMEM_set_pod_target). Now, when looking for XEN_DOMCTL_max_mem, consider the reference to it that can be found in xen/common/domctl.c at (around) line 886: case XEN_DOMCTL_max_mem: { unsigned long new_max; ret = -EINVAL; new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT-10); spin_lock(&d->page_alloc_lock); /* * NB. We removed a check that new_max >= current tot_pages; this means * that the domain will now be allowed to "ratchet" down to new_max. In * the meantime, while tot > max, all new allocations are disallowed. */ d->max_pages = new_max; ret = 0; spin_unlock(&d->page_alloc_lock); } break; And this is it. As Wei was telling you, how the hypercall is actually issued is what the OS dependent code does with all those functions pointer you found. OTOH, when you're interested in knowing _what_ an hypercall actually does, I'd dare to recommend digging until you find the hypercall name (in this case XEN_DOMCTL_max_mem) and then grep-ing/cscope-ing it directly in the hypervisor code. Does that help? :-) 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) [-- Attachment #1.2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 198 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-23 17:23 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-11 13:06 [ Help! ] how is ctx->xch in xen/tools/libxl/xl_cmdimpl.c initialized? Li Yechen 2013-04-11 18:41 ` Wei Liu 2013-04-16 15:17 ` Li Yechen 2013-04-16 15:31 ` Wei Liu 2013-04-23 17:23 ` Dario Faggioli
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.