Scheduling groups, tool support
PATCH 1/1 Scheduling groups, tool support
Updates the tools directory for Scheduling Group support. There are 3 programs updated: libxc, xend, xm.
These changes have been tested and are known to work on earlier -unstable changesets. However, after updtates to xen-unstable on May 3, the sched-group command started failing in xend with an attribute error. I haven't been able to diagnose the failure. I have found no other xm or xend functions are regressed.
The libxc updates in this patch are necessary to test scheduling groups with the the sched-group utility (patch 4/4).
--
tools/libxc/xc_domain.c | 78 ++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 37 ++++++++++++++ tools/python/xen/xend/XendDomain.py | 59 ++++++++++++++++++++++ tools/python/xen/xend/server/SrvDomain.py | 21 ++++++++ tools/python/xen/xm/main.py | 59 ++++++++++++++++++++++ xen/include/public/domctl.h | 2 6 files changed, 255 insertions(+), 1 deletion(-)
--
tools/libxc/xc_domain.c +78 -0
@@ -696,6 +696,84 @@ int xc_get_hvm_param(int handle, domid_treturn rc; } +int xc_add_member (int handle,domid_t member,domid_t master,uint16_t *reason) +{ +int ret; + +DECLARE_DOMCTL ; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_group; + domctl.u.scheduler_op.u.group.op = SGRP_add_member; + domctl.u.scheduler_op.u.group.id_member = member; + domctl.u.scheduler_op.u.group.id_master = master; + ret =do_domctl (handle, &domctl); +if (ret <0 && reason) + *reason = domctl.u.scheduler_op.u.group.reason; +return ret; +} + +int xc_del_member (int handle,domid_t member,domid_t master,uint16_t *reason) +{ +int ret; + +DECLARE_DOMCTL ; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_group; + domctl.u.scheduler_op.u.group.op = SGRP_del_member; + domctl.u.scheduler_op.u.group.id_member = member; + domctl.u.scheduler_op.u.group.id_master = master; + ret =do_domctl (handle, &domctl); +if ( ret <0 && reason ) + *reason = domctl.u.scheduler_op.u.group.reason; +return ret; +} + +int xc_get_master (int handle,domid_t member,domid_t *master) +{ +int ret; +DECLARE_DOMCTL ; + +if ( master ==NULL ) +return -EINVAL ; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_group; + domctl.u.scheduler_op.u.group.op = SGRP_get_master; + domctl.u.scheduler_op.u.group.id_member = member; + ret =do_domctl (handle, &domctl); +if ( ret >=0 ) + *master = domctl.u.scheduler_op.u.group.id_master; +return ret; + +} + + +int xc_group_get_status (int handle,struct xen_domctl_group *group) +{ +int ret; +DECLARE_DOMCTL ; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_group; + domctl.u.scheduler_op.u.group.op = SGRP_get_status; + domctl.u.scheduler_op.u.group.id_master = group->id_master; + ret =do_domctl (handle, &domctl); + +if ( ret ==0 ) + { + group->reason = domctl.u.scheduler_op.u.group.reason; + group->is_master = domctl.u.scheduler_op.u.group.is_master; + group->is_member = domctl.u.scheduler_op.u.group.is_member; + group->id_master = domctl.u.scheduler_op.u.group.id_master; + group->id_member = domctl.u.scheduler_op.u.group.id_member; + } + +return ret; + +} +/* * Local variables: * mode: C
tools/libxc/xenctrl.h +37 -0
@@ -843,6 +843,43 @@ int xc_set_hvm_param(int handle, domid_tint xc_set_hvm_param (int handle,domid_t dom,int param,unsigned long value);int xc_get_hvm_param (int handle,domid_t dom,int param,unsigned long *value); +/** +* Adds an activation domain to a scheduling domain. +* The activation domain must not already be in a different scheduling domain, +* and the scheduling domain must not already be an activation domain. +* +* @parm member the domain that will be added as a member to the group +* @parm master the domain that will be the master of the group +* @parm reason holds the detailed return code in case of error +*/ +int xc_add_member (int handle,domid_t member,domid_t master,uint16_t *reason); + +/** +* Removes an activation domain from a scheduling domain. +* +* @parm member the domain that will be removed from the group +* @parm master from which the domain will be removed +* @parm reason holds the detailed return code in case of error +*/ +int xc_del_member (int handle,domid_t member,domid_t master,uint16_t *reason); + +/** +* Returns the group master for a member domain +* +* @parm member domain +* @parm master pointer to the location which will hold the return value +*/ +int xc_get_master (int handle,domid_t member,domid_t *master); + +/** +* Returns the scheduling domain flags of an sdom or adom +* +* @parm dom the domain, which must be either an activation domain +* or a scheduling domain. +* @parm flags location to hold the return value +*/ +int xc_group_get_status (int handle,struct xen_domctl_group *group); +/* PowerPC specific. */ int xc_alloc_real_mode_area(int xc_handle, uint32_t domid,
tools/python/xen/xend/XendDomain.py +59 -0
65 lines not on this page · raw message
tools/python/xen/xend/server/SrvDomain.py +21 -0
@@ -156,6 +156,27 @@ class SrvDomain(SrvDir): fn = FormFn(self.xd.domain_sched_credit_set, [['dom', 'int'], ['weight', 'int']]) + val = fn(req.args, {'dom': self.dom.domid}) + return val + + + def op_domain_add_member(self, _, req): + fn = FormFn(self.xd.domain_add_adom, + [['adom', 'int'], + ['sdom', 'int']]) + val = fn(req.args, {'dom': self.dom.domid}) + return val + + def op_domain_del_member(self, _, req): + fn = FormFn(self.xd.domain_del_adom, + [['adom', 'int'], + ['sdom', 'int']]) + val = fn(req.args, {'dom': self.dom.domid}) + return val + + def op_domain_get_master(self, _, req): + fn = FormFn(self.xd.domain_get_sdom, + [['adom', 'int']]) val = fn(req.args, {'dom': self.dom.domid}) return val
tools/python/xen/xm/main.py +59 -0
89 lines not on this page · raw message
xen/include/public/domctl.h +1 -1
@@ -299,7 +299,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_v#define SGRP_add_member 4 -/* reason codes for u.sdom.reason */ +/* reason codes for u.group.reason */ #define SGRP_err_no_reason 0#define SGRP_err_already_member 1#define SGRP_err_already_master 2
Signature · 5 lines
Mike D. Day Virtualization Architect and Sr. Technical Staff Member, IBM LTC Cell: 919 412-3900 ST: [email protected] | AIM: ncmikeday | Yahoo IM: ultra.runner PGP key: http://www.ncultra.org/ncmike/pubkey.asc
Hi,
Quoted 2 lines · Mike D. Day, le Thu 29 Nov 2007 15:22:52 -0500, a écrit :
However, after updtates to xen-unstable on May 3, the sched-group command started failing in xend with an attribute error.
This is because your additional functions in libxc/xc_domain.c don't fill domctl.domain, which hence remains random, while xen checks that this is a valid domain ID.
Samuel