[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Scheduling groups, domctrl operation to manage scheduling groups



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 <ncmike@xxxxxxxxxx>

--
 common/domctl.c         |    6 ++++++
 common/schedule.c       |    8 ++++++++
 include/public/domctl.h |   25 +++++++++++++++++++++++++
 include/xen/sched-if.h  |    1 +
 include/xen/sched.h     |    1 +
 5 files changed, 41 insertions(+)

--

diff -r e10eacec8b91 xen/common/domctl.c
--- a/xen/common/domctl.c       Wed Nov 28 22:36:33 2007 +0000
+++ b/xen/common/domctl.c       Thu Nov 29 12:24:22 2007 -0500
@@ -482,6 +482,12 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( ret )
             goto scheduler_op_out;
 
+        if ( op->u.scheduler_op.cmd == XEN_DOMCTL_SCHEDOP_group ) {
+            rcu_unlock_domain(d);
+            ret = sched_group_op(&op->u.scheduler_op.u.group);
+            break;
+        }
+        
         ret = sched_adjust(d, &op->u.scheduler_op);
         if ( copy_to_guest(u_domctl, op, 1) )
             ret = -EFAULT;
diff -r e10eacec8b91 xen/common/schedule.c
--- a/xen/common/schedule.c     Wed Nov 28 22:36:33 2007 +0000
+++ b/xen/common/schedule.c     Thu Nov 29 12:16:00 2007 -0500
@@ -549,6 +549,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 e10eacec8b91 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Wed Nov 28 22:36:33 2007 +0000
+++ b/xen/include/public/domctl.h       Thu Nov 29 12:16:00 2007 -0500
@@ -294,6 +294,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_* */
@@ -309,6 +325,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 e10eacec8b91 xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h        Wed Nov 28 22:36:33 2007 +0000
+++ b/xen/include/xen/sched-if.h        Thu Nov 29 12:16:00 2007 -0500
@@ -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 e10eacec8b91 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Wed Nov 28 22:36:33 2007 +0000
+++ b/xen/include/xen/sched.h   Thu Nov 29 12:16:00 2007 -0500
@@ -377,6 +377,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@xxxxxxxxxx | AIM: ncmikeday | Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.