Skip to contentSkip to conversation

v2: xl scheduler support

PATCH In review Juergen Gross 2 participants 7 messages Nov 28, 2011 – Dec 1, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v2: xl scheduler support

This patch series enhances scheduler support of xl.

Patch 1: xl sched-credit: support long options
Patch 2: Support cpupools in xl sched-credit
Patch 3: Support of xl sched-credit2
Patch 4: Correct error message in libxl_sched_credit_domain_get() Patch 5: Support of xl sched-sedf

Changes since v1:
- trim code lines to <80 characters

7 files changed, 641 insertions(+), 38 deletions(-)
docs/man/xl.pod.1           |   90 ++++++++-
tools/libxl/libxl.c         |  108 ++++++++++
tools/libxl/libxl.h         |    8 
tools/libxl/libxl_types.idl |   13 +
tools/libxl/xl.h            |    2 
tools/libxl/xl_cmdimpl.c    |  429 +++++++++++++++++++++++++++++++++++++++----
tools/libxl/xl_cmdtable.c   |   29 ++
#1 lore raw

PATCH 1/1 xl sched-credit: support long options

The help text of xl sched-credit supported long options. Neither the man page nor the implementation did.

Signed-off-by [email protected]
2 files changed, 26 insertions(+), 7 deletions(-)
docs/man/xl.pod.1        |   15 ++++++++++-----
tools/libxl/xl_cmdimpl.c |   18 ++++++++++++++++--

# HG changeset patch
# User Juergen Gross <[email protected]> # Date 1322483011 -3600
# Node ID 3a817a14e6a29657c8f798987ccb1568a586ea70 # Parent 95d4e2e0bed374602b5a78ee004b057ad8715d65 xl sched-credit: support long options

The help text of xl sched-credit supported long options. Neither the man page nor the implementation did.

Signed-off-by [email protected]
docs/man/xl.pod.1 +10 -5
diff -r 95d4e2e0bed3 -r 3a817a14e6a2 docs/man/xl.pod.1
@@ -579,25 +579,30 @@ default B<credit> is used for scheduling
 
 =over 4
 
-=item B<sched-credit> [ B<-d> I<domain-id> [ B<-w>[B<=>I<WEIGHT>] | B<-c>[B<=>I<CAP>] ] ]
+=item B<sched-credit> [I<OPTIONS>]
 
-Set credit scheduler parameters.  The credit scheduler is a
+Set or get credit scheduler parameters.  The credit scheduler is a
 proportional fair share CPU scheduler built from the ground up to be
 work conserving on SMP hosts.
 
 Each domain (including Domain0) is assigned a weight and a cap.
 
-B<PARAMETERS>
+B<OPTIONS>
 
 =over 4
 
-=item I<WEIGHT>
+=item B<-d DOMAIN>, B<--domain=DOMAIN>
+
+Specify domain for which scheduler parameters are to be modified or retrieved.
+Mandatory for modifying scheduler parameters.
+
+=item B<-w WEIGHT>, B<--weight=WEIGHT>
 
 A domain with a weight of 512 will get twice as much CPU as a domain
 with a weight of 256 on a contended host. Legal weights range from 1
 to 65535 and the default is 256.
 
-=item I<CAP>
+=item B<-c CAP>, B<--cap=CAP>
 
 The cap optionally fixes the maximum amount of CPU a domain will be
 able to consume, even if the host system has idle CPU cycles. The cap
tools/libxl/xl_cmdimpl.c +16 -2
diff -r 95d4e2e0bed3 -r 3a817a14e6a2 tools/libxl/xl_cmdimpl.c
@@ -3720,8 +3720,19 @@ int main_sched_credit(int argc, char **a
     const char *dom = NULL;
     int weight = 256, cap = 0, opt_w = 0, opt_c = 0;
     int opt, rc;
-
-    while ((opt = def_getopt(argc, argv, "d:w:c:", "sched-credit", 0)) != -1) {
+    int option_index = 0;
+    static struct option long_options[] = {
+        {"domain", 1, 0, 'd'},
+        {"weight", 1, 0, 'w'},
+        {"cap", 1, 0, 'c'},
+        {"help", 0, 0, 'h'},
+        {0, 0, 0, 0}
+    };
+
+    while (1) {
+        opt = getopt_long(argc, argv, "d:w:c:h", long_options, &option_index);
+        if (opt == -1)
+            break;
         switch (opt) {
         case 0: case 2:
             return opt;
@@ -3736,6 +3747,9 @@ int main_sched_credit(int argc, char **a
             cap = strtol(optarg, NULL, 10);
             opt_c = 1;
             break;
+        case 'h':
+            help("sched-credit");
+            return 0;
         }
     }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

PATCH 1/1 Support cpupools in xl sched-credit

In reply to Juergen Gross

Adds cpupool awareness to output of xl sched-credit. Output can now be restricted to a specific cpupool. The domains are printed for each cpupool seperately.

The loop over cpupools and domains is seperated from the main command implementation to be able to support other schedulers as well.

Signed-off-by [email protected]
5 files changed, 101 insertions(+), 30 deletions(-)
docs/man/xl.pod.1           |    4 +
tools/libxl/libxl.c         |    1 
tools/libxl/libxl_types.idl |    1 
tools/libxl/xl_cmdimpl.c    |  120 ++++++++++++++++++++++++++++++++-----------
tools/libxl/xl_cmdtable.c   |    5 +

# HG changeset patch
# User Juergen Gross <[email protected]> # Date 1322483235 -3600
# Node ID 8bb677cf78c3868c96e97962477f229367f01dd6 # Parent 3a817a14e6a29657c8f798987ccb1568a586ea70 Support cpupools in xl sched-credit

Adds cpupool awareness to output of xl sched-credit. Output can now be restricted to a specific cpupool. The domains are printed for each cpupool seperately.

The loop over cpupools and domains is seperated from the main command implementation to be able to support other schedulers as well.

Signed-off-by [email protected]
docs/man/xl.pod.1 +4 -0
diff -r 3a817a14e6a2 -r 8bb677cf78c3 docs/man/xl.pod.1
@@ -610,6 +610,10 @@ 50 is half a CPU, 400 is 4 CPUs, etc. Th
 50 is half a CPU, 400 is 4 CPUs, etc. The default, 0, means there is
 no upper cap.
 
+=item B<-p CPUPOOL>, B<--cpupool=CPUPOOL>
+
+Restrict output to domains in the specified cpupool.
+
 =back
 
 =back
tools/libxl/libxl.c +1 -0
diff -r 3a817a14e6a2 -r 8bb677cf78c3 tools/libxl/libxl.c
@@ -361,6 +361,7 @@ static void xcinfo2xlinfo(const xc_domai
     xlinfo->cpu_time = xcinfo->cpu_time;
     xlinfo->vcpu_max_id = xcinfo->max_vcpu_id;
     xlinfo->vcpu_online = xcinfo->nr_online_vcpus;
+    xlinfo->cpupool = xcinfo->cpupool;
 }
 
 libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain)
tools/libxl/libxl_types.idl +1 -0
diff -r 3a817a14e6a2 -r 8bb677cf78c3 tools/libxl/libxl_types.idl
@@ -109,6 +109,7 @@ SHUTDOWN_* constant."""),
     ("cpu_time",    uint64),
     ("vcpu_max_id", uint32),
     ("vcpu_online", uint32),
+    ("cpupool",     uint32),
     ], dispose_fn=None)
 
 libxl_cpupoolinfo = Struct("cpupoolinfo", [
tools/libxl/xl_cmdimpl.c +92 -28

168 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +3 -2
diff -r 3a817a14e6a2 -r 8bb677cf78c3 tools/libxl/xl_cmdtable.c
@@ -192,10 +192,11 @@ struct cmd_spec cmd_table[] = {
     { "sched-credit",
       &main_sched_credit, 0,
       "Get/set credit scheduler parameters",
-      "[-d <Domain> [-w[=WEIGHT]|-c[=CAP]]]",
+      "[-d <Domain> [-w[=WEIGHT]|-c[=CAP]]] [-p CPUPOOL]",
       "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
       "-w WEIGHT, --weight=WEIGHT     Weight (int)\n"
-      "-c CAP, --cap=CAP              Cap (int)"
+      "-c CAP, --cap=CAP              Cap (int)\n"
+      "-p CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
     },
     { "domid",
       &main_domid, 0,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

PATCH 1/1 Support of xl sched-credit2

In reply to Juergen Gross

Supports the xl subcommand sched-credit2.

Signed-off-by [email protected]
7 files changed, 220 insertions(+)
docs/man/xl.pod.1           |   29 ++++++++++
tools/libxl/libxl.c         |   53 ++++++++++++++++++
tools/libxl/libxl.h         |    4 +
tools/libxl/libxl_types.idl |    4 +
tools/libxl/xl.h            |    1 
tools/libxl/xl_cmdimpl.c    |  121 +++++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c   |    8 ++

# HG changeset patch
# User Juergen Gross <[email protected]> # Date 1322483487 -3600
# Node ID 442f86914b6027a3b7e484a46970834c1673b8d7 # Parent 8bb677cf78c3868c96e97962477f229367f01dd6 Support of xl sched-credit2

Supports the xl subcommand sched-credit2.

Signed-off-by [email protected]
docs/man/xl.pod.1 +29 -0
diff -r 8bb677cf78c3 -r 442f86914b60 docs/man/xl.pod.1
@@ -616,6 +616,35 @@ Restrict output to domains in the specif
 
 =back
 
+=item B<sched-credit2> [I<OPTIONS>]
+
+Set or get credit2 scheduler parameters.  The credit2 scheduler is a
+proportional fair share CPU scheduler built from the ground up to be
+work conserving on SMP hosts.
+
+Each domain (including Domain0) is assigned a weight.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-d DOMAIN>, B<--domain=DOMAIN>
+
+Specify domain for which scheduler parameters are to be modified or retrieved.
+Mandatory for modifying scheduler parameters.
+
+=item B<-w WEIGHT>, B<--weight=WEIGHT>
+
+A domain with a weight of 512 will get twice as much CPU as a domain
+with a weight of 256 on a contended host. Legal weights range from 1
+to 65535 and the default is 256.
+
+=item B<-p CPUPOOL>, B<--cpupool=CPUPOOL>
+
+Restrict output to domains in the specified cpupool.
+
+=back
+
 =back
 
 =head1 CPUPOOLS COMMANDS
tools/libxl/libxl.c +53 -0

59 lines not on this page · raw message

tools/libxl/libxl.h +4 -0
diff -r 8bb677cf78c3 -r 442f86914b60 tools/libxl/libxl.h
@@ -567,6 +567,10 @@ int libxl_sched_credit_domain_get(libxl_
                                   libxl_sched_credit *scinfo);
 int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
                                   libxl_sched_credit *scinfo);
+int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
+                                   libxl_sched_credit2 *scinfo);
+int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
+                                   libxl_sched_credit2 *scinfo);
 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                        char *trigger_name, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
tools/libxl/libxl_types.idl +4 -0
diff -r 8bb677cf78c3 -r 442f86914b60 tools/libxl/libxl_types.idl
@@ -375,3 +375,7 @@ libxl_sched_credit = Struct("sched_credi
     ("weight", integer),
     ("cap", integer),
     ], dispose_fn=None)
+
+libxl_sched_credit2 = Struct("sched_credit2", [
+    ("weight", integer),
+    ], dispose_fn=None)
tools/libxl/xl.h +1 -0
diff -r 8bb677cf78c3 -r 442f86914b60 tools/libxl/xl.h
@@ -55,6 +55,7 @@ int main_memmax(int argc, char **argv);
 int main_memmax(int argc, char **argv);
 int main_memset(int argc, char **argv);
 int main_sched_credit(int argc, char **argv);
+int main_sched_credit2(int argc, char **argv);
 int main_domid(int argc, char **argv);
 int main_domname(int argc, char **argv);
 int main_rename(int argc, char **argv);
tools/libxl/xl_cmdimpl.c +121 -0

133 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +8 -0
diff -r 8bb677cf78c3 -r 442f86914b60 tools/libxl/xl_cmdtable.c
@@ -196,6 +196,14 @@ struct cmd_spec cmd_table[] = {
       "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
       "-w WEIGHT, --weight=WEIGHT     Weight (int)\n"
       "-c CAP, --cap=CAP              Cap (int)\n"
+      "-p CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
+    },
+    { "sched-credit2",
+      &main_sched_credit2, 0,
+      "Get/set credit2 scheduler parameters",
+      "[-d <Domain> [-w[=WEIGHT]]] [-p CPUPOOL]",
+      "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
+      "-w WEIGHT, --weight=WEIGHT     Weight (int)\n"
       "-p CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
     },
     { "domid",

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

PATCH 1/1 Correct error message in libxl_sched_credit_domain_get()

In reply to Juergen Gross

Just a typo...

Signed-off-by [email protected]
1 file changed, 1 insertion(+), 1 deletion(-)

tools/libxl/libxl.c | 2 +-

# HG changeset patch
# User Juergen Gross <[email protected]> # Date 1322483497 -3600
# Node ID 40d8819d98ff7a1fb6d1992ad35d980f1a7d6876 # Parent 442f86914b6027a3b7e484a46970834c1673b8d7 Correct error message in libxl_sched_credit_domain_get()

Just a typo...

Signed-off-by [email protected]
tools/libxl/libxl.c +1 -1
diff -r 442f86914b60 -r 40d8819d98ff tools/libxl/libxl.c
@@ -2679,7 +2679,7 @@ int libxl_sched_credit_domain_get(libxl_
 
     rc = xc_sched_credit_domain_get(ctx->xch, domid, &sdom);
     if (rc != 0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched credit");
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched credit");
         return ERROR_FAIL;
     }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw

PATCH 1/1 Support of xl sched-sedf

In reply to Juergen Gross

Supports the xl subcommand sched-sedf.
The man page is only a minimal version (copy from xm man page without examples). BTW: the xm man page seems not to be in sync with xm sched-sedf -h regarding the time units. I used milliseconds in the xl implementation. Only minimal semantical checks of parameters.

Signed-off-by [email protected]
7 files changed, 293 insertions(+)
docs/man/xl.pod.1           |   42 ++++++++++
tools/libxl/libxl.c         |   52 +++++++++++++
tools/libxl/libxl.h         |    4 +
tools/libxl/libxl_types.idl |    8 ++
tools/libxl/xl.h            |    1 
tools/libxl/xl_cmdimpl.c    |  170 +++++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c   |   16 ++++

# HG changeset patch
# User Juergen Gross <[email protected]> # Date 1322483837 -3600
# Node ID 49e94f727d87b5f04834056175c12c5a8654f6db # Parent 40d8819d98ff7a1fb6d1992ad35d980f1a7d6876 Support of xl sched-sedf

Supports the xl subcommand sched-sedf.
The man page is only a minimal version (copy from xm man page without examples). BTW: the xm man page seems not to be in sync with xm sched-sedf -h regarding the time units. I used milliseconds in the xl implementation. Only minimal semantical checks of parameters.

Signed-off-by [email protected]
docs/man/xl.pod.1 +42 -0
diff -r 40d8819d98ff -r 49e94f727d87 docs/man/xl.pod.1
@@ -645,6 +645,48 @@ Restrict output to domains in the specif
 
 =back
 
+=item B<sched-sedf> [I<OPTIONS>]
+
+Set or get Simple EDF (Earliest Deadline First) scheduler parameters. This
+scheduler provides weighted CPU sharing in an intuitive way and uses
+realtime-algorithms to ensure time guarantees.  For more information see
+docs/misc/sedf_scheduler_mini-HOWTO.txt in the Xen distribution.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-d DOMAIN>, B<--domain=DOMAIN>
+
+Specify domain for which scheduler parameters are to be modified or retrieved.
+Mandatory for modifying scheduler parameters.
+
+=item B<-p PERIOD>, B<--period=PERIOD>
+
+The normal EDF scheduling usage in milliseconds.
+
+=item B<-s SLICE>, B<--slice=SLICE>
+
+The normal EDF scheduling usage in milliseconds.
+
+=item B<-l LATENCY>, B<--latency=LATENCY>
+
+Scaled period if domain is doing heavy I/O.
+
+=item B<-e EXTRA>, B<--extra=EXTRA>
+
+Flag for allowing domain to run in extra time (0 or 1).
+
+=item B<-w WEIGHT>, B<--weight=WEIGHT>
+
+Another way of setting CPU slice.
+
+=item B<-c CPUPOOL>, B<--cpupool=CPUPOOL>
+
+Restrict output to domains in the specified cpupool.
+
+=back
+
 =back
 
 =head1 CPUPOOLS COMMANDS
tools/libxl/libxl.c +52 -0

58 lines not on this page · raw message

tools/libxl/libxl.h +4 -0
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/libxl.h
@@ -571,6 +571,10 @@ int libxl_sched_credit2_domain_get(libxl
                                    libxl_sched_credit2 *scinfo);
 int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
                                    libxl_sched_credit2 *scinfo);
+int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
+                                libxl_sched_sedf *scinfo);
+int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
+                                libxl_sched_sedf *scinfo);
 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                        char *trigger_name, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
tools/libxl/libxl_types.idl +8 -0
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/libxl_types.idl
@@ -379,3 +379,11 @@ libxl_sched_credit2 = Struct("sched_cred
 libxl_sched_credit2 = Struct("sched_credit2", [
     ("weight", integer),
     ], dispose_fn=None)
+
+libxl_sched_sedf = Struct("sched_sedf", [
+    ("period", integer),
+    ("slice", integer),
+    ("latency", integer),
+    ("extratime", integer),
+    ("weight", integer),
+    ], dispose_fn=None)
tools/libxl/xl.h +1 -0
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/xl.h
@@ -56,6 +56,7 @@ int main_memset(int argc, char **argv);
 int main_memset(int argc, char **argv);
 int main_sched_credit(int argc, char **argv);
 int main_sched_credit2(int argc, char **argv);
+int main_sched_sedf(int argc, char **argv);
 int main_domid(int argc, char **argv);
 int main_domname(int argc, char **argv);
 int main_rename(int argc, char **argv);
tools/libxl/xl_cmdimpl.c +170 -0

182 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +16 -0
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/xl_cmdtable.c
@@ -205,6 +205,22 @@ struct cmd_spec cmd_table[] = {
       "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
       "-w WEIGHT, --weight=WEIGHT     Weight (int)\n"
       "-p CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
+    },
+    { "sched-sedf",
+      &main_sched_sedf, 0,
+      "Get/set sedf scheduler parameters",
+      "[options]",
+      "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
+      "-p MS, --period=MS             Relative deadline(ms)\n"
+      "-s MS, --slice=MS              Worst-case execution time(ms).\n"
+      "                               (slice < period)\n"
+      "-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"
+      "                               can run in extra time\n"
+      "-w FLOAT, --weight=FLOAT       CPU Period/slice (do not set with\n"
+      "                               --period/--slice)\n"
+      "-c CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
     },
     { "domid",
       &main_domid, 0,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel