[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xl: check for meaningful combination of sedf config file parameters


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Sat, 23 Jun 2012 05:22:07 +0000
  • Delivery-date: Sat, 23 Jun 2012 05:22:17 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Dario Faggioli <dario.faggioli@xxxxxxxxxx>
# Date 1339165561 -3600
# Node ID 9d1fd58ff602f5f7b8a50ea3866adfd8668e0285
# Parent  32034d1914a607d7b6f1f060352b4cac973600f8
xl: check for meaningful combination of sedf config file parameters

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>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 32034d1914a6 -r 9d1fd58ff602 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Jun 07 19:46:57 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Fri Jun 08 15:26:01 2012 +0100
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.