[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC Patch 1/3] Remove sedf extra, weight, and latency parameter support.
From: Nathan Studer <nate.studer@xxxxxxxxxxxxxxx> Remove sedf extra, weight, and latency parameters from the scheduler's adjust function. Also remove the support for these parameters from the xl toolstack. Signed-off-by: Nathan Studer <nate.studer@xxxxxxxxxxxxxxx> Signed-off-by: Joshua Whitehead <josh.whitehead@xxxxxxxxxxxxxxx> --- docs/man/xl.cfg.pod.5 | 10 -- tools/libxc/xc_sedf.c | 16 +-- tools/libxc/xenctrl.h | 8 +- tools/libxl/libxl.c | 26 +---- tools/libxl/libxl.h | 2 - tools/libxl/libxl_create.c | 61 ----------- tools/libxl/libxl_types.idl | 2 - tools/libxl/xl_cmdimpl.c | 54 ++-------- tools/libxl/xl_cmdtable.c | 6 -- tools/python/xen/lowlevel/xc/xc.c | 35 +++---- xen/common/sched_sedf.c | 205 ++++++------------------------------- xen/include/public/domctl.h | 3 - 12 files changed, 61 insertions(+), 367 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_create.c 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 xen/common/sched_sedf.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 c02ad55..dc52ed2 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -204,16 +204,6 @@ 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> - -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. -Honoured by the sedf scheduler. - =back =head3 Memory Allocation diff --git a/tools/libxc/xc_sedf.c b/tools/libxc/xc_sedf.c old mode 100644 new mode 100755 index db372ca..6a0c8e2 --- a/tools/libxc/xc_sedf.c +++ b/tools/libxc/xc_sedf.c @@ -28,10 +28,7 @@ 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 slice) { DECLARE_DOMCTL; struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf; @@ -43,9 +40,6 @@ int xc_sedf_domain_set( p->period = period; p->slice = slice; - p->latency = latency; - p->extratime = extratime; - p->weight = weight; return do_domctl(xch, &domctl); } @@ -53,10 +47,7 @@ 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 *slice) { DECLARE_DOMCTL; int ret; @@ -71,8 +62,5 @@ int xc_sedf_domain_get( *period = p->period; *slice = p->slice; - *latency = p->latency; - *extratime = p->extratime; - *weight = p->weight; return ret; } diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h old mode 100644 new mode 100755 index 13f816b..bec91b9 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -765,15 +765,11 @@ 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); 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); 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 730f6e1..f790727 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -4915,13 +4915,9 @@ 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; 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); if (rc != 0) { LOGE(ERROR, "getting domain sched sedf"); return ERROR_FAIL; @@ -4931,9 +4927,6 @@ 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; return 0; } @@ -4943,14 +4936,10 @@ 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; 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); if (ret != 0) { LOGE(ERROR, "getting domain sched sedf"); return ERROR_FAIL; @@ -4960,15 +4949,8 @@ 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); + + ret = xc_sedf_domain_set(CTX->xch, domid, period, slice); 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 4c9cd64..6be5575 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -1093,8 +1093,6 @@ 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 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 old mode 100644 new mode 100755 index 53e7cb6..3e7fb60 --- 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) { @@ -752,12 +697,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 7d3a62b..1265a73 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -291,8 +291,6 @@ 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'}), ]) 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 5f59bbc..4457289 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -834,10 +834,6 @@ 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, "vcpus", &l, 0)) { b_info->max_vcpus = l; @@ -5170,22 +5166,19 @@ 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\n", "Name", "ID", "Period", + "Slice"); 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\n", domname, domid, scinfo.period, - scinfo.slice, - scinfo.latency, - scinfo.extratime, - scinfo.weight); + scinfo.slice); free(domname); libxl_domain_sched_params_dispose(&scinfo); return 0; @@ -5455,22 +5448,16 @@ 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 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'}, {"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:c:h", opts, "sched-sedf", 0) { case 'd': dom = optarg; break; @@ -5482,36 +5469,20 @@ 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; - 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)) { 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)) { 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, @@ -5521,7 +5492,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); @@ -5538,15 +5509,6 @@ int main_sched_sedf(int argc, char **argv) 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; - } rc = sched_domain_set(domid, &scinfo); libxl_domain_sched_params_dispose(&scinfo); if (rc) diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c old mode 100644 new mode 100755 index e8ab93a..fd49fba --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -266,12 +266,6 @@ 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" "-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 index 737bdac..aab6e5c 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1437,17 +1437,14 @@ 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; + static char *kwd_list[] = { "domid", "period", "slice",NULL }; - if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLhh", kwd_list, - &domid, &period, &slice, - &latency, &extratime, &weight) ) + if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLL", kwd_list, + &domid, &period, &slice) ) return NULL; if ( xc_sedf_domain_set(self->xc_handle, domid, period, - slice, latency, extratime,weight) != 0 ) + slice) != 0 ) return pyxc_error_to_exception(self->xc_handle); Py_INCREF(zero); @@ -1457,23 +1454,19 @@ 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; if(!PyArg_ParseTuple(args, "i", &domid)) return NULL; if (xc_sedf_domain_get(self->xc_handle, domid, &period, - &slice,&latency,&extratime,&weight)) + &slice)) 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}", "domid", domid, "period", period, - "slice", slice, - "latency", latency, - "extratime", extratime, - "weight", weight); + "slice", slice); } static PyObject *pyxc_shadow_control(PyObject *self, @@ -2506,26 +2499,22 @@ static PyMethodDef pyxc_methods[] = { { "sedf_domain_set", (PyCFunction)pyxc_sedf_domain_set, METH_KEYWORDS, "\n" - "Set the scheduling parameters for a domain when running with Atropos.\n" + "Set the scheduling parameters for a domain when running with sedf.\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_VARARGS, "\n" "Get the current scheduling parameters for a domain when running with\n" - "the Atropos scheduler." + "the sedf 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"}, + " slice [long]: CPU reservation per period\n"}, { "sched_credit_domain_set", (PyCFunction)pyxc_sched_credit_domain_set, diff --git a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c old mode 100644 new mode 100755 index 7c24171..6ebf72b --- a/xen/common/sched_sedf.c +++ b/xen/common/sched_sedf.c @@ -38,6 +38,9 @@ #define WEIGHT_PERIOD (MILLISECS(100)) #define WEIGHT_SAFETY (MILLISECS(5)) +#define DEFAULT_PERIOD (MILLISECS(20)) +#define DEFAULT_SLICE (MILLISECS(10)) + #define PERIOD_MAX MILLISECS(10000) /* 10s */ #define PERIOD_MIN (MICROSECS(10)) /* 10us */ #define SLICE_MIN (MICROSECS(5)) /* 5us */ @@ -320,11 +323,20 @@ static void *sedf_alloc_vdata(const struct scheduler *ops, struct vcpu *v, void /* Every VCPU gets an equal share of extratime by default */ inf->deadl_abs = 0; inf->latency = 0; - inf->status = EXTRA_AWARE | SEDF_ASLEEP; - inf->extraweight = 1; - /* Upon creation all domain are best-effort */ - inf->period = WEIGHT_PERIOD; - inf->slice = 0; + inf->status = SEDF_ASLEEP; + inf->extraweight = 0; + + if (v->domain->domain_id == 0) + { + /* Domain 0, needs a slice to boot the machine */ + inf->period = DEFAULT_PERIOD; + inf->slice = DEFAULT_SLICE; + } + else + { + inf->period = 0; + inf->slice = 0; + } inf->period_orig = inf->period; inf->slice_orig = inf->slice; INIT_LIST_HEAD(&(inf->list)); @@ -1291,92 +1303,11 @@ static void sedf_dump_cpu_state(const struct scheduler *ops, int i) } -/* Adjusts periods and slices of the domains accordingly to their weights */ -static int sedf_adjust_weights(struct cpupool *c, int nr_cpus, int *sumw, s_time_t *sumt) -{ - struct vcpu *p; - struct domain *d; - unsigned int cpu; - - /* - * Sum across all weights. Notice that no runq locking is needed - * here: the caller holds sedf_priv_info.lock and we're not changing - * anything that is accessed during scheduling. - */ - rcu_read_lock(&domlist_read_lock); - for_each_domain_in_cpupool( d, c ) - { - for_each_vcpu( d, p ) - { - if ( (cpu = p->processor) >= nr_cpus ) - continue; - - if ( EDOM_INFO(p)->weight ) - { - sumw[cpu] += EDOM_INFO(p)->weight; - } - else - { - /* - * Don't modify domains who don't have a weight, but sum - * up the time they need, projected to a WEIGHT_PERIOD, - * so that this time is not given to the weight-driven - * domains - */ - - /* Check for overflows */ - ASSERT((WEIGHT_PERIOD < ULONG_MAX) - && (EDOM_INFO(p)->slice_orig < ULONG_MAX)); - sumt[cpu] += - (WEIGHT_PERIOD * EDOM_INFO(p)->slice_orig) / - EDOM_INFO(p)->period_orig; - } - } - } - rcu_read_unlock(&domlist_read_lock); - - /* - * Adjust all slices (and periods) to the new weight. Unlike above, we - * need to take thr runq lock for the various VCPUs: we're modyfing - * slice and period which are referenced during scheduling. - */ - rcu_read_lock(&domlist_read_lock); - for_each_domain_in_cpupool( d, c ) - { - for_each_vcpu ( d, p ) - { - if ( (cpu = p->processor) >= nr_cpus ) - continue; - if ( EDOM_INFO(p)->weight ) - { - /* Interrupts already off */ - spinlock_t *lock = vcpu_schedule_lock(p); - - EDOM_INFO(p)->period_orig = - EDOM_INFO(p)->period = WEIGHT_PERIOD; - EDOM_INFO(p)->slice_orig = - EDOM_INFO(p)->slice = - (EDOM_INFO(p)->weight * - (WEIGHT_PERIOD - WEIGHT_SAFETY - sumt[cpu])) / sumw[cpu]; - - vcpu_schedule_unlock(lock, p); - } - } - } - rcu_read_unlock(&domlist_read_lock); - - return 0; -} - - /* Set or fetch domain scheduling parameters */ static int sedf_adjust(const struct scheduler *ops, struct domain *p, struct xen_domctl_scheduler_op *op) { struct sedf_priv_info *prv = SEDF_PRIV(ops); unsigned long flags; - unsigned int nr_cpus = cpumask_last(&cpu_online_map) + 1; - int *sumw = xzalloc_array(int, nr_cpus); - s_time_t *sumt = xzalloc_array(s_time_t, nr_cpus); struct vcpu *v; int rc = 0; @@ -1391,99 +1322,35 @@ static int sedf_adjust(const struct scheduler *ops, struct domain *p, struct xen if ( op->cmd == XEN_DOMCTL_SCHEDOP_putinfo ) { - /* - * These are used in sedf_adjust_weights() but have to be allocated in - * this function, as we need to avoid nesting xmem_pool_alloc's lock - * within our prv->lock. - */ - if ( !sumw || !sumt ) - { - /* Check for errors here, the _getinfo branch doesn't care */ - rc = -ENOMEM; - goto out; - } - /* Check for sane parameters */ - if ( !op->u.sedf.period && !op->u.sedf.weight ) + if ( !op->u.sedf.period ) { rc = -EINVAL; goto out; } - if ( op->u.sedf.weight ) - { - if ( (op->u.sedf.extratime & EXTRA_AWARE) && - (!op->u.sedf.period) ) - { - /* Weight-driven domains with extratime only */ - for_each_vcpu ( p, v ) - { - /* (Here and everywhere in the following) IRQs are already off, - * hence vcpu_spin_lock() is the one. */ - spinlock_t *lock = vcpu_schedule_lock(v); - - EDOM_INFO(v)->extraweight = op->u.sedf.weight; - EDOM_INFO(v)->weight = 0; - EDOM_INFO(v)->slice = 0; - EDOM_INFO(v)->period = WEIGHT_PERIOD; - vcpu_schedule_unlock(lock, v); - } - } - else - { - /* Weight-driven domains with real-time execution */ - for_each_vcpu ( p, v ) - { - spinlock_t *lock = vcpu_schedule_lock(v); - - EDOM_INFO(v)->weight = op->u.sedf.weight; - vcpu_schedule_unlock(lock, v); - } - } - } - else + /* + * Sanity checking: note that disabling extra weight requires + * that we set a non-zero slice. + */ + if ( (op->u.sedf.period > PERIOD_MAX) || + (op->u.sedf.period < PERIOD_MIN) || + (op->u.sedf.slice > op->u.sedf.period) || + (op->u.sedf.slice < SLICE_MIN) ) { - /* - * Sanity checking: note that disabling extra weight requires - * that we set a non-zero slice. - */ - if ( (op->u.sedf.period > PERIOD_MAX) || - (op->u.sedf.period < PERIOD_MIN) || - (op->u.sedf.slice > op->u.sedf.period) || - (op->u.sedf.slice < SLICE_MIN) ) - { - rc = -EINVAL; - goto out; - } - - /* Time-driven domains */ - for_each_vcpu ( p, v ) - { - spinlock_t *lock = vcpu_schedule_lock(v); - - EDOM_INFO(v)->weight = 0; - EDOM_INFO(v)->extraweight = 0; - EDOM_INFO(v)->period_orig = - EDOM_INFO(v)->period = op->u.sedf.period; - EDOM_INFO(v)->slice_orig = - EDOM_INFO(v)->slice = op->u.sedf.slice; - vcpu_schedule_unlock(lock, v); - } - } - - rc = sedf_adjust_weights(p->cpupool, nr_cpus, sumw, sumt); - if ( rc ) + rc = -EINVAL; goto out; + } + /* Time-driven domains */ for_each_vcpu ( p, v ) { spinlock_t *lock = vcpu_schedule_lock(v); - EDOM_INFO(v)->status = - (EDOM_INFO(v)->status & - ~EXTRA_AWARE) | (op->u.sedf.extratime & EXTRA_AWARE); - EDOM_INFO(v)->latency = op->u.sedf.latency; - extraq_check(v); + EDOM_INFO(v)->period_orig = + EDOM_INFO(v)->period = op->u.sedf.period; + EDOM_INFO(v)->slice_orig = + EDOM_INFO(v)->slice = op->u.sedf.slice; vcpu_schedule_unlock(lock, v); } } @@ -1497,17 +1364,11 @@ static int sedf_adjust(const struct scheduler *ops, struct domain *p, struct xen op->u.sedf.period = EDOM_INFO(p->vcpu[0])->period; op->u.sedf.slice = EDOM_INFO(p->vcpu[0])->slice; - op->u.sedf.extratime = EDOM_INFO(p->vcpu[0])->status & EXTRA_AWARE; - op->u.sedf.latency = EDOM_INFO(p->vcpu[0])->latency; - op->u.sedf.weight = EDOM_INFO(p->vcpu[0])->weight; } out: spin_unlock_irqrestore(&prv->lock, flags); - xfree(sumt); - xfree(sumw); - return rc; } diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h old mode 100644 new mode 100755 index f22fe2e..91bcbe9 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -331,9 +331,6 @@ 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; } 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 |