ChangeSet 1.1460, 2005/05/09 18:37:25+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
Manual merge.
tools/libxc/Makefile | 1
tools/libxc/xc.h | 8 ++++
tools/python/xen/lowlevel/xc/xc.c | 70 ++++++++++++++++++++++++++++++++++++
tools/python/xen/xend/XendDomain.py | 18 +++++++++
xen/common/schedule.c | 56 +++++++++++++++-------------
5 files changed, 128 insertions(+), 25 deletions(-)
diff -Nru a/tools/libxc/Makefile b/tools/libxc/Makefile
--- a/tools/libxc/Makefile 2005-05-09 14:08:46 -04:00
+++ b/tools/libxc/Makefile 2005-05-09 14:08:46 -04:00
@@ -16,6 +16,7 @@
INCLUDES += -I $(XEN_LIBXUTIL)
SRCS :=
+SRCS += xc_sedf.c
SRCS += xc_bvtsched.c
SRCS += xc_core.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:08:46 -04:00
+++ b/tools/libxc/xc.h 2005-05-09 14:08:46 -04:00
@@ -296,6 +296,14 @@
long long *warpl,
long long *warpu);
+int xc_sedf_domain_set(int xc_handle,
+ u32 domid,
+ u64 period, u64 slice, u64 latency, u16 extratime,
u16 weight);
+
+int xc_sedf_domain_get(int xc_handle,
+ u32 domid,
+ u64* period, u64 *slice, u64 *latency, u16
*extratime, u16* weight);
+
typedef evtchn_status_t xc_evtchn_status_t;
/*
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:08:46 -04:00
+++ b/tools/python/xen/lowlevel/xc/xc.c 2005-05-09 14:08:46 -04:00
@@ -827,6 +827,52 @@
"cpu_khz", info.cpu_khz);
}
+static PyObject *pyxc_sedf_domain_set(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ XcObject *xc = (XcObject *)self;
+ u32 domid;
+ u64 period, slice, latency;
+ u16 extratime, weight;
+ static char *kwd_list[] = { "dom", "period", "slice", "latency",
"extratime", "weight",NULL };
+
+ if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLhh", kwd_list, &domid,
+ &period, &slice, &latency, &extratime,
&weight) )
+ return NULL;
+ if ( xc_sedf_domain_set(xc->xc_handle, domid, period, slice, latency,
extratime,weight) != 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,latency;
+ u16 weight, extratime;
+
+ 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,&latency,&extratime,&weight) )
+ return PyErr_SetFromErrno(xc_error);
+
+ return Py_BuildValue("{s:i,s:L,s:L,s:L,s:i}",
+ "domain", domid,
+ "period", period,
+ "slice", slice,
+ "latency", latency,
+ "extratime", extratime);
+}
+
static PyObject *pyxc_shadow_control(PyObject *self,
PyObject *args,
PyObject *kwds)
@@ -1027,6 +1073,30 @@
" warpu [long]: Unwarp requirement.\n"
" warpl [long]: Warp limit,\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"
+ " latency [long]: domain's wakeup latency hint\n"
+ " extratime [int]: domain aware of extratime?\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"
+ " latency [long]: domain's wakeup latency hint\n"
+ " extratime [int]: domain aware of extratime?\n"},
{ "evtchn_alloc_unbound",
(PyCFunction)pyxc_evtchn_alloc_unbound,
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:08:46 -04:00
+++ b/tools/python/xen/xend/XendDomain.py 2005-05-09 14:08:46 -04:00
@@ -644,6 +644,24 @@
except Exception, ex:
raise XendError(str(ex))
+
+ def domain_cpu_sedf_set(self, id, period, slice, latency, extratime,
weight):
+ """Set Simple EDF scheduler parameters for a domain.
+ """
+ dominfo = self.domain_lookup(id)
+ try:
+ return xc.sedf_domain_set(dominfo.dom, period, slice, latency,
extratime, weight)
+ 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/xen/common/schedule.c b/xen/common/schedule.c
--- a/xen/common/schedule.c 2005-05-09 14:08:46 -04:00
+++ b/xen/common/schedule.c 2005-05-09 14:08:46 -04:00
@@ -106,24 +106,27 @@
d->exec_domain[vcpu] = ed;
ed->domain = d;
- ed->eid = vcpu;
+ ed->id = vcpu;
if ( SCHED_OP(alloc_task, ed) < 0 )
goto out;
- if (vcpu != 0) {
- ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid];
+ if ( vcpu != 0 )
+ {
+ ed->vcpu_info = &d->shared_info->vcpu_data[ed->id];
- for_each_exec_domain(d, edc) {
- if (edc->ed_next_list == NULL || edc->ed_next_list->eid > vcpu)
+ for_each_exec_domain( d, edc )
+ {
+ if ( (edc->next_in_list == NULL) ||
+ (edc->next_in_list->id > vcpu) )
break;
}
- ed->ed_next_list = edc->ed_next_list;
- edc->ed_next_list = ed;
+ ed->next_in_list = edc->next_in_list;
+ edc->next_in_list = ed;
- if (test_bit(EDF_CPUPINNED, &edc->ed_flags)) {
+ if (test_bit(EDF_CPUPINNED, &edc->flags)) {
ed->processor = (edc->processor + 1) % smp_num_cpus;
- set_bit(EDF_CPUPINNED, &ed->ed_flags);
+ set_bit(EDF_CPUPINNED, &ed->flags);
} else {
ed->processor = (edc->processor + 1) % smp_num_cpus; /* XXX */
}
@@ -165,7 +168,7 @@
struct domain *d = ed->domain;
/* Must be unpaused by control software to start execution. */
- set_bit(EDF_CTRLPAUSE, &ed->ed_flags);
+ set_bit(EDF_CTRLPAUSE, &ed->flags);
if ( d->id != IDLE_DOMAIN_ID )
{
@@ -181,14 +184,14 @@
}
SCHED_OP(add_task, ed);
- TRACE_2D(TRC_SCHED_DOM_ADD, d->id, ed->eid);
+ TRACE_2D(TRC_SCHED_DOM_ADD, d->id, ed->id);
}
void sched_rem_domain(struct exec_domain *ed)
{
rem_ac_timer(&ed->timer);
SCHED_OP(rem_task, ed);
- TRACE_2D(TRC_SCHED_DOM_REM, ed->domain->id, ed->eid);
+ TRACE_2D(TRC_SCHED_DOM_REM, ed->domain->id, ed->id);
}
void init_idle_task(void)
@@ -206,10 +209,10 @@
SCHED_OP(sleep, ed);
spin_unlock_irqrestore(&schedule_data[ed->processor].schedule_lock, flags);
- TRACE_2D(TRC_SCHED_SLEEP, ed->domain->id, ed->eid);
+ TRACE_2D(TRC_SCHED_SLEEP, ed->domain->id, ed->id);
/* Synchronous. */
- while ( test_bit(EDF_RUNNING, &ed->ed_flags) && !domain_runnable(ed) )
+ while ( test_bit(EDF_RUNNING, &ed->flags) && !domain_runnable(ed) )
cpu_relax();
}
@@ -225,10 +228,10 @@
ed->wokenup = NOW();
#endif
}
- clear_bit(EDF_MIGRATED, &ed->ed_flags);
+ clear_bit(EDF_MIGRATED, &ed->flags);
spin_unlock_irqrestore(&schedule_data[ed->processor].schedule_lock, flags);
- TRACE_2D(TRC_SCHED_WAKE, ed->domain->id, ed->eid);
+ TRACE_2D(TRC_SCHED_WAKE, ed->domain->id, ed->id);
}
/* Block the currently-executing domain until a pertinent event occurs. */
@@ -241,14 +244,16 @@
#endif
ed->vcpu_info->evtchn_upcall_mask = 0;
- set_bit(EDF_BLOCKED, &ed->ed_flags);
+ set_bit(EDF_BLOCKED, &ed->flags);
/* Check for events /after/ blocking: avoids wakeup waiting race. */
if ( event_pending(ed) )
- clear_bit(EDF_BLOCKED, &ed->ed_flags);
+ {
+ clear_bit(EDF_BLOCKED, &ed->flags);
+ }
else
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|