Domain Groups: libxc handlers for group data
PATCH 3/8 Domain Groups: libxc handlers for group data
libxc:
Augment libxc framework to shuttle group data and commands between xend and the VMM.
tools/libxc/Makefile +1 -0
@@ -7,6 +7,7 @@ CTRL_SRCS-y := CTRL_SRCS-y := CTRL_SRCS-y += xc_core.c CTRL_SRCS-y += xc_domain.c +CTRL_SRCS-y += xc_domain_group.c CTRL_SRCS-y += xc_evtchn.c CTRL_SRCS-y += xc_misc.c CTRL_SRCS-y += xc_acm.c
tools/libxc/xc_domain.c +4 -0
@@ -191,6 +191,7 @@ int xc_domain_getinfo(int xc_handle, info->crashed =1 ; } + info->grpid = domctl.u.getdomaininfo.group; info->ssidref = domctl.u.getdomaininfo.ssidref; info->nr_pages = domctl.u.getdomaininfo.tot_pages; info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT -10 );
@@ -201,6 +202,9 @@ int xc_domain_getinfo(int xc_handle,memcpy (info->handle, domctl.u.getdomaininfo.handle,sizeof (xen_domain_handle_t)); + +memcpy (info->dg_handle, domctl.u.getdomaininfo.dg_handle, +sizeof (xen_domain_group_handle_t)); next_domid = (uint16_t )domctl.domain +1 ; info++;
tools/libxc/xc_private.h +31 -0
@@ -23,10 +23,12 @@#ifdef VALGRIND #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall = { 0 }#define DECLARE_DOMCTL struct xen_domctl domctl = { 0 } +#define DECLARE_DOMGRPCTL struct xen_domgrpctl domgrpctl = { 0 }#define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 }#else #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall#define DECLARE_DOMCTL struct xen_domctl domctl +#define DECLARE_DOMGRPCTL struct xen_domgrpctl domgrpctl#define DECLARE_SYSCTL struct xen_sysctl sysctl#endif
@@ -118,6 +120,35 @@ static inline int do_domctl(int xc_handlreturn ret; } +static inline int do_domgrpctl (int xc_handle,struct xen_domgrpctl *domgrpctl) +{ +int ret =-1 ; +DECLARE_HYPERCALL ; + + domgrpctl->interface_version =XEN_DOMGRPCTL_INTERFACE_VERSION ; + + hypercall.op = __HYPERVISOR_domgrpctl; + hypercall.arg[0 ] = (unsigned long )domgrpctl; + +if (mlock (domgrpctl,sizeof (*domgrpctl)) !=0 ) + { +PERROR ("Could not lock memory for Xen hypercall" ); + goto out1; + } + +if ( (ret =do_xen_hypercall (xc_handle, &hypercall)) <0 ) + { +if ( errno ==EACCES ) +DPRINTF ("domgrpctl operation failed -- need to" +" rebuild the user-space tool set?\n" ); + } + +safe_munlock (domgrpctl,sizeof (*domgrpctl)); + + out1: +return ret; +} +static inline int do_sysctl (int xc_handle,struct xen_sysctl *sysctl) {int ret =-1 ;
tools/libxc/xenctrl.h +31 -0
@@ -18,6 +18,7 @@#include <stdint.h> #include <xen/xen.h> #include <xen/domctl.h> +#include <xen/domgrpctl.h> #include <xen/sysctl.h> #include <xen/version.h> #include <xen/event_channel.h>
@@ -147,6 +148,7 @@ int xc_waitdomain( typedef struct xc_dominfo { uint32_t domid; + uint32_t grpid; uint32_t ssidref; unsigned int dying:1, crashed:1, shutdown:1, paused:1, blocked:1, running:1,
@@ -159,7 +161,15 @@ typedef struct xc_dominfo {unsigned int nr_online_vcpus;unsigned int max_vcpu_id;xen_domain_handle_t handle; +xen_domain_group_handle_t dg_handle; } xc_dominfo_t; + +typedef struct { +dgid_t dgid; +uint16_t size; +domid_t member_list[MAX_GROUP_SIZE ]; +xen_domain_group_handle_t handle; +}xc_grpinfo_t ;typedef xen_domctl_getdomaininfo_t xc_domaininfo_t ; int xc_domain_create(int xc_handle,
@@ -292,6 +302,27 @@ int xc_domain_getinfo(int xc_handle,unsigned int max_doms, xc_dominfo_t *info); +int xc_domain_group_getinfo (int xc_handle, +uint32_t first_dgid, +unsigned int max_grps, +xc_grpinfo_t *info); + +int xc_domain_group_create (int xc_handle, +xen_domain_group_handle_t handle, +uint32_t *pdgid); + +int xc_domain_group_pause (int xc_handle, +uint32_t dgid); + +int xc_domain_group_unpause (int xc_handle, +uint32_t dgid); + +int xc_domain_group_destroy (int xc_handle, +uint32_t dgid); + +int xc_domain_group_join (int xc_handle, +uint32_t domid, +uint32_t dgid);/** * This function will set the execution context for the specified vcpu.
tools/python/xen/lowlevel/xc/xc.c +217 -24
336 lines not on this page · raw message
tools/libxc/xc_domain_group.c new file +100 -0
100 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel