diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2012-06-01 12:06:20 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2012-06-01 12:06:20 +0100 |
commit | 6d45f5d903b673d600b7c2f26b19bd29000261c4 (patch) | |
tree | 62bf956549d4065c87da30bcfc57ee6ef8047f75 /tools/libxl | |
parent | 33a1df8e769b9a23126e3a02e6e8078f0b85bbf8 (diff) | |
download | xen-6d45f5d903b673d600b7c2f26b19bd29000261c4.tar.gz xen-6d45f5d903b673d600b7c2f26b19bd29000261c4.tar.bz2 xen-6d45f5d903b673d600b7c2f26b19bd29000261c4.zip |
libxl: make it possible to explicitly specify default sched params
To do so we define a discriminating value which is never a valid real value for
each parameter.
While there:
- removed libxl_sched_*_domain in favour of libxl_domain_sched_params.
- use this new functionality for the various xl commands which set sched
parameters, which saves an explicit read-modify-write in xl.
- removed call of xc_domain_getinfolist from a few functions which weren't
actually using the result (looks like a cut and paste error)
- fix xl which was setting period for a variety of different config keys.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl')
-rw-r--r-- | tools/libxl/libxl.c | 121 | ||||
-rw-r--r-- | tools/libxl/libxl.h | 28 | ||||
-rw-r--r-- | tools/libxl/libxl_dom.c | 34 | ||||
-rw-r--r-- | tools/libxl/libxl_types.idl | 30 | ||||
-rw-r--r-- | tools/libxl/xl_cmdimpl.c | 66 |
5 files changed, 142 insertions, 137 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index d414673558..1b6d178b5a 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -3296,19 +3296,19 @@ libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx) } int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit_domain *scinfo) + libxl_domain_sched_params *scinfo) { struct xen_domctl_sched_credit sdom; int rc; - libxl_sched_credit_domain_init(scinfo); - rc = xc_sched_credit_domain_get(ctx->xch, domid, &sdom); if (rc != 0) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched credit"); return ERROR_FAIL; } + libxl_domain_sched_params_init(scinfo); + scinfo->sched = LIBXL_SCHEDULER_CREDIT; scinfo->weight = sdom.weight; scinfo->cap = sdom.cap; @@ -3316,7 +3316,7 @@ int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, } int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit_domain *scinfo) + libxl_domain_sched_params *scinfo) { struct xen_domctl_sched_credit sdom; xc_domaininfo_t domaininfo; @@ -3330,22 +3330,33 @@ int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, if (rc != 1 || domaininfo.domain != domid) return ERROR_INVAL; - - if (scinfo->weight < 1 || scinfo->weight > 65535) { - LIBXL__LOG(ctx, LIBXL__LOG_ERROR, - "Cpu weight out of range, valid values are within range from 1 to 65535"); - return ERROR_INVAL; + rc = xc_sched_credit_domain_get(ctx->xch, domid, &sdom); + if (rc != 0) { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched credit"); + return ERROR_FAIL; } - if (scinfo->cap < 0 || scinfo->cap > (domaininfo.max_vcpu_id + 1) * 100) { - LIBXL__LOG(ctx, LIBXL__LOG_ERROR, - "Cpu cap out of range, valid range is from 0 to %d for specified number of vcpus", - ((domaininfo.max_vcpu_id + 1) * 100)); - return ERROR_INVAL; + if (scinfo->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT) { + if (scinfo->weight < 1 || scinfo->weight > 65535) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, + "Cpu weight out of range, " + "valid values are within range from 1 to 65535"); + return ERROR_INVAL; + } + sdom.weight = scinfo->weight; } - sdom.weight = scinfo->weight; - sdom.cap = scinfo->cap; + if (scinfo->cap != LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT) { + if (scinfo->cap < 0 + || scinfo->cap > (domaininfo.max_vcpu_id + 1) * 100) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, + "Cpu cap out of range, " + "valid range is from 0 to %d for specified number of vcpus", + ((domaininfo.max_vcpu_id + 1) * 100)); + return ERROR_INVAL; + } + sdom.cap = scinfo->cap; + } rc = xc_sched_credit_domain_set(ctx->xch, domid, &sdom); if ( rc < 0 ) { @@ -3418,13 +3429,11 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, } int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit2_domain *scinfo) + libxl_domain_sched_params *scinfo) { struct xen_domctl_sched_credit2 sdom; int rc; - libxl_sched_credit2_domain_init(scinfo); - rc = xc_sched_credit2_domain_get(ctx->xch, domid, &sdom); if (rc != 0) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, @@ -3432,36 +3441,37 @@ int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid, return ERROR_FAIL; } + libxl_domain_sched_params_init(scinfo); + scinfo->sched = LIBXL_SCHEDULER_CREDIT2; scinfo->weight = sdom.weight; return 0; } int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit2_domain *scinfo) + libxl_domain_sched_params *scinfo) { struct xen_domctl_sched_credit2 sdom; - xc_domaininfo_t domaininfo; int rc; - rc = xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo); - if (rc < 0) { - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list"); + rc = xc_sched_credit2_domain_get(ctx->xch, domid, &sdom); + if (rc != 0) { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, + "getting domain sched credit2"); return ERROR_FAIL; } - if (rc != 1 || domaininfo.domain != domid) - return ERROR_INVAL; - - if (scinfo->weight < 1 || scinfo->weight > 65535) { - LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, - "Cpu weight out of range, valid values are within range from " - "1 to 65535"); - return ERROR_INVAL; + if (scinfo->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT) { + if (scinfo->weight < 1 || scinfo->weight > 65535) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, + "Cpu weight out of range, " + "valid values are within range from " + "1 to 65535"); + return ERROR_INVAL; + } + sdom.weight = scinfo->weight; } - sdom.weight = scinfo->weight; - rc = xc_sched_credit2_domain_set(ctx->xch, domid, &sdom); if ( rc < 0 ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, @@ -3473,7 +3483,7 @@ int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid, } int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid, - libxl_sched_sedf_domain *scinfo) + libxl_domain_sched_params *scinfo) { uint64_t period; uint64_t slice; @@ -3482,8 +3492,6 @@ int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid, uint16_t weight; int rc; - libxl_sched_sedf_domain_init(scinfo); - rc = xc_sedf_domain_get(ctx->xch, domid, &period, &slice, &latency, &extratime, &weight); if (rc != 0) { @@ -3491,6 +3499,8 @@ int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid, return ERROR_FAIL; } + libxl_domain_sched_params_init(scinfo); + scinfo->sched = LIBXL_SCHEDULER_SEDF; scinfo->period = period / 1000000; scinfo->slice = slice / 1000000; scinfo->latency = latency / 1000000; @@ -3501,24 +3511,37 @@ int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid, } int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid, - libxl_sched_sedf_domain *scinfo) + libxl_domain_sched_params *scinfo) { - xc_domaininfo_t domaininfo; - int rc; + uint64_t period; + uint64_t slice; + uint64_t latency; + uint16_t extratime; + uint16_t weight; - rc = xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo); - if (rc < 0) { - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list"); + int ret; + + ret = xc_sedf_domain_get(ctx->xch, domid, &period, &slice, &latency, + &extratime, &weight); + if (ret != 0) { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched sedf"); return ERROR_FAIL; } - if (rc != 1 || domaininfo.domain != domid) - return ERROR_INVAL; + if (scinfo->period != LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT) + period = scinfo->period * 1000000; + if (scinfo->slice != LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT) + slice = scinfo->slice * 1000000; + if (scinfo->latency != LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT) + latency = 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; - rc = xc_sedf_domain_set(ctx->xch, domid, scinfo->period * 1000000, - scinfo->slice * 1000000, scinfo->latency * 1000000, - scinfo->extratime, scinfo->weight); - if ( rc < 0 ) { + ret = xc_sedf_domain_set(ctx->xch, domid, period, slice, latency, + extratime, weight); + if ( ret < 0 ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched sedf"); return ERROR_FAIL; } diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 1e1ffa121c..78fb5afc1a 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -768,23 +768,33 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_cpumap *cpumap); libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx); - -int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit_domain *scinfo); -int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit_domain *scinfo); +/* Per-scheduler parameters */ int libxl_sched_credit_params_get(libxl_ctx *ctx, uint32_t poolid, libxl_sched_credit_params *scinfo); int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, libxl_sched_credit_params *scinfo); + +/* Scheduler Per-domain parameters */ + +#define LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT -1 +#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_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, + libxl_domain_sched_params *scinfo); +int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, + libxl_domain_sched_params *scinfo); int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit2_domain *scinfo); + libxl_domain_sched_params *scinfo); int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid, - libxl_sched_credit2_domain *scinfo); + libxl_domain_sched_params *scinfo); int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid, - libxl_sched_sedf_domain *scinfo); + libxl_domain_sched_params *scinfo); int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid, - libxl_sched_sedf_domain *scinfo); + libxl_domain_sched_params *scinfo); int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, libxl_trigger trigger, uint32_t vcpuid); int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq); diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index bbf1af833a..7741c9fdbd 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -45,34 +45,26 @@ libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid) int libxl__sched_set_params(libxl__gc *gc, uint32_t domid, libxl_domain_sched_params *scparams) { - libxl_ctx *ctx = libxl__gc_owner(gc); - libxl_scheduler sched; - libxl_sched_sedf_domain sedf_info; - libxl_sched_credit_domain credit_info; - libxl_sched_credit2_domain credit2_info; + libxl_scheduler sched = scparams->sched; int ret; - sched = libxl_get_scheduler (ctx); + if (sched == LIBXL_SCHEDULER_UNKNOWN) + sched = libxl__domain_scheduler(gc, domid); + switch (sched) { case LIBXL_SCHEDULER_SEDF: - sedf_info.period = scparams->period; - sedf_info.slice = scparams->slice; - sedf_info.latency = scparams->latency; - sedf_info.extratime = scparams->extratime; - sedf_info.weight = scparams->weight; - ret=libxl_sched_sedf_domain_set(ctx, domid, &sedf_info); - break; + ret=libxl_sched_sedf_domain_set(CTX, domid, scparams); + break; case LIBXL_SCHEDULER_CREDIT: - credit_info.weight = scparams->weight; - credit_info.cap = scparams->cap; - ret=libxl_sched_credit_domain_set(ctx, domid, &credit_info); - break; + ret=libxl_sched_credit_domain_set(CTX, domid, scparams); + break; case LIBXL_SCHEDULER_CREDIT2: - credit2_info.weight = scparams->weight; - ret=libxl_sched_credit2_domain_set(ctx, domid, &credit2_info); - break; + ret=libxl_sched_credit2_domain_set(CTX, domid, scparams); + break; default: - ret=-1; + LOG(ERROR, "Unknown scheduler"); + ret=ERROR_INVAL; + break; } return ret; } diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 053ddc6651..a77bbf722d 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -225,12 +225,13 @@ libxl_domain_create_info = Struct("domain_create_info",[ MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT") libxl_domain_sched_params = Struct("domain_sched_params",[ - ("weight", integer), - ("cap", integer), - ("period", integer), - ("slice", integer), - ("latency", integer), - ("extratime", integer), + ("sched", libxl_scheduler), + ("weight", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT'}), + ("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'}), ], dir=DIR_IN) libxl_domain_build_info = Struct("domain_build_info",[ @@ -426,28 +427,11 @@ libxl_cputopology = Struct("cputopology", [ ("node", uint32), ], dir=DIR_OUT) -libxl_sched_credit_domain = Struct("sched_credit_domain", [ - ("weight", integer), - ("cap", integer), - ]) - libxl_sched_credit_params = Struct("sched_credit_params", [ ("tslice_ms", integer), ("ratelimit_us", integer), ], dispose_fn=None) -libxl_sched_credit2_domain = Struct("sched_credit2_domain", [ - ("weight", integer), - ]) - -libxl_sched_sedf_domain = Struct("sched_sedf_domain", [ - ("period", integer), - ("slice", integer), - ("latency", integer), - ("extratime", integer), - ("weight", integer), - ]) - libxl_domain_remus_info = Struct("domain_remus_info",[ ("interval", integer), ("blackhole", bool), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index be3661f64d..df0926393f 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -630,7 +630,8 @@ static void parse_config_data(const char *config_source, if (blkdev_start) b_info->blkdev_start = strdup(blkdev_start); - /* the following is the actual config parsing with overriding values in the structures */ + /* the following is the actual config parsing with overriding + * values in the structures */ if (!xlu_cfg_get_long (config, "cpu_weight", &l, 0)) b_info->sched_params.weight = l; if (!xlu_cfg_get_long (config, "cap", &l, 0)) @@ -638,11 +639,11 @@ static void parse_config_data(const char *config_source, if (!xlu_cfg_get_long (config, "period", &l, 0)) b_info->sched_params.period = l; if (!xlu_cfg_get_long (config, "slice", &l, 0)) - b_info->sched_params.period = l; + b_info->sched_params.slice = l; if (!xlu_cfg_get_long (config, "latency", &l, 0)) - b_info->sched_params.period = l; + b_info->sched_params.latency = l; if (!xlu_cfg_get_long (config, "extratime", &l, 0)) - b_info->sched_params.period = l; + b_info->sched_params.extratime = l; if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) { b_info->max_vcpus = l; @@ -4362,7 +4363,7 @@ int main_sharing(int argc, char **argv) return 0; } -static int sched_credit_domain_get(int domid, libxl_sched_credit_domain *scinfo) +static int sched_credit_domain_get(int domid, libxl_domain_sched_params *scinfo) { int rc; @@ -4373,7 +4374,7 @@ static int sched_credit_domain_get(int domid, libxl_sched_credit_domain *scinfo) return rc; } -static int sched_credit_domain_set(int domid, libxl_sched_credit_domain *scinfo) +static int sched_credit_domain_set(int domid, libxl_domain_sched_params *scinfo) { int rc; @@ -4409,7 +4410,7 @@ static int sched_credit_params_get(int poolid, libxl_sched_credit_params *scinfo static int sched_credit_domain_output(int domid) { char *domname; - libxl_sched_credit_domain scinfo; + libxl_domain_sched_params scinfo; int rc; if (domid < 0) { @@ -4426,7 +4427,7 @@ static int sched_credit_domain_output(int domid) scinfo.weight, scinfo.cap); free(domname); - libxl_sched_credit_domain_dispose(&scinfo); + libxl_domain_sched_params_dispose(&scinfo); return 0; } @@ -4452,7 +4453,7 @@ static int sched_credit_pool_output(uint32_t poolid) } static int sched_credit2_domain_get( - int domid, libxl_sched_credit2_domain *scinfo) + int domid, libxl_domain_sched_params *scinfo) { int rc; @@ -4464,7 +4465,7 @@ static int sched_credit2_domain_get( } static int sched_credit2_domain_set( - int domid, libxl_sched_credit2_domain *scinfo) + int domid, libxl_domain_sched_params *scinfo) { int rc; @@ -4479,7 +4480,7 @@ static int sched_credit2_domain_output( int domid) { char *domname; - libxl_sched_credit2_domain scinfo; + libxl_domain_sched_params scinfo; int rc; if (domid < 0) { @@ -4495,12 +4496,12 @@ static int sched_credit2_domain_output( domid, scinfo.weight); free(domname); - libxl_sched_credit2_domain_dispose(&scinfo); + libxl_domain_sched_params_dispose(&scinfo); return 0; } static int sched_sedf_domain_get( - int domid, libxl_sched_sedf_domain *scinfo) + int domid, libxl_domain_sched_params *scinfo) { int rc; @@ -4512,7 +4513,7 @@ static int sched_sedf_domain_get( } static int sched_sedf_domain_set( - int domid, libxl_sched_sedf_domain *scinfo) + int domid, libxl_domain_sched_params *scinfo) { int rc; @@ -4526,7 +4527,7 @@ static int sched_sedf_domain_output( int domid) { char *domname; - libxl_sched_sedf_domain scinfo; + libxl_domain_sched_params scinfo; int rc; if (domid < 0) { @@ -4547,7 +4548,7 @@ static int sched_sedf_domain_output( scinfo.extratime, scinfo.weight); free(domname); - libxl_sched_sedf_domain_dispose(&scinfo); + libxl_domain_sched_params_dispose(&scinfo); return 0; } @@ -4624,7 +4625,6 @@ static int sched_domain_output(libxl_scheduler sched, int (*output)(int), */ int main_sched_credit(int argc, char **argv) { - libxl_sched_credit_domain scinfo; const char *dom = NULL; const char *cpupool = NULL; int weight = 256, cap = 0, opt_w = 0, opt_c = 0; @@ -4699,7 +4699,7 @@ int main_sched_credit(int argc, char **argv) } if (opt_s) { - libxl_sched_credit_params scparam; + libxl_sched_credit_params scparam; uint32_t poolid = 0; if (cpupool) { @@ -4735,20 +4735,19 @@ int main_sched_credit(int argc, char **argv) } else { find_domain(dom); - rc = sched_credit_domain_get(domid, &scinfo); - if (rc) - return -rc; - if (!opt_w && !opt_c) { /* output credit scheduler info */ sched_credit_domain_output(-1); return -sched_credit_domain_output(domid); } else { /* set credit scheduler paramaters */ + libxl_domain_sched_params scinfo; + libxl_domain_sched_params_init(&scinfo); + scinfo.sched = LIBXL_SCHEDULER_CREDIT; if (opt_w) scinfo.weight = weight; if (opt_c) scinfo.cap = cap; rc = sched_credit_domain_set(domid, &scinfo); - libxl_sched_credit_domain_dispose(&scinfo); + libxl_domain_sched_params_dispose(&scinfo); if (rc) return -rc; } @@ -4759,7 +4758,6 @@ int main_sched_credit(int argc, char **argv) int main_sched_credit2(int argc, char **argv) { - libxl_sched_credit2_domain scinfo; const char *dom = NULL; const char *cpupool = NULL; int weight = 256, opt_w = 0; @@ -4814,18 +4812,17 @@ int main_sched_credit2(int argc, char **argv) } else { find_domain(dom); - rc = sched_credit2_domain_get(domid, &scinfo); - if (rc) - return -rc; - if (!opt_w) { /* output credit2 scheduler info */ sched_credit2_domain_output(-1); return -sched_credit2_domain_output(domid); } else { /* set credit2 scheduler paramaters */ + libxl_domain_sched_params scinfo; + libxl_domain_sched_params_init(&scinfo); + scinfo.sched = LIBXL_SCHEDULER_CREDIT2; if (opt_w) scinfo.weight = weight; rc = sched_credit2_domain_set(domid, &scinfo); - libxl_sched_credit2_domain_dispose(&scinfo); + libxl_domain_sched_params_dispose(&scinfo); if (rc) return -rc; } @@ -4836,7 +4833,6 @@ int main_sched_credit2(int argc, char **argv) int main_sched_sedf(int argc, char **argv) { - libxl_sched_sedf_domain scinfo; const char *dom = NULL; const char *cpupool = NULL; int period = 0, opt_p = 0; @@ -4919,15 +4915,15 @@ int main_sched_sedf(int argc, char **argv) } else { find_domain(dom); - rc = sched_sedf_domain_get(domid, &scinfo); - if (rc) - return -rc; - if (!opt_p && !opt_s && !opt_l && !opt_e && !opt_w) { /* output sedf scheduler info */ sched_sedf_domain_output(-1); return -sched_sedf_domain_output(domid); } else { /* set sedf scheduler paramaters */ + libxl_domain_sched_params scinfo; + libxl_domain_sched_params_init(&scinfo); + scinfo.sched = LIBXL_SCHEDULER_SEDF; + if (opt_p) { scinfo.period = period; scinfo.weight = 0; @@ -4946,7 +4942,7 @@ int main_sched_sedf(int argc, char **argv) scinfo.slice = 0; } rc = sched_sedf_domain_set(domid, &scinfo); - libxl_sched_sedf_domain_dispose(&scinfo); + libxl_domain_sched_params_dispose(&scinfo); if (rc) return -rc; } |