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

[Xen-devel] [RFC PATCH v2 7/7] Changed slice to budget in libxl for the sedf scheduler



From: Robbie VanVossen <robert.vanvossen@xxxxxxxxxxxxxxx>

Signed-off-by: Robert VanVossen <Robert.VanVossen@xxxxxxxxxxxxxxx>
Signed-off-by: Nathan Studer <nate.studer@xxxxxxxxx>

---
 docs/man/xl.cfg.pod.5       |    4 ++--
 tools/libxl/libxl.c         |   19 +++++++++++-------
 tools/libxl/libxl.h         |    1 +
 tools/libxl/libxl_types.idl |    1 +
 tools/libxl/xl_cmdimpl.c    |   46 ++++++++++++++++++++++++-------------------
 tools/libxl/xl_cmdtable.c   |    6 ++++--
 6 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index 5c55298..4bd0230 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -203,10 +203,10 @@ your BIOS.
 =item B<period=NANOSECONDS>
 
 The normal EDF scheduling usage in nanoseconds. This means every period
-the domain gets cpu time defined in slice.
+the domain gets cpu time defined in budget.
 Honoured by the sedf scheduler.
 
-=item B<slice=NANOSECONDS>
+=item B<budget=NANOSECONDS>
 
 The normal EDF scheduling usage in nanoseconds. it defines the time 
 a domain get every period time.
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index ca8c1c5..75ea31c 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4931,12 +4931,13 @@ static int sched_sedf_domain_get(libxl__gc *gc, 
uint32_t domid,
                                  libxl_domain_sched_params *scinfo)
 {
     uint64_t period;
-    uint64_t slice;
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
+    uint64_t slice;
     uint64_t latency;
     uint16_t extratime;
     uint16_t weight;
 #else
+    uint64_t budget;
     uint16_t soft;
 #endif
     int rc;
@@ -4945,7 +4946,7 @@ static int sched_sedf_domain_get(libxl__gc *gc, uint32_t 
domid,
     rc = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &latency,
                             &extratime, &weight);
 #else
-    rc = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &soft);
+    rc = xc_sedf_domain_get(CTX->xch, domid, &period, &budget, &soft);
 #endif
     if (rc != 0) {
         LOGE(ERROR, "getting domain sched sedf");
@@ -4955,12 +4956,13 @@ static int sched_sedf_domain_get(libxl__gc *gc, 
uint32_t domid,
     libxl_domain_sched_params_init(scinfo);
     scinfo->sched = LIBXL_SCHEDULER_SEDF;
     scinfo->period = period / 1000000;
-    scinfo->slice = slice / 1000000;
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
+    scinfo->slice = slice / 1000000;
     scinfo->latency = latency / 1000000;
     scinfo->extratime = extratime;
     scinfo->weight = weight;
 #else
+    scinfo->budget = budget / 1000000;
     scinfo->soft = soft;
 #endif
 
@@ -4971,12 +4973,13 @@ static int sched_sedf_domain_set(libxl__gc *gc, 
uint32_t domid,
                                  const libxl_domain_sched_params *scinfo)
 {
     uint64_t period;
-    uint64_t slice;
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
+    uint64_t slice;
     uint64_t latency;
     uint16_t extratime;
     uint16_t weight;
 #else
+    uint64_t budget;
     uint16_t soft;
 #endif
 
@@ -4986,7 +4989,7 @@ static int sched_sedf_domain_set(libxl__gc *gc, uint32_t 
domid,
     ret = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &latency,
                             &extratime, &weight);
 #else
-    ret = xc_sedf_domain_get(CTX->xch, domid, &period, &slice, &soft);
+    ret = xc_sedf_domain_get(CTX->xch, domid, &period, &budget, &soft);
 #endif
     if (ret != 0) {
         LOGE(ERROR, "getting domain sched sedf");
@@ -4995,9 +4998,9 @@ static int sched_sedf_domain_set(libxl__gc *gc, uint32_t 
domid,
 
     if (scinfo->period != LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT)
         period = (uint64_t)scinfo->period * 1000000;
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     if (scinfo->slice != LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT)
         slice = (uint64_t)scinfo->slice * 1000000;
-#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     if (scinfo->latency != LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT)
         latency = (uint64_t)scinfo->latency * 1000000;
     if (scinfo->extratime != LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT)
@@ -5005,6 +5008,8 @@ static int sched_sedf_domain_set(libxl__gc *gc, uint32_t 
domid,
     if (scinfo->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT)
         weight = scinfo->weight;
 #else
+    if (scinfo->budget != LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT)
+        budget = (uint64_t)scinfo->budget * 1000000;
     if (scinfo->soft != LIBXL_DOMAIN_SCHED_PARAM_SOFT_DEFAULT)
         soft = scinfo->soft;
 #endif
@@ -5013,7 +5018,7 @@ static int sched_sedf_domain_set(libxl__gc *gc, uint32_t 
domid,
     ret = xc_sedf_domain_set(CTX->xch, domid, period, slice, latency,
                             extratime, weight);
 #else
-    ret = xc_sedf_domain_set(CTX->xch, domid, period, slice, soft);
+    ret = xc_sedf_domain_set(CTX->xch, domid, period, budget, soft);
 #endif
     if ( ret < 0 ) {
         LOGE(ERROR, "setting domain sched sedf");
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index eacd8f6..3c44aeb 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1122,6 +1122,7 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, 
uint32_t poolid,
 #define LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT     -1
 #define LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT   -1
 #define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1
+#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT    -1
 #define LIBXL_DOMAIN_SCHED_PARAM_SOFT_DEFAULT      -1
 
 int libxl_domain_sched_params_get(libxl_ctx *ctx, uint32_t domid,
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index d02380e..d8aefe0 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -294,6 +294,7 @@ libxl_domain_sched_params = Struct("domain_sched_params",[
     ("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'}),
+    ("budget",       integer, {'init_val': 
'LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT'}),
     ("soft",         integer, {'init_val': 
'LIBXL_DOMAIN_SCHED_PARAM_SOFT_DEFAULT'}),
     ])
 
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 1f6f04b..e7362a6 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -836,14 +836,16 @@ static void parse_config_data(const char *config_source,
         b_info->sched_params.cap = l;
     if (!xlu_cfg_get_long (config, "period", &l, 0))
         b_info->sched_params.period = l;
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     if (!xlu_cfg_get_long (config, "slice", &l, 0))
         b_info->sched_params.slice = l;
-#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     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;
 #else
+    if (!xlu_cfg_get_long (config, "budget", &l, 0))
+        b_info->sched_params.budget = l;
     if (!xlu_cfg_get_long (config, "soft", &l, 0))
         b_info->sched_params.soft = l;
 #endif
@@ -5191,7 +5193,7 @@ static int sched_sedf_domain_output(
                "Slice", "Latency", "Extra", "Weight");
 #else
         printf("%-33s %4s %6s %-6s %5s\n", "Name", "ID", "Period",
-               "Slice", "Soft");
+               "Budget", "Soft");
 #endif
         return 0;
     }
@@ -5213,7 +5215,7 @@ static int sched_sedf_domain_output(
         domname,
         domid,
         scinfo.period,
-        scinfo.slice,
+        scinfo.budget,
         scinfo.soft);
 #endif
     free(domname);
@@ -5484,24 +5486,26 @@ int main_sched_sedf(int argc, char **argv)
     const char *dom = NULL;
     const char *cpupool = NULL;
     int period = 0, opt_p = 0;
-    int slice = 0, opt_s = 0;
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
+    int slice = 0, opt_s = 0;
     int latency = 0, opt_l = 0;
     int extra = 0, opt_e = 0;
     int weight = 0, opt_w = 0;
 #else
-    int soft = 0, opt_t = 0;
+    int budget = 0, opt_b = 0;
+    int soft = 0, opt_s = 0;
 #endif
     int opt, rc;
     static struct option opts[] = {
         {"period", 1, 0, 'p'},
-        {"slice", 1, 0, 's'},
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
+        {"slice", 1, 0, 's'},
         {"latency", 1, 0, 'l'},
         {"extra", 1, 0, 'e'},
         {"weight", 1, 0, 'w'},
 #else
-        {"soft", 1, 0, 't'},
+        {"budget", 1, 0, 'b'},
+        {"soft", 1, 0, 's'},
 #endif
         {"cpupool", 1, 0, 'c'},
         COMMON_LONG_OPTS,
@@ -5511,7 +5515,7 @@ int main_sched_sedf(int argc, char **argv)
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     SWITCH_FOREACH_OPT(opt, "d:p:s:l:e:w:c:h", opts, "sched-sedf", 0) {
 #else
-    SWITCH_FOREACH_OPT(opt, "d:p:s:t:c:h", opts, "sched-sedf", 0) {
+    SWITCH_FOREACH_OPT(opt, "d:p:b:s:c:h", opts, "sched-sedf", 0) {
 #endif
     case 'd':
         dom = optarg;
@@ -5520,11 +5524,11 @@ int main_sched_sedf(int argc, char **argv)
         period = strtol(optarg, NULL, 10);
         opt_p = 1;
         break;
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     case 's':
         slice = strtol(optarg, NULL, 10);
         opt_s = 1;
         break;
-#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     case 'l':
         latency = strtol(optarg, NULL, 10);
         opt_l = 1;
@@ -5538,9 +5542,13 @@ int main_sched_sedf(int argc, char **argv)
         opt_w = 1;
         break;
 #else
-    case 't':
+    case 'b':
+        budget = strtol(optarg, NULL, 10);
+        opt_b = 1;
+        break;
+    case 's':
         soft = strtol(optarg, NULL, 10);
-        opt_t = 1;
+        opt_s = 1;
         break;
 #endif
     case 'c':
@@ -5551,22 +5559,21 @@ int main_sched_sedf(int argc, char **argv)
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     if (cpupool && (dom || opt_p || opt_s || opt_l || opt_e || opt_w)) {
 #else
-    if (cpupool && (dom || opt_p || opt_s || opt_t)) {
+    if (cpupool && (dom || opt_p || opt_b || opt_s)) {
 #endif
         fprintf(stderr, "Specifying a cpupool is not allowed with other "
                 "options.\n");
         return 1;
     }
-
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     if (!dom && (opt_p || opt_s || opt_l || opt_e || opt_w)) {
 #else
-    if (!dom && (opt_p || opt_s || opt_t)) {
+    if (!dom && (opt_p || opt_b || opt_s)) {
 #endif
         fprintf(stderr, "Must specify a domain.\n");
         return 1;
     }
-#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION > 0x040400
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
     if (opt_w && (opt_p || opt_s)) {
         fprintf(stderr, "Specifying a weight AND period or slice is not "
                 "allowed.\n");
@@ -5584,7 +5591,7 @@ int main_sched_sedf(int argc, char **argv)
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
         if (!opt_p && !opt_s && !opt_l && !opt_e && !opt_w) {
 #else
-        if (!opt_p && !opt_s) {
+        if (!opt_p && !opt_b) {
 #endif
             /* output sedf scheduler info */
             sched_sedf_domain_output(-1);
@@ -5594,7 +5601,6 @@ int main_sched_sedf(int argc, char **argv)
             libxl_domain_sched_params_init(&scinfo);
             scinfo.sched = LIBXL_SCHEDULER_SEDF;
 
-
 #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
             if (opt_p) {
                 scinfo.period = period;
@@ -5617,10 +5623,10 @@ int main_sched_sedf(int argc, char **argv)
             if (opt_p) {
                 scinfo.period = period;
             }
-            if (opt_s) {
-                scinfo.slice = slice;
+            if (opt_b) {
+                scinfo.budget = budget;
             }
-            if (opt_t) {
+            if (opt_s) {
                 scinfo.soft = soft;
             }
 #endif
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
index 7f0aca4..526fecb 100644
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -267,9 +267,9 @@ struct cmd_spec cmd_table[] = {
       "[options]",
       "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
       "-p MS, --period=MS             Relative deadline(ms)\n"
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
       "-s MS, --slice=MS              Worst-case execution time(ms).\n"
       "                               (slice < period)\n"
-#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION <= 0x040400
       "-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"
@@ -277,7 +277,9 @@ struct cmd_spec cmd_table[] = {
       "-w FLOAT, --weight=FLOAT       CPU Period/slice (do not set with\n"
       "                               --period/--slice)\n"
 #else
-      "-t FLAG, --soft=FLAG           Flag (0 or 1) controls if domain\n"
+      "-b MS, --budget=MS             Constant bandwidth server budget(ms).\n"
+      "                               (budget < period)\n"
+      "-s FLAG, --soft=FLAG           Flag (0 or 1) controls if domain\n"
       "                               can run as a soft task\n"
 #endif
       "-c CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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