WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Added new simple EDF scheduler

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Added new simple EDF scheduler
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Mon, 17 Jan 2005 13:38:54 +0000
Delivery-date: Mon, 09 May 2005 18:03:16 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1159.221.1, 2005/01/17 13:38:54+00:00, sd386@xxxxxxxxxxxxxxxxx

        Added new simple EDF scheduler



 tools/libxc/Makefile                      |    1 
 tools/libxc/xc.h                          |    8 
 tools/libxc/xc_sedf.c                     |   45 ++
 tools/python/xen/lowlevel/xc/xc.c         |   64 +++
 tools/python/xen/xend/XendClient.py       |    6 
 tools/python/xen/xend/XendDomain.py       |   18 +
 tools/python/xen/xend/server/SrvDomain.py |    8 
 tools/python/xen/xm/main.py               |   17 +
 xen/common/sched_sedf.c                   |  505 ++++++++++++++++++++++++++++++
 xen/common/schedule.c                     |    4 
 xen/include/public/sched_ctl.h            |   10 
 11 files changed, 685 insertions(+), 1 deletion(-)


diff -Nru a/tools/libxc/Makefile b/tools/libxc/Makefile
--- a/tools/libxc/Makefile      2005-05-09 14:03:41 -04:00
+++ b/tools/libxc/Makefile      2005-05-09 14:03:41 -04:00
@@ -12,6 +12,7 @@
 INCLUDES += -I $(XEN_LIBXUTIL)
 
 SRCS     :=
+SRCS     += xc_sedf.c
 SRCS     += xc_atropos.c
 SRCS     += xc_bvtsched.c
 SRCS     += xc_domain.c
diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h
--- a/tools/libxc/xc.h  2005-05-09 14:03:41 -04:00
+++ b/tools/libxc/xc.h  2005-05-09 14:03:41 -04:00
@@ -132,6 +132,14 @@
 
 int xc_rrobin_global_get(int xc_handle, u64 *slice);
 
+int xc_sedf_domain_set(int xc_handle,
+                          u32 domid,
+                          u64 period, u64 slice);
+
+int xc_sedf_domain_get(int xc_handle,
+                          u32 domid,
+                          u64* period, u64 *slice);
+
 typedef evtchn_status_t xc_evtchn_status_t;
 int xc_evtchn_alloc_unbound(int xc_handle,
                             u32 dom,
diff -Nru a/tools/libxc/xc_sedf.c b/tools/libxc/xc_sedf.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/tools/libxc/xc_sedf.c     2005-05-09 14:03:41 -04:00
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * xc_sedf.c
+ * 
+ * API for manipulating parameters of the Simple EDF scheduler.
+ * 
+ * changes by Stephan Diestelhorst
+ * based on code
+ * by Mark Williamson, Copyright (c) 2004 Intel Research Cambridge.
+ */
+
+#include "xc_private.h"
+
+int xc_sedf_domain_set(int xc_handle,
+                          u32 domid, u64 period, u64 slice)
+{
+    dom0_op_t op;
+    struct sedf_adjdom *p = &op.u.adjustdom.u.sedf;
+
+    op.cmd = DOM0_ADJUSTDOM;
+    op.u.adjustdom.domain  = (domid_t)domid;
+    op.u.adjustdom.sched_id = SCHED_SEDF;
+    op.u.adjustdom.direction = SCHED_INFO_PUT;
+
+    p->period   = period;
+    p->slice    = slice;
+    return do_dom0_op(xc_handle, &op);
+}
+
+int xc_sedf_domain_get(int xc_handle, u32 domid, u64 *period, u64 *slice)
+{
+    dom0_op_t op;
+    int ret;
+    struct sedf_adjdom *p = &op.u.adjustdom.u.sedf;
+
+    op.cmd = DOM0_ADJUSTDOM;    
+    op.u.adjustdom.domain = (domid_t)domid;
+    op.u.adjustdom.sched_id = SCHED_SEDF;
+    op.u.adjustdom.direction = SCHED_INFO_GET;
+
+    ret = do_dom0_op(xc_handle, &op);
+
+    *period   = p->period;
+    *slice    = p->slice;
+    return ret;
+}
diff -Nru a/tools/python/xen/lowlevel/xc/xc.c 
b/tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c 2005-05-09 14:03:41 -04:00
+++ b/tools/python/xen/lowlevel/xc/xc.c 2005-05-09 14:03:41 -04:00
@@ -758,6 +758,50 @@
     return zero;
 }
 
+static PyObject *pyxc_sedf_domain_set(PyObject *self,
+                                         PyObject *args,
+                                         PyObject *kwds)
+{
+    XcObject *xc = (XcObject *)self;
+    u32 domid;
+    u64 period, slice;
+    
+    static char *kwd_list[] = { "dom", "period", "slice", NULL };
+    
+    if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLL", kwd_list, &domid,
+                                     &period, &slice) )
+        return NULL;
+   
+    if ( xc_sedf_domain_set(xc->xc_handle, domid, period, slice) != 0 )
+        return PyErr_SetFromErrno(xc_error);
+
+    Py_INCREF(zero);
+    return zero;
+}
+
+static PyObject *pyxc_sedf_domain_get(PyObject *self,
+                                         PyObject *args,
+                                         PyObject *kwds)
+{
+    XcObject *xc = (XcObject *)self;
+    u32 domid;
+    u64 period, slice;
+        
+    static char *kwd_list[] = { "dom", NULL };
+
+    if( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &domid) )
+        return NULL;
+    
+    if ( xc_sedf_domain_get( xc->xc_handle, domid, &period,
+                                &slice) )
+        return PyErr_SetFromErrno(xc_error);
+
+    return Py_BuildValue("{s:i,s:L,s:L}",
+                         "domain",  domid,
+                         "period",  period,
+                         "slice",   slice);
+}
+
 static PyObject *pyxc_shadow_control(PyObject *self,
                                      PyObject *args,
                                      PyObject *kwds)
@@ -984,6 +1028,26 @@
       "Get Round Robin scheduler settings\n"
       "Returns [dict]:\n"
       " slice  [long]: Scheduler time slice.\n" },    
+    
+    { "sedf_domain_set",
+      (PyCFunction)pyxc_sedf_domain_set,
+      METH_KEYWORDS, "\n"
+      "Set the scheduling parameters for a domain when running with Atropos.\n"
+      " dom      [int]:  domain to set\n"
+      " period   [long]: domain's scheduling period\n"
+      " slice    [long]: domain's slice per period\n"
+      "Returns: [int] 0 on success; -1 on error.\n" },
+
+    { "sedf_domain_get",
+      (PyCFunction)pyxc_sedf_domain_get,
+      METH_KEYWORDS, "\n"
+      "Get the current scheduling parameters for a domain when running with\n"
+      "the Atropos scheduler."
+      " dom      [int]: domain to query\n"
+      "Returns:  [dict]\n"
+      " domain   [int]: domain ID\n"
+      " period   [long]: scheduler period\n"
+      " slice    [long]: CPU reservation per period\n"},
 
     { "evtchn_alloc_unbound", 
       (PyCFunction)pyxc_evtchn_alloc_unbound,
diff -Nru a/tools/python/xen/xend/XendClient.py 
b/tools/python/xen/xend/XendClient.py
--- a/tools/python/xen/xend/XendClient.py       2005-05-09 14:03:41 -04:00
+++ b/tools/python/xen/xend/XendClient.py       2005-05-09 14:03:41 -04:00
@@ -272,6 +272,12 @@
                               'latency' : latency,
                               'xtratime': xtratime })
 
+    def xend_domain_cpu_sedf_set(self, id, period, slice):
+        return self.xendPost(self.domainurl(id),
+                             {'op'      : 'cpu_sedf_set',
+                              'period'  : period,
+                              'slice'   : slice })
+
     def xend_domain_maxmem_set(self, id, memory):
         return self.xendPost(self.domainurl(id),
                              { 'op'     : 'maxmem_set',
diff -Nru a/tools/python/xen/xend/XendDomain.py 
b/tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       2005-05-09 14:03:41 -04:00
+++ b/tools/python/xen/xend/XendDomain.py       2005-05-09 14:03:41 -04:00
@@ -659,6 +659,24 @@
             return xc.atropos_domain_get(dominfo.dom)
         except Exception, ex:
             raise XendError(str(ex))
+    
+    def domain_cpu_sedf_set(self, id, period, slice):
+        """Set Atropos scheduler parameters for a domain.
+        """
+        dominfo = self.domain_lookup(id)
+        try:
+            return xc.sedf_domain_set(dominfo.dom, period, slice)
+        except Exception, ex:
+            raise XendError(str(ex))
+
+    def domain_cpu_sedf_get(self, id):
+        """Get Atropos scheduler parameters for a domain.
+        """
+        dominfo = self.domain_lookup(id)
+        try:
+            return xc.sedf_domain_get(dominfo.dom)
+        except Exception, ex:
+            raise XendError(str(ex))
 
     def domain_device_create(self, id, devconfig):
         """Create a new device for a domain.
diff -Nru a/tools/python/xen/xend/server/SrvDomain.py 
b/tools/python/xen/xend/server/SrvDomain.py
--- a/tools/python/xen/xend/server/SrvDomain.py 2005-05-09 14:03:41 -04:00
+++ b/tools/python/xen/xend/server/SrvDomain.py 2005-05-09 14:03:41 -04:00
@@ -132,6 +132,14 @@
                      ['xtratime', 'int']])
         val = fn(req.args, {'dom': self.dom.id})
         return val
+    
+    def op_cpu_sedf_set(self, op, req):
+        fn = FormFn(self.xd.domain_cpu_sedf_set,
+                    [['dom', 'str'],
+                     ['period', 'int'],
+                     ['slice', 'int']])
+        val = fn(req.args, {'dom': self.dom.id})
+        return val
 
     def op_maxmem_set(self, op, req):
         fn = FormFn(self.xd.domain_maxmem_set,
diff -Nru a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       2005-05-09 14:03:41 -04:00
+++ b/tools/python/xen/xm/main.py       2005-05-09 14:03:41 -04:00
@@ -587,6 +587,23 @@
 
 xm.prog(ProgRrobin)
 
+class ProgSedf(Prog):
+    group = 'scheduler'
+    name= "sedf"
+    info = """Set simple EDF parameters."""
+
+    def help(self, args):
+        print args[0], "DOM PERIOD SLICE"
+        print "\nSet simple EDF parameters."
+
+    def main(self, args):
+        if len(args) != 4: self.err("%s: Invalid argument(s)" % args[0])
+        dom = args[1]
+        v = map(int, args[2:4])
+        server.xend_domain_cpu_sedf_set(dom, *v)
+
+xm.prog(ProgSedf)
+
 class ProgInfo(Prog):
     group = 'host'
     name = "info"
diff -Nru a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c
--- /dev/null   Wed Dec 31 16:00:00 196900

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Added new simple EDF scheduler, BitKeeper Bot <=