mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
bitkeeper revision 1.1159.170.101 (41ebbffd4FxrNM4pQF5Ip7nRjrUUjg)
Merge font.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk into font.cl.cam.ac.uk:/local/scratch/sd386/xen-2.0-testing.bk
This commit is contained in:
commit
a36ea62807
12 files changed
+687
-1
No files matched your search
@@ -785,6 +785,50 @@ static PyObject *pyxc_rrobin_global_set(PyObject *self,
|
||||
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)
|
||||
@@ -1019,6 +1063,26 @@ static PyMethodDef pyxc_methods[] = {
|
||||
"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,
|
||||
|
||||
@@ -273,6 +273,12 @@ class Xend:
|
||||
'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',
|
||||
|
||||
@@ -659,6 +659,24 @@ class XendDomain:
|
||||
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.
|
||||
|
||||
@@ -133,6 +133,14 @@ class SrvDomain(SrvDir):
|
||||
['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,
|
||||
|
||||
@@ -600,6 +600,23 @@ class ProgRrobin(Prog):
|
||||
|
||||
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"
|
||||
|
||||