Add a sub-operation to the domctrl scheduling-op hypercall. This new sub op allows the adminstrator to designate domains as group masters or group members (and to remove domains from groups and demote masters). Each scheduler (credit, sedf, etc.) may implement routines to handle this new sub op. Signed-off-by: Mike D. Day <mdday@us.ibm.com> -- common/domctl.c | 18 +++++++++++------- common/schedule.c | 8 ++++++++ include/public/domctl.h | 25 +++++++++++++++++++++++++ include/xen/sched-if.h | 1 + include/xen/sched.h | 1 + 5 files changed, 46 insertions(+), 7 deletions(-) -- diff -r 3ef0510e44d0 xen/common/domctl.c --- a/xen/common/domctl.c Tue May 08 10:21:23 2007 +0100 +++ b/xen/common/domctl.c Tue May 08 09:46:15 2007 -0400 @@ -447,15 +447,19 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc { struct domain *d; - ret = -ESRCH; - if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL ) - break; - - ret = sched_adjust(d, &op->u.scheduler_op); + if ( op->u.scheduler_op.cmd == XEN_DOMCTL_SCHEDOP_group ) + ret = sched_group_op(&op->u.scheduler_op.u.group); + else + { + ret = -ESRCH; + if ( ( d = rcu_lock_domain_by_id(op->domain) ) == NULL ) + break; + ret = sched_adjust(d, &op->u.scheduler_op); + rcu_unlock_domain(d); + } + if ( copy_to_guest(u_domctl, op, 1) ) ret = -EFAULT; - - rcu_unlock_domain(d); } break; diff -r 3ef0510e44d0 xen/common/schedule.c --- a/xen/common/schedule.c Tue May 08 10:21:23 2007 +0100 +++ b/xen/common/schedule.c Tue May 08 09:48:05 2007 -0400 @@ -530,6 +530,14 @@ int sched_id(void) return ops.sched_id; } +int sched_group_op(struct xen_domctl_group *op) +{ + if ( ops.group_op ) + return ops.group_op(op); + return -EINVAL; +} + + /* Adjust scheduling parameter for a given domain. */ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op) { diff -r 3ef0510e44d0 xen/include/public/domctl.h --- a/xen/include/public/domctl.h Tue May 08 10:21:23 2007 +0100 +++ b/xen/include/public/domctl.h Wed May 09 16:41:18 2007 -0400 @@ -291,6 +291,22 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_v /* Set or get info? */ #define XEN_DOMCTL_SCHEDOP_putinfo 0 #define XEN_DOMCTL_SCHEDOP_getinfo 1 +#define XEN_DOMCTL_SCHEDOP_group 2 + +#define SGRP_get_status 1 +#define SGRP_get_master 2 +#define SGRP_del_member 3 +#define SGRP_add_member 4 + + +/* reason codes for u.sdom.reason */ +#define SGRP_err_no_reason 0 +#define SGRP_err_already_member 1 +#define SGRP_err_already_master 2 +#define SGRP_err_same_id 3 +#define SGRP_err_not_member 4 +#define SGRP_err_inval 5 + struct xen_domctl_scheduler_op { uint32_t sched_id; /* XEN_SCHEDULER_* */ uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */ @@ -306,6 +322,15 @@ struct xen_domctl_scheduler_op { uint16_t weight; uint16_t cap; } credit; + struct xen_domctl_group + { + uint16_t op; + uint16_t reason; + uint8_t is_master; + uint8_t is_member; + domid_t id_master; + domid_t id_member; + } group __attribute__ (( aligned )); } u; }; typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t; diff -r 3ef0510e44d0 xen/include/xen/sched-if.h --- a/xen/include/xen/sched-if.h Tue May 08 10:21:23 2007 +0100 +++ b/xen/include/xen/sched-if.h Tue May 08 09:43:16 2007 -0400 @@ -73,6 +73,7 @@ struct scheduler { struct task_slice (*do_schedule) (s_time_t); int (*pick_cpu) (struct vcpu *); + int (*group_op) (struct xen_domctl_group *); int (*adjust) (struct domain *, struct xen_domctl_scheduler_op *); void (*dump_settings) (void); diff -r 3ef0510e44d0 xen/include/xen/sched.h --- a/xen/include/xen/sched.h Tue May 08 10:21:23 2007 +0100 +++ b/xen/include/xen/sched.h Tue May 08 09:55:59 2007 -0400 @@ -370,6 +370,7 @@ void sched_destroy_vcpu(struct vcpu *v); void sched_destroy_vcpu(struct vcpu *v); int sched_init_domain(struct domain *d); void sched_destroy_domain(struct domain *d); +int sched_group_op(struct xen_domctl_group *); long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *); int sched_id(void); void vcpu_wake(struct vcpu *d); -- Mike D. Day Virtualization Architect and Sr. Technical Staff Member, IBM LTC Cell: 919 412-3900 ST: mdday@us.ibm.com | AIM: ncmikeday | Yahoo IM: ultra.runner PGP key: http://www.ncultra.org/ncmike/pubkey.asc _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel