Add DOM0_GETDOMAININFOLIST op for bulk retrieval of domain info
PATCH 1/1 Add DOM0_GETDOMAININFOLIST op for bulk retrieval of domain info
The attached patch adds a new dom0_op, DOM0_GETDOMAININFOLIST. This operation allows retrieval of the domain info structures for all domains in one hypercall.
Using a small test program, on a system with 97 domains with non-contiguous domain IDs, I found that with this hypercall I could retrieve the full array of info structures 12840 times per second, an improvement from 2380 times per second with the DOM0_GETDOMAININFO op.
The patch also adds a libxc wrapper for this new hypercall.
- Josh Triplett
tools/libxc/xc_domain.c +27 -0
@@ -123,6 +123,33 @@return nr_doms; } +int xc_domain_getinfolist (int xc_handle, +u32 first_domain, +unsigned int max_domains, +xc_domaininfo_t *info) +{ +int ret =0 ; +dom0_op_t op; + +if (mlock (info, max_domains*sizeof (xc_domaininfo_t)) !=0 ) +return -1 ; + + op.cmd =DOM0_GETDOMAININFOLIST ; + op.u.getdomaininfolist.first_domain = first_domain; + op.u.getdomaininfolist.max_domains = max_domains; + op.u.getdomaininfolist.buffer = info; + +if (xc_dom0_op (xc_handle, &op) <0 ) + ret =-1 ; +else + ret = op.u.getdomaininfolist.num_domains; + +if (munlock (info, max_domains*sizeof (xc_domaininfo_t)) !=0 ) + ret =-1 ; + +return ret; +} + int xc_domain_get_vcpu_context(int xc_handle, u32 domid, u32 vcpu,
tools/libxc/xc.h +18 -0
@@ -191,6 +191,24 @@ xc_dominfo_t *info);/** +* This function will return information about one or more domains, using a +* single hypercall. The domain information will be stored into the supplied +* array of xc_domaininfo_t structures. +* +* @parm xc_handle a handle to an open hypervisor interface +* @parm first_domain the first domain to enumerate information from. +* Domains are currently enumerate in order of creation. +* @parm max_domains the number of elements in info +* @parm info an array of max_doms size that will contain the information for +* the enumerated domains. +* @return the number of domains enumerated or -1 on error +*/ +int xc_domain_getinfolist (int xc_handle, +u32 first_domain, +unsigned int max_domains, +xc_domaininfo_t *info); + +/** * This function returns information about one domain. This information is * more detailed than the information from xc_domain_getinfo(). *
xen/common/dom0_ops.c +102 -52
178 lines not on this page · raw message
xen/include/public/dom0_ops.h +12 -1
@@ -19,7 +19,7 @@* This makes sure that old versions of dom0 tools will stop working in a * well-defined way (rather than crashing the machine, for instance). */ -#define DOM0_INTERFACE_VERSION 0xAAAA1007 +#define DOM0_INTERFACE_VERSION 0xAAAA1008/************************************************************************/
@@ -355,6 +355,16 @@u64 cpu_time; } dom0_getvcpucontext_t; +#define DOM0_GETDOMAININFOLIST 38 +typedef struct { +/* IN variables. */ +domid_t first_domain; +memory_t max_domains; +dom0_getdomaininfo_t *buffer; +/* OUT variables. */ +memory_t num_domains; +}dom0_getdomaininfolist_t ; + typedef struct { u32 cmd; u32 interface_version; /* DOM0_INTERFACE_VERSION */
@@ -387,6 +397,7 @@dom0_microcode_t microcode;dom0_ioport_permission_t ioport_permission;dom0_getvcpucontext_t getvcpucontext; +dom0_getdomaininfolist_t getdomaininfolist; } u; } dom0_op_t;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 10 lines · Josh Triplett
The attached patch adds a new
dom0_op,DOM0_GETDOMAININFOLIST. This operation allows retrieval of the domain info structures for all domains in one hypercall.Using a small test program, on a system with 97 domains with non-contiguous domain IDs, I found that with this hypercall I could retrieve the full array of info structures 12840 times per second, an improvement from 2380 times per second with the
DOM0_GETDOMAININFOop.The patch also adds a libxc wrapper for this new hypercall.
Forgot to add that this patch is
- Josh Triplett