[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] [PATCH 2 of 2 v2] xl: check for meaningful combination of sedf config file parameters
- To: xen-devel@xxxxxxxxxxxxx
- From: Dario Faggioli <raistlin@xxxxxxxx>
- Date: Thu, 07 Jun 2012 15:42:33 +0200
- Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>
- Delivery-date: Thu, 07 Jun 2012 13:50:58 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:in-reply-to:references:user-agent:date :from:to:cc; bh=tSukAjm1YZ10l3WGIL04wrVi7STs9m/4fPYNeGmRJJ8=; b=kxCuDn+fE+DJc73lKqCdX+/WXmBfaFVYwSXxrk5mZ/nCKW/Qm+c6O61Xa9r54Zow0R ebXymUOTA+Y6yzgpg2MuWCUbotBT9ig/xZcsUk1TKdlGrmOtx3PPnPEDA+QnwzcCeFVk mq98xRFYy5gXuG6KxmT22eLL0XiSgcQbn9PogS2H9oq012J6erBFONE408iVbfdkepm5 QGfrDj3zzV0gXYb/KvSbee0/Y1xW1sceY0K2jQItjkY07PV6y8WCe97fAE9B6LQ/TDqd bTaA5+Y6ROpKgcbOYhhSk5jGewWMyTYholNTj35+ADI7/Xnfo/jtVHjZOE10IKFatHrd /hZg==
- List-id: Xen developer discussion <xen-devel.lists.xen.org>
As it happens in the implementation of `xl sched-sedf -d ...', some
consistency checking is needed for the scheduling parameters when
they come from the config file.
Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -550,6 +550,31 @@ vcpp_out:
return rc;
}
+static int sched_params_valid(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;
+ libxl_domain_sched_params sci;
+
+ libxl_domain_sched_params_get(ctx, domid, &sci);
+
+ /* The sedf scheduler needs some more consistency checking */
+ if (sci.sched == LIBXL_SCHEDULER_SEDF) {
+ if (has_weight && (has_period || has_slice))
+ return 0;
+
+ if (has_weight) {
+ scp->slice = 0;
+ scp->period = 0;
+ }
+ if (has_period || has_slice)
+ scp->weight = 0;
+ }
+
+ return 1;
+}
+
static void parse_config_data(const char *config_source,
const char *config_data,
int config_len,
@@ -644,6 +669,10 @@ static void parse_config_data(const char
b_info->sched_params.latency = l;
if (!xlu_cfg_get_long (config, "extratime", &l, 0))
b_info->sched_params.extratime = l;
+ if (!sched_params_valid(&b_info->sched_params)) {
+ fprintf(stderr, "Invalid scheduling parameters\n");
+ exit(1);
+ }
if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
b_info->max_vcpus = l;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel