|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 2/4] Add cbs parameter support to xl tool stack, remove defunct sedf parameters
From: Robbie VanVossen <robert.vanvossen@xxxxxxxxxxxxxxx>
---
docs/man/xl.cfg.pod.5 | 9 ++----
tools/libxc/xc_sedf.c | 16 +++-------
tools/libxc/xenctrl.h | 12 +++----
tools/libxl/libxl.c | 31 ++++++-------------
tools/libxl/libxl.h | 3 +-
tools/libxl/libxl_create.c | 61 ------------------------------------
tools/libxl/libxl_types.idl | 3 +-
tools/libxl/xl_cmdimpl.c | 62 ++++++++++---------------------------
tools/libxl/xl_cmdtable.c | 8 ++---
tools/python/xen/lowlevel/xc/xc.c | 34 +++++++++-----------
xen/include/public/domctl.h | 4 +--
11 files changed, 58 insertions(+), 185 deletions(-)
mode change 100644 => 100755 docs/man/xl.cfg.pod.5
mode change 100644 => 100755 tools/libxc/xc_sedf.c
mode change 100644 => 100755 tools/libxc/xenctrl.h
mode change 100644 => 100755 tools/libxl/libxl.c
mode change 100644 => 100755 tools/libxl/libxl.h
mode change 100644 => 100755 tools/libxl/libxl_types.idl
mode change 100644 => 100755 tools/libxl/xl_cmdimpl.c
mode change 100644 => 100755 tools/libxl/xl_cmdtable.c
mode change 100644 => 100755 tools/python/xen/lowlevel/xc/xc.c
mode change 100644 => 100755 xen/include/public/domctl.h
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
old mode 100644
new mode 100755
index a94d037..5c55298
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -212,14 +212,9 @@ The normal EDF scheduling usage in nanoseconds. it defines
the time
a domain get every period time.
Honoured by the sedf scheduler.
-=item B<latency=N>
+=item B<soft=BOOLEAN>
-Scaled period if domain is doing heavy I/O.
-Honoured by the sedf scheduler.
-
-=item B<extratime=BOOLEAN>
-
-Flag for allowing domain to run in extra time.
+Flag for setting a domain or VCPU to run as a soft task.
Honoured by the sedf scheduler.
=back
diff --git a/tools/libxc/xc_sedf.c b/tools/libxc/xc_sedf.c
old mode 100644
new mode 100755
index db372ca..81ff133
--- a/tools/libxc/xc_sedf.c
+++ b/tools/libxc/xc_sedf.c
@@ -29,9 +29,7 @@ int xc_sedf_domain_set(
uint32_t domid,
uint64_t period,
uint64_t slice,
- uint64_t latency,
- uint16_t extratime,
- uint16_t weight)
+ uint16_t soft)
{
DECLARE_DOMCTL;
struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
@@ -43,9 +41,7 @@ int xc_sedf_domain_set(
p->period = period;
p->slice = slice;
- p->latency = latency;
- p->extratime = extratime;
- p->weight = weight;
+ p->soft = soft;
return do_domctl(xch, &domctl);
}
@@ -54,9 +50,7 @@ int xc_sedf_domain_get(
uint32_t domid,
uint64_t *period,
uint64_t *slice,
- uint64_t *latency,
- uint16_t *extratime,
- uint16_t *weight)
+ uint16_t *soft)
{
DECLARE_DOMCTL;
int ret;
@@ -71,8 +65,6 @@ int xc_sedf_domain_get(
*period = p->period;
*slice = p->slice;
- *latency = p->latency;
- *extratime = p->extratime;
- *weight = p->weight;
+ *soft = p->soft;
return ret;
}
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
old mode 100644
new mode 100755
index 02129f7..d5cfdb8
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -765,15 +765,15 @@ int xc_shadow_control(xc_interface *xch,
int xc_sedf_domain_set(xc_interface *xch,
uint32_t domid,
- uint64_t period, uint64_t slice,
- uint64_t latency, uint16_t extratime,
- uint16_t weight);
+ uint64_t period,
+ uint64_t slice,
+ uint16_t soft);
int xc_sedf_domain_get(xc_interface *xch,
uint32_t domid,
- uint64_t* period, uint64_t *slice,
- uint64_t *latency, uint16_t *extratime,
- uint16_t *weight);
+ uint64_t *period,
+ uint64_t *slice,
+ uint16_t *soft);
int xc_sched_credit_domain_set(xc_interface *xch,
uint32_t domid,
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
old mode 100644
new mode 100755
index 900b8d4..cea8af2
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4932,13 +4932,10 @@ static int sched_sedf_domain_get(libxl__gc *gc,
uint32_t domid,
{
uint64_t period;
uint64_t slice;
- uint64_t latency;
- uint16_t extratime;
- uint16_t weight;
+ uint16_t soft;
int rc;
- rc = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &latency,
- &extratime, &weight);
+ rc = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &soft);
if (rc != 0) {
LOGE(ERROR, "getting domain sched sedf");
return ERROR_FAIL;
@@ -4948,9 +4945,7 @@ static int sched_sedf_domain_get(libxl__gc *gc, uint32_t
domid,
scinfo->sched = LIBXL_SCHEDULER_SEDF;
scinfo->period = period / 1000000;
scinfo->slice = slice / 1000000;
- scinfo->latency = latency / 1000000;
- scinfo->extratime = extratime;
- scinfo->weight = weight;
+ scinfo->soft = soft;
return 0;
}
@@ -4960,14 +4955,11 @@ static int sched_sedf_domain_set(libxl__gc *gc,
uint32_t domid,
{
uint64_t period;
uint64_t slice;
- uint64_t latency;
- uint16_t extratime;
- uint16_t weight;
+ uint16_t soft;
int ret;
- ret = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &latency,
- &extratime, &weight);
+ ret = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &soft);
if (ret != 0) {
LOGE(ERROR, "getting domain sched sedf");
return ERROR_FAIL;
@@ -4977,15 +4969,10 @@ static int sched_sedf_domain_set(libxl__gc *gc,
uint32_t domid,
period = (uint64_t)scinfo->period * 1000000;
if (scinfo->slice != LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT)
slice = (uint64_t)scinfo->slice * 1000000;
- if (scinfo->latency != LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT)
- latency = (uint64_t)scinfo->latency * 1000000;
- if (scinfo->extratime != LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT)
- extratime = scinfo->extratime;
- if (scinfo->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT)
- weight = scinfo->weight;
-
- ret = xc_sedf_domain_set(CTX->xch, domid, period, slice, latency,
- extratime, weight);
+ if (scinfo->soft != LIBXL_DOMAIN_SCHED_PARAM_SOFT_DEFAULT)
+ soft = scinfo->soft;
+
+ ret = xc_sedf_domain_set(CTX->xch, domid, period, slice, soft);
if ( ret < 0 ) {
LOGE(ERROR, "setting domain sched sedf");
return ERROR_FAIL;
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
old mode 100644
new mode 100755
index 80947c3..548d37e
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1120,8 +1120,7 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx,
uint32_t poolid,
#define LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT -1
#define LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT -1
#define LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT -1
-#define LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT -1
-#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1
+#define LIBXL_DOMAIN_SCHED_PARAM_SOFT_DEFAULT -1
int libxl_domain_sched_params_get(libxl_ctx *ctx, uint32_t domid,
libxl_domain_sched_params *params);
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index d015cf4..83b593b 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -44,61 +44,6 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,
return 0;
}
-static int sched_params_valid(libxl__gc *gc,
- uint32_t domid, libxl_domain_sched_params *scp)
-{
- int has_weight = scp->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT;
- int has_period = scp->period != LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT;
- int has_slice = scp->slice != LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT;
- int has_extratime =
- scp->extratime != LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT;
-
- /* The sedf scheduler needs some more consistency checking */
- if (libxl__domain_scheduler(gc, domid) == LIBXL_SCHEDULER_SEDF) {
- if (has_weight && (has_period || has_slice))
- return 0;
- /* If you want a real-time domain, with its own period and
- * slice, please, do provide both! */
- if (has_period != has_slice)
- return 0;
-
- /*
- * Idea is, if we specify a weight, then both period and
- * slice has to be zero. OTOH, if we do specify a period and
- * slice, it is weight that should be zeroed. See
- * docs/misc/sedf_scheduler_mini-HOWTO.txt for more details
- * on the meaningful combinations and their meanings.
- */
- if (has_weight) {
- scp->slice = 0;
- scp->period = 0;
- }
- else if (!has_period) {
- /* No weight nor slice/period means best effort. Parameters needs
- * some mangling in order to properly ask for that, though. */
-
- /*
- * Providing no weight does not make any sense if we do not allow
- * the domain to run in extra time. On the other hand, if we have
- * extra time, weight will be ignored (and zeroed) by Xen, but it
- * can't be zero here, or the call for setting the scheduling
- * parameters will fail. So, avoid the latter by setting a random
- * weight (namely, 1), as it will be ignored anyway.
- */
-
- /* We can setup a proper best effort domain (extra time only)
- * iff we either already have or are asking for some extra time. */
- scp->weight = has_extratime ? scp->extratime : 1;
- scp->period = 0;
- } else {
- /* Real-time domain: will get slice CPU time over every period */
- scp->weight = 0;
- }
- }
-
- return 1;
-}
-
int libxl__domain_build_info_setdefault(libxl__gc *gc,
libxl_domain_build_info *b_info)
{
@@ -760,12 +705,6 @@ static void initiate_domain_create(libxl__egc *egc,
ret = libxl__domain_build_info_setdefault(gc, &d_config->b_info);
if (ret) goto error_out;
- if (!sched_params_valid(gc, domid, &d_config->b_info.sched_params)) {
- LOG(ERROR, "Invalid scheduling parameters\n");
- ret = ERROR_INVAL;
- goto error_out;
- }
-
for (i = 0; i < d_config->num_disks; i++) {
ret = libxl__device_disk_setdefault(gc, &d_config->disks[i]);
if (ret) goto error_out;
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
old mode 100644
new mode 100755
index 52f1aa9..3ec2f80
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -292,8 +292,7 @@ libxl_domain_sched_params = Struct("domain_sched_params",[
("cap", integer, {'init_val':
'LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT'}),
("period", integer, {'init_val':
'LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT'}),
("slice", integer, {'init_val':
'LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT'}),
- ("latency", integer, {'init_val':
'LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT'}),
- ("extratime", integer, {'init_val':
'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
+ ("soft", integer, {'init_val':
'LIBXL_DOMAIN_SCHED_PARAM_SOFT_DEFAULT'}),
])
libxl_domain_build_info = Struct("domain_build_info",[
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
old mode 100644
new mode 100755
index 5195914..e06f924
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -838,10 +838,8 @@ static void parse_config_data(const char *config_source,
b_info->sched_params.period = l;
if (!xlu_cfg_get_long (config, "slice", &l, 0))
b_info->sched_params.slice = l;
- if (!xlu_cfg_get_long (config, "latency", &l, 0))
- b_info->sched_params.latency = l;
- if (!xlu_cfg_get_long (config, "extratime", &l, 0))
- b_info->sched_params.extratime = l;
+ if (!xlu_cfg_get_long (config, "soft", &l, 0))
+ b_info->sched_params.soft = l;
if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
b_info->max_vcpus = l;
@@ -5181,22 +5179,20 @@ static int sched_sedf_domain_output(
int rc;
if (domid < 0) {
- printf("%-33s %4s %6s %-6s %7s %5s %6s\n", "Name", "ID", "Period",
- "Slice", "Latency", "Extra", "Weight");
+ printf("%-33s %4s %6s %-6s %5s\n", "Name", "ID", "Period",
+ "Slice", "Soft");
return 0;
}
rc = sched_domain_get(LIBXL_SCHEDULER_SEDF, domid, &scinfo);
if (rc)
return rc;
domname = libxl_domid_to_name(ctx, domid);
- printf("%-33s %4d %6d %6d %7d %5d %6d\n",
+ printf("%-33s %4d %6d %6d %5d\n",
domname,
domid,
scinfo.period,
scinfo.slice,
- scinfo.latency,
- scinfo.extratime,
- scinfo.weight);
+ scinfo.soft);
free(domname);
libxl_domain_sched_params_dispose(&scinfo);
return 0;
@@ -5466,22 +5462,18 @@ int main_sched_sedf(int argc, char **argv)
const char *cpupool = NULL;
int period = 0, opt_p = 0;
int slice = 0, opt_s = 0;
- int latency = 0, opt_l = 0;
- int extra = 0, opt_e = 0;
- int weight = 0, opt_w = 0;
+ int soft = 0, opt_t = 0;
int opt, rc;
static struct option opts[] = {
{"period", 1, 0, 'p'},
{"slice", 1, 0, 's'},
- {"latency", 1, 0, 'l'},
- {"extra", 1, 0, 'e'},
- {"weight", 1, 0, 'w'},
+ {"soft", 1, 0, 't'},
{"cpupool", 1, 0, 'c'},
COMMON_LONG_OPTS,
{0, 0, 0, 0}
};
- SWITCH_FOREACH_OPT(opt, "d:p:s:l:e:w:c:h", opts, "sched-sedf", 0) {
+ SWITCH_FOREACH_OPT(opt, "d:p:s:t:c:h", opts, "sched-sedf", 0) {
case 'd':
dom = optarg;
break;
@@ -5493,36 +5485,24 @@ int main_sched_sedf(int argc, char **argv)
slice = strtol(optarg, NULL, 10);
opt_s = 1;
break;
- case 'l':
- latency = strtol(optarg, NULL, 10);
- opt_l = 1;
- break;
- case 'e':
- extra = strtol(optarg, NULL, 10);
- opt_e = 1;
- break;
- case 'w':
- weight = strtol(optarg, NULL, 10);
- opt_w = 1;
+ case 't':
+ soft = strtol(optarg, NULL, 10);
+ opt_t = 1;
break;
case 'c':
cpupool = optarg;
break;
}
- if (cpupool && (dom || opt_p || opt_s || opt_l || opt_e || opt_w)) {
+ if (cpupool && (dom || opt_p || opt_s || opt_t)) {
fprintf(stderr, "Specifying a cpupool is not allowed with other "
"options.\n");
return 1;
}
- if (!dom && (opt_p || opt_s || opt_l || opt_e || opt_w)) {
+ if (!dom && (opt_p || opt_s || opt_t)) {
fprintf(stderr, "Must specify a domain.\n");
return 1;
}
- if (opt_w && (opt_p || opt_s)) {
- fprintf(stderr, "Specifying a weight AND period or slice is not "
- "allowed.\n");
- }
if (!dom) { /* list all domain's credit scheduler info */
return -sched_domain_output(LIBXL_SCHEDULER_SEDF,
@@ -5532,7 +5512,7 @@ int main_sched_sedf(int argc, char **argv)
} else {
uint32_t domid = find_domain(dom);
- if (!opt_p && !opt_s && !opt_l && !opt_e && !opt_w) {
+ if (!opt_p && !opt_s) {
/* output sedf scheduler info */
sched_sedf_domain_output(-1);
return -sched_sedf_domain_output(domid);
@@ -5543,20 +5523,12 @@ int main_sched_sedf(int argc, char **argv)
if (opt_p) {
scinfo.period = period;
- scinfo.weight = 0;
}
if (opt_s) {
scinfo.slice = slice;
- scinfo.weight = 0;
}
- if (opt_l)
- scinfo.latency = latency;
- if (opt_e)
- scinfo.extratime = extra;
- if (opt_w) {
- scinfo.weight = weight;
- scinfo.period = 0;
- scinfo.slice = 0;
+ if (opt_t) {
+ scinfo.soft = soft;
}
rc = sched_domain_set(domid, &scinfo);
libxl_domain_sched_params_dispose(&scinfo);
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
old mode 100644
new mode 100755
index 4279b9f..1226fb8
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -269,12 +269,8 @@ struct cmd_spec cmd_table[] = {
"-p MS, --period=MS Relative deadline(ms)\n"
"-s MS, --slice=MS Worst-case execution time(ms).\n"
" (slice < period)\n"
- "-l MS, --latency=MS Scaled period (ms) when domain\n"
- " performs heavy I/O\n"
- "-e FLAG, --extra=FLAG Flag (0 or 1) controls if domain\n"
- " can run in extra time\n"
- "-w FLOAT, --weight=FLOAT CPU Period/slice (do not set with\n"
- " --period/--slice)\n"
+ "-t FLAG, --soft=FLAG Flag (0 or 1) controls if domain\n"
+ " can run as a soft task\n"
"-c CPUPOOL, --cpupool=CPUPOOL Restrict output to CPUPOOL"
},
{ "domid",
diff --git a/tools/python/xen/lowlevel/xc/xc.c
b/tools/python/xen/lowlevel/xc/xc.c
old mode 100644
new mode 100755
index cb34446..bf10165
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1471,17 +1471,17 @@ static PyObject *pyxc_sedf_domain_set(XcObject *self,
PyObject *kwds)
{
uint32_t domid;
- uint64_t period, slice, latency;
- uint16_t extratime, weight;
- static char *kwd_list[] = { "domid", "period", "slice",
- "latency", "extratime", "weight",NULL };
+ uint64_t period, slice;
+ uint16_t soft;
+
+ static char *kwd_list[] = { "domid", "period", "slice", "soft",NULL };
- if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLhh", kwd_list,
- &domid, &period, &slice,
- &latency, &extratime, &weight) )
+ if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLi", kwd_list,
+ &domid, &period, &slice, &soft) )
+
return NULL;
if ( xc_sedf_domain_set(self->xc_handle, domid, period,
- slice, latency, extratime,weight) != 0 )
+ slice, soft) != 0 )
return pyxc_error_to_exception(self->xc_handle);
Py_INCREF(zero);
@@ -1491,23 +1491,21 @@ static PyObject *pyxc_sedf_domain_set(XcObject *self,
static PyObject *pyxc_sedf_domain_get(XcObject *self, PyObject *args)
{
uint32_t domid;
- uint64_t period, slice,latency;
- uint16_t weight, extratime;
+ uint64_t period, slice;
+ uint16_t soft;
if(!PyArg_ParseTuple(args, "i", &domid))
return NULL;
if (xc_sedf_domain_get(self->xc_handle, domid, &period,
- &slice,&latency,&extratime,&weight))
+ &slice, &soft))
return pyxc_error_to_exception(self->xc_handle);
- return Py_BuildValue("{s:i,s:L,s:L,s:L,s:i,s:i}",
+ return Py_BuildValue("{s:i,s:L,s:L,s:i}",
"domid", domid,
"period", period,
"slice", slice,
- "latency", latency,
- "extratime", extratime,
- "weight", weight);
+ "soft", soft);
}
static PyObject *pyxc_shadow_control(PyObject *self,
@@ -2544,8 +2542,7 @@ static PyMethodDef pyxc_methods[] = {
" 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"
+ " soft [int]: domain is a soft task?\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "sedf_domain_get",
@@ -2558,8 +2555,7 @@ static PyMethodDef pyxc_methods[] = {
" 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"},
+ " soft [int]: domain is a soft task?\n"},
{ "sched_credit_domain_set",
(PyCFunction)pyxc_sched_credit_domain_set,
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
old mode 100644
new mode 100755
index 565fa4c..6e143d3
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -331,9 +331,7 @@ struct xen_domctl_scheduler_op {
struct xen_domctl_sched_sedf {
uint64_aligned_t period;
uint64_aligned_t slice;
- uint64_aligned_t latency;
- uint32_t extratime;
- uint32_t weight;
+ uint32_t soft;
} sedf;
struct xen_domctl_sched_credit {
uint16_t weight;
--
1.7.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |