xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xl: check for meaningful combination of sedf config file parameters
@ 2012-06-04 14:01 Dario Faggioli
  2012-06-06 10:35 ` Ian Campbell
  2012-06-06 10:41 ` Ian Jackson
  0 siblings, 2 replies; 9+ messages in thread
From: Dario Faggioli @ 2012-06-04 14:01 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Juergen Gross, Ian Jackson, Ian Campbell

As we do it in the implementation of `xl sched-sedf -d ...', some
consistency checking is needed while parsing the sedf scheduling
parameters provided via config file. Not doing this results in the call
libxl_domain_sched_params_set() to fail, and no parameters being
enforced for the domain.

Note we do this at config file parsing time as that gives us the chance
of bailing out early. It would have been pointless to add it within
sched_sedf_domain_set() (in libxl), as the very same thing is
done in the hypervisor, and the result is being checked and returned
to the caller already.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>

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
@@ -561,6 +561,7 @@ static void parse_config_data(const char
     long l;
     XLU_Config *config;
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids;
+    int opt_w = 0, opt_p = 0, opt_s = 0;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 1;
     int pci_permissive = 0;
@@ -632,18 +633,36 @@ static void parse_config_data(const char
 
     /* the following is the actual config parsing with overriding
      * values in the structures */
-    if (!xlu_cfg_get_long (config, "cpu_weight", &l, 0))
+    if (!xlu_cfg_get_long (config, "cpu_weight", &l, 0)) {
         b_info->sched_params.weight = l;
+        opt_w = 1;
+    }
     if (!xlu_cfg_get_long (config, "cap", &l, 0))
         b_info->sched_params.cap = l;
-    if (!xlu_cfg_get_long (config, "period", &l, 0))
+    if (!xlu_cfg_get_long (config, "period", &l, 0)) {
         b_info->sched_params.period = l;
-    if (!xlu_cfg_get_long (config, "slice", &l, 0))
+        opt_p = 1;
+    }
+    if (!xlu_cfg_get_long (config, "slice", &l, 0)) {
         b_info->sched_params.slice = l;
+        opt_s = 1;
+    }
     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;
+    /* The sedf scheduler needs some more consistency checking */
+    if (opt_w && (opt_p || opt_s)) {
+        fprintf(stderr, "Either specify a weight OR a period and slice\n");
+        exit(1);
+    }
+    if (opt_w) {
+        b_info->sched_params.slice = 0;
+        b_info->sched_params.period = 0;
+    }
+    if (opt_p || opt_s)
+        b_info->sched_params.weight = 0;
+
 
     if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
         b_info->max_vcpus = l;

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-06 14:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-04 14:01 [PATCH] xl: check for meaningful combination of sedf config file parameters Dario Faggioli
2012-06-06 10:35 ` Ian Campbell
2012-06-06 11:05   ` Dario Faggioli
2012-06-06 11:07     ` Ian Campbell
2012-06-06 10:41 ` Ian Jackson
2012-06-06 10:48   ` Dario Faggioli
2012-06-06 10:57     ` Ian Jackson
2012-06-06 10:49   ` Ian Campbell
2012-06-06 14:23     ` Dario Faggioli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).