* [PATCH 0 of 5] xl scheduler support
@ 2011-11-17 12:00 Juergen Gross
2011-11-17 12:00 ` [PATCH 1 of 5] xl sched-credit: support long options Juergen Gross
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Juergen Gross @ 2011-11-17 12:00 UTC (permalink / raw)
To: xen-devel
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
7 files changed, 622 insertions(+), 38 deletions(-)
docs/man/xl.pod.1 | 90 ++++++++-
tools/libxl/libxl.c | 100 ++++++++++
tools/libxl/libxl.h | 8
tools/libxl/libxl_types.idl | 13 +
tools/libxl/xl.h | 2
tools/libxl/xl_cmdimpl.c | 418 +++++++++++++++++++++++++++++++++++++++----
tools/libxl/xl_cmdtable.c | 29 ++
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1 of 5] xl sched-credit: support long options
2011-11-17 12:00 [PATCH 0 of 5] xl scheduler support Juergen Gross
@ 2011-11-17 12:00 ` Juergen Gross
2011-11-17 12:00 ` [PATCH 2 of 5] Support cpupools in xl sched-credit Juergen Gross
` (4 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2011-11-17 12:00 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 304 bytes --]
The help text of xl sched-credit supported long options. Neither the man page
nor the implementation did.
Signed-off-by: juergen.gross@ts.fujitsu.com
2 files changed, 26 insertions(+), 7 deletions(-)
docs/man/xl.pod.1 | 15 ++++++++++-----
tools/libxl/xl_cmdimpl.c | 18 ++++++++++++++++--
[-- Attachment #2: xen-staging.hg-5.patch --]
[-- Type: text/x-patch, Size: 2817 bytes --]
# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1321527655 -3600
# Node ID 59c0e68a83cf1b007fb6ff1574cdedf2dd217a42
# Parent fd3567cafe1c7ccd0ddba0ad7fb067d435e13529
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: juergen.gross@ts.fujitsu.com
diff -r fd3567cafe1c -r 59c0e68a83cf docs/man/xl.pod.1
--- a/docs/man/xl.pod.1 Tue Nov 15 14:50:18 2011 +0100
+++ b/docs/man/xl.pod.1 Thu Nov 17 12:00:55 2011 +0100
@@ -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
diff -r fd3567cafe1c -r 59c0e68a83cf tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Tue Nov 15 14:50:18 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Thu Nov 17 12:00:55 2011 +0100
@@ -3716,8 +3716,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;
@@ -3732,6 +3743,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;
}
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2 of 5] Support cpupools in xl sched-credit
2011-11-17 12:00 [PATCH 0 of 5] xl scheduler support Juergen Gross
2011-11-17 12:00 ` [PATCH 1 of 5] xl sched-credit: support long options Juergen Gross
@ 2011-11-17 12:00 ` Juergen Gross
2011-11-17 12:00 ` [PATCH 3 of 5] Support of xl sched-credit2 Juergen Gross
` (3 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2011-11-17 12:00 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
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: juergen.gross@ts.fujitsu.com
5 files changed, 98 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 | 117 ++++++++++++++++++++++++++++++++-----------
tools/libxl/xl_cmdtable.c | 5 +
[-- Attachment #2: xen-staging.hg-5.patch --]
[-- Type: text/x-patch, Size: 7908 bytes --]
# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1321531168 -3600
# Node ID 0c42b3e133bfc246174444c5f485ea92ed19d727
# Parent 59c0e68a83cf1b007fb6ff1574cdedf2dd217a42
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: juergen.gross@ts.fujitsu.com
diff -r 59c0e68a83cf -r 0c42b3e133bf docs/man/xl.pod.1
--- a/docs/man/xl.pod.1 Thu Nov 17 12:00:55 2011 +0100
+++ b/docs/man/xl.pod.1 Thu Nov 17 12:59:28 2011 +0100
@@ -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
diff -r 59c0e68a83cf -r 0c42b3e133bf tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Nov 17 12:00:55 2011 +0100
+++ b/tools/libxl/libxl.c Thu Nov 17 12:59:28 2011 +0100
@@ -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)
diff -r 59c0e68a83cf -r 0c42b3e133bf tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Thu Nov 17 12:00:55 2011 +0100
+++ b/tools/libxl/libxl_types.idl Thu Nov 17 12:59:28 2011 +0100
@@ -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", [
diff -r 59c0e68a83cf -r 0c42b3e133bf tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Thu Nov 17 12:00:55 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Thu Nov 17 12:59:28 2011 +0100
@@ -3695,25 +3695,90 @@ static int sched_credit_domain_set(
return rc;
}
-static void sched_credit_domain_output(
- int domid, libxl_sched_credit *scinfo)
+static int sched_credit_domain_output(
+ int domid)
{
char *domname;
+ libxl_sched_credit scinfo;
+ int rc;
+
+ if (domid < 0) {
+ printf("%-33s %4s %6s %4s\n", "Name", "ID", "Weight", "Cap");
+ return 0;
+ }
+ rc = sched_credit_domain_get(domid, &scinfo);
+ if (rc)
+ return rc;
domname = libxl_domid_to_name(ctx, domid);
printf("%-33s %4d %6d %4d\n",
domname,
domid,
- scinfo->weight,
- scinfo->cap);
+ scinfo.weight,
+ scinfo.cap);
free(domname);
+ return 0;
+}
+
+static int sched_domain_output(
+ uint32_t sched, int (*output)(int), const char *cpupool)
+{
+ libxl_dominfo *info;
+ libxl_cpupoolinfo *poolinfo = NULL;
+ uint32_t poolid;
+ char *poolname;
+ int nb_domain, n_pools = 0, i, p;
+ int rc = 0;
+
+ if (cpupool) {
+ if (cpupool_qualifier_to_cpupoolid(cpupool, &poolid, NULL) ||
+ !libxl_cpupoolid_to_name(ctx, poolid)) {
+ fprintf(stderr, "unknown cpupool \'%s\'\n", cpupool);
+ return -ERROR_FAIL;
+ }
+ }
+
+ info = libxl_list_domain(ctx, &nb_domain);
+ if (!info) {
+ fprintf(stderr, "libxl_domain_infolist failed.\n");
+ return 1;
+ }
+ poolinfo = libxl_list_cpupool(ctx, &n_pools);
+ if (!poolinfo) {
+ fprintf(stderr, "error getting cpupool info\n");
+ return -ERROR_NOMEM;
+ }
+
+ for (p = 0; !rc && (p < n_pools); p++) {
+ if ((poolinfo[p].sched_id != sched) ||
+ (cpupool && (poolid != poolinfo[p].poolid)))
+ continue;
+
+ poolname = libxl_cpupoolid_to_name(ctx, poolinfo[p].poolid);
+ printf("Cpupool %s:\n", poolname);
+ free(poolname);
+
+ output(-1);
+ for (i = 0; i < nb_domain; i++) {
+ if (info[i].cpupool != poolinfo[p].poolid)
+ continue;
+ rc = output(info[i].domid);
+ if (rc)
+ break;
+ }
+ }
+ if (poolinfo) {
+ for (p = 0; p < n_pools; p++) {
+ libxl_cpupoolinfo_dispose(poolinfo + p);
+ }
+ }
+ return 0;
}
int main_sched_credit(int argc, char **argv)
{
- libxl_dominfo *info;
libxl_sched_credit scinfo;
- int nb_domain, i;
- const char *dom = NULL;
+ const char *dom = NULL;
+ const char *cpupool = NULL;
int weight = 256, cap = 0, opt_w = 0, opt_c = 0;
int opt, rc;
int option_index = 0;
@@ -3721,12 +3786,13 @@ int main_sched_credit(int argc, char **a
{"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);
+ {"cpupool", 1, 0, 'p'},
+ {"help", 0, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ while (1) {
+ opt = getopt_long(argc, argv, "d:w:c:p:h", long_options, &option_index);
if (opt == -1)
break;
switch (opt) {
@@ -3743,31 +3809,26 @@ int main_sched_credit(int argc, char **a
cap = strtol(optarg, NULL, 10);
opt_c = 1;
break;
+ case 'p':
+ cpupool = optarg;
+ break;
case 'h':
help("sched-credit");
return 0;
}
}
+ if (cpupool && (dom || opt_w || opt_c)) {
+ fprintf(stderr, "Specifying a cpupool is not allowed with other options.\n");
+ return 1;
+ }
if (!dom && (opt_w || opt_c)) {
fprintf(stderr, "Must specify a domain.\n");
return 1;
}
if (!dom) { /* list all domain's credit scheduler info */
- info = libxl_list_domain(ctx, &nb_domain);
- if (!info) {
- fprintf(stderr, "libxl_domain_infolist failed.\n");
- return 1;
- }
-
- printf("%-33s %4s %6s %4s\n", "Name", "ID", "Weight", "Cap");
- for (i = 0; i < nb_domain; i++) {
- rc = sched_credit_domain_get(info[i].domid, &scinfo);
- if (rc)
- return -rc;
- sched_credit_domain_output(info[i].domid, &scinfo);
- }
+ return -sched_domain_output(XEN_SCHEDULER_CREDIT, sched_credit_domain_output, cpupool);
} else {
find_domain(dom);
@@ -3776,8 +3837,8 @@ int main_sched_credit(int argc, char **a
return -rc;
if (!opt_w && !opt_c) { /* output credit scheduler info */
- printf("%-33s %4s %6s %4s\n", "Name", "ID", "Weight", "Cap");
- sched_credit_domain_output(domid, &scinfo);
+ sched_credit_domain_output(-1);
+ return -sched_credit_domain_output(domid);
} else { /* set credit scheduler paramaters */
if (opt_w)
scinfo.weight = weight;
diff -r 59c0e68a83cf -r 0c42b3e133bf tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Thu Nov 17 12:00:55 2011 +0100
+++ b/tools/libxl/xl_cmdtable.c Thu Nov 17 12:59:28 2011 +0100
@@ -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,
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3 of 5] Support of xl sched-credit2
2011-11-17 12:00 [PATCH 0 of 5] xl scheduler support Juergen Gross
2011-11-17 12:00 ` [PATCH 1 of 5] xl sched-credit: support long options Juergen Gross
2011-11-17 12:00 ` [PATCH 2 of 5] Support cpupools in xl sched-credit Juergen Gross
@ 2011-11-17 12:00 ` Juergen Gross
2011-11-17 12:00 ` [PATCH 4 of 5] Correct error message in libxl_sched_credit_domain_get() Juergen Gross
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2011-11-17 12:00 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
Supports the xl subcommand sched-credit2.
Signed-off-by: juergen.gross@ts.fujitsu.com
7 files changed, 213 insertions(+)
docs/man/xl.pod.1 | 29 ++++++++++
tools/libxl/libxl.c | 48 +++++++++++++++++
tools/libxl/libxl.h | 4 +
tools/libxl/libxl_types.idl | 4 +
tools/libxl/xl.h | 1
tools/libxl/xl_cmdimpl.c | 119 +++++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c | 8 ++
[-- Attachment #2: xen-staging.hg-5.patch --]
[-- Type: text/x-patch, Size: 9427 bytes --]
# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1321531180 -3600
# Node ID 4760199abd593cf88b082392878689c1b22c391c
# Parent 0c42b3e133bfc246174444c5f485ea92ed19d727
Support of xl sched-credit2
Supports the xl subcommand sched-credit2.
Signed-off-by: juergen.gross@ts.fujitsu.com
diff -r 0c42b3e133bf -r 4760199abd59 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1 Thu Nov 17 12:59:28 2011 +0100
+++ b/docs/man/xl.pod.1 Thu Nov 17 12:59:40 2011 +0100
@@ -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
diff -r 0c42b3e133bf -r 4760199abd59 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Nov 17 12:59:28 2011 +0100
+++ b/tools/libxl/libxl.c Thu Nov 17 12:59:40 2011 +0100
@@ -2729,6 +2729,54 @@ int libxl_sched_credit_domain_set(libxl_
return 0;
}
+int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit2 *scinfo)
+{
+ struct xen_domctl_sched_credit2 sdom;
+ int rc;
+
+ rc = xc_sched_credit2_domain_get(ctx->xch, domid, &sdom);
+ if (rc != 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched credit2");
+ return ERROR_FAIL;
+ }
+
+ scinfo->weight = sdom.weight;
+
+ return 0;
+}
+
+int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit2 *scinfo)
+{
+ struct xen_domctl_sched_credit2 sdom;
+ xc_domaininfo_t domaininfo;
+ int rc;
+
+ rc = xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo);
+ if (rc < 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
+ return ERROR_FAIL;
+ }
+ if (rc != 1 || domaininfo.domain != domid)
+ return ERROR_INVAL;
+
+
+ if (scinfo->weight < 1 || scinfo->weight > 65535) {
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
+ "Cpu weight out of range, valid values are within range from 1 to 65535");
+ return ERROR_INVAL;
+ }
+
+ sdom.weight = scinfo->weight;
+
+ rc = xc_sched_credit2_domain_set(ctx->xch, domid, &sdom);
+ if ( rc < 0 ) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched credit2");
+ return ERROR_FAIL;
+ }
+
+ return 0;
+}
+
static int trigger_type_from_string(char *trigger_name)
{
if (!strcmp(trigger_name, "nmi"))
diff -r 0c42b3e133bf -r 4760199abd59 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Thu Nov 17 12:59:28 2011 +0100
+++ b/tools/libxl/libxl.h Thu Nov 17 12:59:40 2011 +0100
@@ -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);
diff -r 0c42b3e133bf -r 4760199abd59 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Thu Nov 17 12:59:28 2011 +0100
+++ b/tools/libxl/libxl_types.idl Thu Nov 17 12:59:40 2011 +0100
@@ -373,3 +373,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)
diff -r 0c42b3e133bf -r 4760199abd59 tools/libxl/xl.h
--- a/tools/libxl/xl.h Thu Nov 17 12:59:28 2011 +0100
+++ b/tools/libxl/xl.h Thu Nov 17 12:59:40 2011 +0100
@@ -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);
diff -r 0c42b3e133bf -r 4760199abd59 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Thu Nov 17 12:59:28 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Thu Nov 17 12:59:40 2011 +0100
@@ -3719,6 +3719,53 @@ static int sched_credit_domain_output(
return 0;
}
+static int sched_credit2_domain_get(
+ int domid, libxl_sched_credit2 *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_credit2_domain_get(ctx, domid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_credit2_domain_get failed.\n");
+
+ return rc;
+}
+
+static int sched_credit2_domain_set(
+ int domid, libxl_sched_credit2 *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_credit2_domain_set(ctx, domid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_credit2_domain_set failed.\n");
+
+ return rc;
+}
+
+static int sched_credit2_domain_output(
+ int domid)
+{
+ char *domname;
+ libxl_sched_credit2 scinfo;
+ int rc;
+
+ if (domid < 0) {
+ printf("%-33s %4s %6s\n", "Name", "ID", "Weight");
+ return 0;
+ }
+ rc = sched_credit2_domain_get(domid, &scinfo);
+ if (rc)
+ return rc;
+ domname = libxl_domid_to_name(ctx, domid);
+ printf("%-33s %4d %6d\n",
+ domname,
+ domid,
+ scinfo.weight);
+ free(domname);
+ return 0;
+}
+
static int sched_domain_output(
uint32_t sched, int (*output)(int), const char *cpupool)
{
@@ -3845,6 +3892,78 @@ int main_sched_credit(int argc, char **a
if (opt_c)
scinfo.cap = cap;
rc = sched_credit_domain_set(domid, &scinfo);
+ if (rc)
+ return -rc;
+ }
+ }
+
+ return 0;
+}
+
+int main_sched_credit2(int argc, char **argv)
+{
+ libxl_sched_credit2 scinfo;
+ const char *dom = NULL;
+ const char *cpupool = NULL;
+ int weight = 256, opt_w = 0;
+ int opt, rc;
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"domain", 1, 0, 'd'},
+ {"weight", 1, 0, 'w'},
+ {"cpupool", 1, 0, 'p'},
+ {"help", 0, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ while (1) {
+ opt = getopt_long(argc, argv, "d:w:p:h", long_options, &option_index);
+ if (opt == -1)
+ break;
+ switch (opt) {
+ case 0: case 2:
+ return opt;
+ case 'd':
+ dom = optarg;
+ break;
+ case 'w':
+ weight = strtol(optarg, NULL, 10);
+ opt_w = 1;
+ break;
+ case 'p':
+ cpupool = optarg;
+ break;
+ case 'h':
+ help("sched-credit");
+ return 0;
+ }
+ }
+
+ if (cpupool && (dom || opt_w)) {
+ fprintf(stderr, "Specifying a cpupool is not allowed with other options.\n");
+ return 1;
+ }
+ if (!dom && opt_w) {
+ fprintf(stderr, "Must specify a domain.\n");
+ return 1;
+ }
+
+ if (!dom) { /* list all domain's credit scheduler info */
+ return -sched_domain_output(XEN_SCHEDULER_CREDIT2, sched_credit2_domain_output, cpupool);
+ } else {
+ find_domain(dom);
+
+ rc = sched_credit2_domain_get(domid, &scinfo);
+ if (rc)
+ return -rc;
+
+ if (!opt_w) { /* output credit2 scheduler info */
+ sched_credit2_domain_output(-1);
+ return -sched_credit2_domain_output(domid);
+ } else { /* set credit2 scheduler paramaters */
+ if (opt_w)
+ scinfo.weight = weight;
+ rc = sched_credit2_domain_set(domid, &scinfo);
if (rc)
return -rc;
}
diff -r 0c42b3e133bf -r 4760199abd59 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Thu Nov 17 12:59:28 2011 +0100
+++ b/tools/libxl/xl_cmdtable.c Thu Nov 17 12:59:40 2011 +0100
@@ -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",
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4 of 5] Correct error message in libxl_sched_credit_domain_get()
2011-11-17 12:00 [PATCH 0 of 5] xl scheduler support Juergen Gross
` (2 preceding siblings ...)
2011-11-17 12:00 ` [PATCH 3 of 5] Support of xl sched-credit2 Juergen Gross
@ 2011-11-17 12:00 ` Juergen Gross
2011-11-17 12:00 ` [PATCH 5 of 5] Support of xl sched-sedf Juergen Gross
2011-11-23 9:11 ` [PATCH 0 of 5] xl scheduler support Dario Faggioli
5 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2011-11-17 12:00 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
Just a typo...
Signed-off-by: juergen.gross@ts.fujitsu.com
1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl.c | 2 +-
[-- Attachment #2: xen-staging.hg-5.patch --]
[-- Type: text/x-patch, Size: 835 bytes --]
# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1321531188 -3600
# Node ID 3a5111f4c9b6d4080db6b7d6415d4240140a44f9
# Parent 4760199abd593cf88b082392878689c1b22c391c
Correct error message in libxl_sched_credit_domain_get()
Just a typo...
Signed-off-by: juergen.gross@ts.fujitsu.com
diff -r 4760199abd59 -r 3a5111f4c9b6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Nov 17 12:59:40 2011 +0100
+++ b/tools/libxl/libxl.c Thu Nov 17 12:59:48 2011 +0100
@@ -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;
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5 of 5] Support of xl sched-sedf
2011-11-17 12:00 [PATCH 0 of 5] xl scheduler support Juergen Gross
` (3 preceding siblings ...)
2011-11-17 12:00 ` [PATCH 4 of 5] Correct error message in libxl_sched_credit_domain_get() Juergen Gross
@ 2011-11-17 12:00 ` Juergen Gross
2011-11-23 9:11 ` [PATCH 0 of 5] xl scheduler support Dario Faggioli
5 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2011-11-17 12:00 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 714 bytes --]
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: juergen.gross@ts.fujitsu.com
7 files changed, 284 insertions(+)
docs/man/xl.pod.1 | 42 +++++++++++
tools/libxl/libxl.c | 49 ++++++++++++
tools/libxl/libxl.h | 4 +
tools/libxl/libxl_types.idl | 8 ++
tools/libxl/xl.h | 1
tools/libxl/xl_cmdimpl.c | 164 +++++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c | 16 ++++
[-- Attachment #2: xen-staging.hg-5.patch --]
[-- Type: text/x-patch, Size: 12137 bytes --]
# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1321531194 -3600
# Node ID 69e2c7192beeb9efd657ab973fb3e942127918b7
# Parent 3a5111f4c9b6d4080db6b7d6415d4240140a44f9
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: juergen.gross@ts.fujitsu.com
diff -r 3a5111f4c9b6 -r 69e2c7192bee docs/man/xl.pod.1
--- a/docs/man/xl.pod.1 Thu Nov 17 12:59:48 2011 +0100
+++ b/docs/man/xl.pod.1 Thu Nov 17 12:59:54 2011 +0100
@@ -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
diff -r 3a5111f4c9b6 -r 69e2c7192bee tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Nov 17 12:59:48 2011 +0100
+++ b/tools/libxl/libxl.c Thu Nov 17 12:59:54 2011 +0100
@@ -2777,6 +2777,55 @@ int libxl_sched_credit2_domain_set(libxl
return 0;
}
+int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid, libxl_sched_sedf *scinfo)
+{
+ uint64_t period;
+ uint64_t slice;
+ uint64_t latency;
+ uint16_t extratime;
+ uint16_t weight;
+ int rc;
+
+ rc = xc_sedf_domain_get(ctx->xch, domid, &period, &slice, &latency, &extratime, &weight);
+ if (rc != 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched sedf");
+ return ERROR_FAIL;
+ }
+
+ scinfo->period = period / 1000000;
+ scinfo->slice = slice / 1000000;
+ scinfo->latency = latency / 1000000;
+ scinfo->extratime = extratime;
+ scinfo->weight = weight;
+
+ return 0;
+}
+
+int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid, libxl_sched_sedf *scinfo)
+{
+ xc_domaininfo_t domaininfo;
+ int rc;
+
+ rc = xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo);
+ if (rc < 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
+ return ERROR_FAIL;
+ }
+ if (rc != 1 || domaininfo.domain != domid)
+ return ERROR_INVAL;
+
+
+ rc = xc_sedf_domain_set(ctx->xch, domid, scinfo->period * 1000000,
+ scinfo->slice * 1000000, scinfo->latency * 1000000,
+ scinfo->extratime, scinfo->weight);
+ if ( rc < 0 ) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched sedf");
+ return ERROR_FAIL;
+ }
+
+ return 0;
+}
+
static int trigger_type_from_string(char *trigger_name)
{
if (!strcmp(trigger_name, "nmi"))
diff -r 3a5111f4c9b6 -r 69e2c7192bee tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Thu Nov 17 12:59:48 2011 +0100
+++ b/tools/libxl/libxl.h Thu Nov 17 12:59:54 2011 +0100
@@ -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);
diff -r 3a5111f4c9b6 -r 69e2c7192bee tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Thu Nov 17 12:59:48 2011 +0100
+++ b/tools/libxl/libxl_types.idl Thu Nov 17 12:59:54 2011 +0100
@@ -377,3 +377,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)
diff -r 3a5111f4c9b6 -r 69e2c7192bee tools/libxl/xl.h
--- a/tools/libxl/xl.h Thu Nov 17 12:59:48 2011 +0100
+++ b/tools/libxl/xl.h Thu Nov 17 12:59:54 2011 +0100
@@ -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);
diff -r 3a5111f4c9b6 -r 69e2c7192bee tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Thu Nov 17 12:59:48 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Thu Nov 17 12:59:54 2011 +0100
@@ -3766,6 +3766,57 @@ static int sched_credit2_domain_output(
return 0;
}
+static int sched_sedf_domain_get(
+ int domid, libxl_sched_sedf *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_sedf_domain_get(ctx, domid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_sedf_domain_get failed.\n");
+
+ return rc;
+}
+
+static int sched_sedf_domain_set(
+ int domid, libxl_sched_sedf *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_sedf_domain_set(ctx, domid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_sedf_domain_set failed.\n");
+
+ return rc;
+}
+
+static int sched_sedf_domain_output(
+ int domid)
+{
+ char *domname;
+ libxl_sched_sedf scinfo;
+ int rc;
+
+ if (domid < 0) {
+ printf("%-33s %4s %6s %-6s %7s %5s %6s\n", "Name", "ID", "Period", "Slice", "Latency", "Extra", "Weight");
+ return 0;
+ }
+ rc = sched_sedf_domain_get(domid, &scinfo);
+ if (rc)
+ return rc;
+ domname = libxl_domid_to_name(ctx, domid);
+ printf("%-33s %4d %6d %6d %7d %5d %6d\n",
+ domname,
+ domid,
+ scinfo.period,
+ scinfo.slice,
+ scinfo.latency,
+ scinfo.extratime,
+ scinfo.weight);
+ free(domname);
+ return 0;
+}
+
static int sched_domain_output(
uint32_t sched, int (*output)(int), const char *cpupool)
{
@@ -3964,6 +4015,119 @@ int main_sched_credit2(int argc, char **
if (opt_w)
scinfo.weight = weight;
rc = sched_credit2_domain_set(domid, &scinfo);
+ if (rc)
+ return -rc;
+ }
+ }
+
+ return 0;
+}
+
+int main_sched_sedf(int argc, char **argv)
+{
+ libxl_sched_sedf scinfo;
+ const char *dom = NULL;
+ const char *cpupool = NULL;
+ int period = 0, opt_p = 0;
+ int slice = 0, opt_s = 0;
+ int latency = 0, opt_l = 0;
+ int extra = 0, opt_e = 0;
+ int weight = 0, opt_w = 0;
+ int opt, rc;
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"period", 1, 0, 'p'},
+ {"slice", 1, 0, 's'},
+ {"latency", 1, 0, 'l'},
+ {"extra", 1, 0, 'e'},
+ {"weight", 1, 0, 'w'},
+ {"cpupool", 1, 0, 'c'},
+ {"help", 0, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ while (1) {
+ opt = getopt_long(argc, argv, "d:p:s:l:e:w:c:h", long_options, &option_index);
+ if (opt == -1)
+ break;
+ switch (opt) {
+ case 0: case 2:
+ return opt;
+ case 'd':
+ dom = optarg;
+ break;
+ case 'p':
+ period = strtol(optarg, NULL, 10);
+ opt_p = 1;
+ break;
+ case 's':
+ slice = strtol(optarg, NULL, 10);
+ opt_s = 1;
+ break;
+ case 'l':
+ latency = strtol(optarg, NULL, 10);
+ opt_l = 1;
+ break;
+ case 'e':
+ extra = strtol(optarg, NULL, 10);
+ opt_e = 1;
+ break;
+ case 'w':
+ weight = strtol(optarg, NULL, 10);
+ opt_w = 1;
+ break;
+ case 'c':
+ cpupool = optarg;
+ break;
+ case 'h':
+ help("sched-sedf");
+ return 0;
+ }
+ }
+
+ if (cpupool && (dom || opt_p || opt_s || opt_l || opt_e || opt_w)) {
+ fprintf(stderr, "Specifying a cpupool is not allowed with other options.\n");
+ return 1;
+ }
+ if (!dom && (opt_p || opt_s || opt_l || opt_e || opt_w)) {
+ fprintf(stderr, "Must specify a domain.\n");
+ return 1;
+ }
+ if (opt_w && (opt_p || opt_s)) {
+ fprintf(stderr, "Specifying a weight AND period or slice is not allowed.\n");
+ }
+
+ if (!dom) { /* list all domain's credit scheduler info */
+ return -sched_domain_output(XEN_SCHEDULER_SEDF, sched_sedf_domain_output, cpupool);
+ } else {
+ find_domain(dom);
+
+ rc = sched_sedf_domain_get(domid, &scinfo);
+ if (rc)
+ return -rc;
+
+ if (!opt_p && !opt_s && !opt_l && !opt_e && !opt_w) { /* output sedf scheduler info */
+ sched_sedf_domain_output(-1);
+ return -sched_sedf_domain_output(domid);
+ } else { /* set sedf scheduler paramaters */
+ if (opt_p) {
+ scinfo.period = period;
+ scinfo.weight = 0;
+ }
+ if (opt_s) {
+ scinfo.slice = slice;
+ scinfo.weight = 0;
+ }
+ if (opt_l)
+ scinfo.latency = latency;
+ if (opt_e)
+ scinfo.extratime = extra;
+ if (opt_w) {
+ scinfo.weight = weight;
+ scinfo.period = 0;
+ scinfo.slice = 0;
+ }
+ rc = sched_sedf_domain_set(domid, &scinfo);
if (rc)
return -rc;
}
diff -r 3a5111f4c9b6 -r 69e2c7192bee tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Thu Nov 17 12:59:48 2011 +0100
+++ b/tools/libxl/xl_cmdtable.c Thu Nov 17 12:59:54 2011 +0100
@@ -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). (slice <\n"
+ " period)\n"
+ "-l MS, --latency=MS Scaled period (ms) when domain performs\n"
+ " heavy I/O\n"
+ "-e FLAG, --extra=FLAG Flag (0 or 1) controls if domain can run\n"
+ " 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,
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-17 12:00 [PATCH 0 of 5] xl scheduler support Juergen Gross
` (4 preceding siblings ...)
2011-11-17 12:00 ` [PATCH 5 of 5] Support of xl sched-sedf Juergen Gross
@ 2011-11-23 9:11 ` Dario Faggioli
2011-11-23 9:21 ` Juergen Gross
2011-11-23 9:24 ` Ian Campbell
5 siblings, 2 replies; 15+ messages in thread
From: Dario Faggioli @ 2011-11-23 9:11 UTC (permalink / raw)
To: Juergen Gross; +Cc: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 961 bytes --]
On Thu, 2011-11-17 at 13:00 +0100, Juergen Gross wrote:
> This patch series enhances scheduler support of xl.
>
Hi Juergen,
I applied your series to test some changes I'm doing in sched_adjust,
but here's what I'm getting when I boot with sched=credit2.
# xl sched-credit2
Cpupool Pool-0:
Name ID Weight
xl: symbol lookup error: xl: undefined symbol: libxl_sched_credit2_domain_get
`xl sched-credit' seems to work fine (sedf I can't test, does not boot
on my box).
Could that be my fault? Can I do anything else to help you debug/fix
this?
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
----------------------------------------------------------------------
Dario Faggioli, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
PhD Candidate, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-23 9:11 ` [PATCH 0 of 5] xl scheduler support Dario Faggioli
@ 2011-11-23 9:21 ` Juergen Gross
2011-11-23 10:23 ` Dario Faggioli
2011-11-23 9:24 ` Ian Campbell
1 sibling, 1 reply; 15+ messages in thread
From: Juergen Gross @ 2011-11-23 9:21 UTC (permalink / raw)
To: Dario Faggioli; +Cc: xen-devel
Hi Dario,
On 11/23/2011 10:11 AM, Dario Faggioli wrote:
> On Thu, 2011-11-17 at 13:00 +0100, Juergen Gross wrote:
>> This patch series enhances scheduler support of xl.
>>
> Hi Juergen,
>
> I applied your series to test some changes I'm doing in sched_adjust,
> but here's what I'm getting when I boot with sched=credit2.
>
> # xl sched-credit2
> Cpupool Pool-0:
> Name ID Weight
> xl: symbol lookup error: xl: undefined symbol: libxl_sched_credit2_domain_get
>
> `xl sched-credit' seems to work fine (sedf I can't test, does not boot
> on my box).
>
> Could that be my fault? Can I do anything else to help you debug/fix
> this?
Are you sure the patches applied completely? libxl_sched_credit2_domain_get()
is added in the third patch to libxl.c, the usage in xl_cmdimpl.c is in the
same patch. I tested it on my box and all worked fine.
Juergen
--
Juergen Gross Principal Developer Operating Systems
PDG ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28 Internet: ts.fujitsu.com
D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-23 9:11 ` [PATCH 0 of 5] xl scheduler support Dario Faggioli
2011-11-23 9:21 ` Juergen Gross
@ 2011-11-23 9:24 ` Ian Campbell
2011-11-23 10:24 ` Dario Faggioli
1 sibling, 1 reply; 15+ messages in thread
From: Ian Campbell @ 2011-11-23 9:24 UTC (permalink / raw)
To: Dario Faggioli; +Cc: Juergen Gross, xen-devel@lists.xensource.com
On Wed, 2011-11-23 at 09:11 +0000, Dario Faggioli wrote:
> On Thu, 2011-11-17 at 13:00 +0100, Juergen Gross wrote:
> > This patch series enhances scheduler support of xl.
> >
> Hi Juergen,
>
> I applied your series to test some changes I'm doing in sched_adjust,
> but here's what I'm getting when I boot with sched=credit2.
>
> # xl sched-credit2
> Cpupool Pool-0:
> Name ID Weight
> xl: symbol lookup error: xl: undefined symbol: libxl_sched_credit2_domain_get
Is there a chance you are picking up an older version of libxl from
somewhere?
>
> `xl sched-credit' seems to work fine (sedf I can't test, does not boot
> on my box).
>
> Could that be my fault? Can I do anything else to help you debug/fix
> this?
>
> Thanks and Regards,
> Dario
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-23 9:21 ` Juergen Gross
@ 2011-11-23 10:23 ` Dario Faggioli
0 siblings, 0 replies; 15+ messages in thread
From: Dario Faggioli @ 2011-11-23 10:23 UTC (permalink / raw)
To: Juergen Gross; +Cc: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 2108 bytes --]
On Wed, 2011-11-23 at 10:21 +0100, Juergen Gross wrote:
> Hi Dario,
>
Hi,
> > Could that be my fault? Can I do anything else to help you debug/fix
> > this?
>
> Are you sure the patches applied completely? libxl_sched_credit2_domain_get()
> is added in the third patch to libxl.c, the usage in xl_cmdimpl.c is in the
> same patch. I tested it on my box and all worked fine.
>
I double checked that, but I guess so:
$ grep libxl_sched_credit2_domain_get * -R
Binary file dist/install/usr/sbin/xl matches
Binary file dist/install/usr/lib64/libxenlight.so.2.0.0 matches
Binary file dist/install/usr/lib64/libxenlight.so.2.0 matches
Binary file dist/install/usr/lib64/libxenlight.a matches
Binary file dist/install/usr/lib64/libxenlight.so matches
dist/install/usr/include/libxl.h:int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
Binary file tools/libxl/xl_cmdimpl.o matches
tools/libxl/xl_cmdimpl.c: rc = libxl_sched_credit2_domain_get(ctx, domid, scinfo);
tools/libxl/xl_cmdimpl.c: fprintf(stderr, "libxl_sched_credit2_domain_get failed.\n");
Binary file tools/libxl/libxenlight.so.2.0.0 matches
Binary file tools/libxl/xl matches
Binary file tools/libxl/libxenlight.so.2.0 matches
Binary file tools/libxl/libxl.o matches
Binary file tools/libxl/libxenlight.a matches
Binary file tools/libxl/libxenlight.so matches
tools/libxl/libxl.c:int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit2 *scinfo)
tools/libxl/xl_cmdimpl.c.orig: rc = libxl_sched_credit2_domain_get(ctx, domid, scinfo);
tools/libxl/xl_cmdimpl.c.orig: fprintf(stderr, "libxl_sched_credit2_domain_get failed.\n");
tools/libxl/libxl.h:int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-------------------------------------------------------------------
Dario Faggioli, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
PhD Candidate, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-23 9:24 ` Ian Campbell
@ 2011-11-23 10:24 ` Dario Faggioli
2011-11-23 10:55 ` Dario Faggioli
0 siblings, 1 reply; 15+ messages in thread
From: Dario Faggioli @ 2011-11-23 10:24 UTC (permalink / raw)
To: Ian Campbell; +Cc: Juergen Gross, xen-devel@lists.xensource.com
[-- Attachment #1.1: Type: text/plain, Size: 798 bytes --]
On Wed, 2011-11-23 at 09:24 +0000, Ian Campbell wrote:
> > # xl sched-credit2
> > Cpupool Pool-0:
> > Name ID Weight
> > xl: symbol lookup error: xl: undefined symbol: libxl_sched_credit2_domain_get
>
> Is there a chance you are picking up an older version of libxl from
> somewhere?
>
More than once... That should be the culprit for me too, but I'm still
trying to figure out how... :-)
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-------------------------------------------------------------------
Dario Faggioli, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
PhD Candidate, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-23 10:24 ` Dario Faggioli
@ 2011-11-23 10:55 ` Dario Faggioli
2011-11-23 11:38 ` Ian Campbell
0 siblings, 1 reply; 15+ messages in thread
From: Dario Faggioli @ 2011-11-23 10:55 UTC (permalink / raw)
To: Ian Campbell; +Cc: Juergen Gross, xen-devel@lists.xensource.com
[-- Attachment #1.1: Type: text/plain, Size: 1389 bytes --]
On Wed, 2011-11-23 at 11:24 +0100, Dario Faggioli wrote:
> On Wed, 2011-11-23 at 09:24 +0000, Ian Campbell wrote:
> > > # xl sched-credit2
> > > Cpupool Pool-0:
> > > Name ID Weight
> > > xl: symbol lookup error: xl: undefined symbol: libxl_sched_credit2_domain_get
> >
> > Is there a chance you are picking up an older version of libxl from
> > somewhere?
> >
> More than once... That should be the culprit for me too, but I'm still
> trying to figure out how... :-)
>
Ok, found! Sorry for having bothered you in the first place.
The thing is I'm running Debian Sid on the testbox, and there seems to
be no '/usr/lib64' there (neither as a real directory nor as a symlink
to '/usr/lib'), while build system put the libraries in
'dist/install/usr/lib64'. Installing the xen distribution (which is
basically unpacking an archive here) created '/ust/lib64', but it does
not appear to be on the search path for shared libraries on such
distro... Could that be an issue?
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-------------------------------------------------------------------
Dario Faggioli, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
PhD Candidate, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-23 10:55 ` Dario Faggioli
@ 2011-11-23 11:38 ` Ian Campbell
2011-11-23 12:07 ` Dario Faggioli
0 siblings, 1 reply; 15+ messages in thread
From: Ian Campbell @ 2011-11-23 11:38 UTC (permalink / raw)
To: Dario Faggioli; +Cc: Juergen Gross, xen-devel@lists.xensource.com
On Wed, 2011-11-23 at 10:55 +0000, Dario Faggioli wrote:
> On Wed, 2011-11-23 at 11:24 +0100, Dario Faggioli wrote:
> > On Wed, 2011-11-23 at 09:24 +0000, Ian Campbell wrote:
> > > > # xl sched-credit2
> > > > Cpupool Pool-0:
> > > > Name ID Weight
> > > > xl: symbol lookup error: xl: undefined symbol: libxl_sched_credit2_domain_get
> > >
> > > Is there a chance you are picking up an older version of libxl from
> > > somewhere?
> > >
> > More than once... That should be the culprit for me too, but I'm still
> > trying to figure out how... :-)
> >
> Ok, found! Sorry for having bothered you in the first place.
>
> The thing is I'm running Debian Sid on the testbox, and there seems to
> be no '/usr/lib64' there (neither as a real directory nor as a symlink
> to '/usr/lib'), while build system put the libraries in
> 'dist/install/usr/lib64'. Installing the xen distribution (which is
> basically unpacking an archive here) created '/ust/lib64', but it does
> not appear to be on the search path for shared libraries on such
> distro... Could that be an issue?
/usr/lib64 used to be a symlink to /usr/lib on Debian but that has gone
away due to the beginnings of multiarch support.
It's not clear to me if this is a bug of sorts in multiarch (or at least
in the transition) or if we ought to be doing something to work with
such systems. My build/test machines are all Debian Stable so I haven't
had to think about it too hard yet since multiarch-ification is only
going on in unstable (perhaps testing too, I don't know).
Short term you can edit config/StdGNU.mk to change LIBLEAFDIR_x86_64.
Ian.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0 of 5] xl scheduler support
2011-11-23 11:38 ` Ian Campbell
@ 2011-11-23 12:07 ` Dario Faggioli
0 siblings, 0 replies; 15+ messages in thread
From: Dario Faggioli @ 2011-11-23 12:07 UTC (permalink / raw)
To: Ian Campbell; +Cc: Juergen Gross, xen-devel@lists.xensource.com
[-- Attachment #1.1: Type: text/plain, Size: 1269 bytes --]
On Wed, 2011-11-23 at 11:38 +0000, Ian Campbell wrote:
> /usr/lib64 used to be a symlink to /usr/lib on Debian but that has gone
> away due to the beginnings of multiarch support.
>
Yep. I was thinking I've messed up something, but then I saw no symlink
on my workstation (still Sid) at all. :-)
> It's not clear to me if this is a bug of sorts in multiarch (or at least
> in the transition) or if we ought to be doing something to work with
> such systems. My build/test machines are all Debian Stable so I haven't
> had to think about it too hard yet since multiarch-ification is only
> going on in unstable (perhaps testing too, I don't know).
>
Ok, that's exactly why I fired the question.
> Short term you can edit config/StdGNU.mk to change LIBLEAFDIR_x86_64.
>
Nice. I've already put something in my scripts to cope with that, I'll
see which solution better fits my needs.
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-------------------------------------------------------------------
Dario Faggioli, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
PhD Candidate, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5 of 5] Support of xl sched-sedf
2011-11-28 12:45 [PATCH 0 of 5] v2: " Juergen Gross
@ 2011-11-28 12:46 ` Juergen Gross
0 siblings, 0 replies; 15+ messages in thread
From: Juergen Gross @ 2011-11-28 12:46 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 714 bytes --]
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: juergen.gross@ts.fujitsu.com
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 ++++
[-- Attachment #2: xen-staging.hg-5.patch --]
[-- Type: text/x-patch, Size: 12365 bytes --]
# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# 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: juergen.gross@ts.fujitsu.com
diff -r 40d8819d98ff -r 49e94f727d87 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1 Mon Nov 28 13:31:37 2011 +0100
+++ b/docs/man/xl.pod.1 Mon Nov 28 13:37:17 2011 +0100
@@ -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
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Mon Nov 28 13:31:37 2011 +0100
+++ b/tools/libxl/libxl.c Mon Nov 28 13:37:17 2011 +0100
@@ -2782,6 +2782,58 @@ int libxl_sched_credit2_domain_set(libxl
return 0;
}
+int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
+ libxl_sched_sedf *scinfo)
+{
+ uint64_t period;
+ uint64_t slice;
+ uint64_t latency;
+ uint16_t extratime;
+ uint16_t weight;
+ int rc;
+
+ rc = xc_sedf_domain_get(ctx->xch, domid, &period, &slice, &latency,
+ &extratime, &weight);
+ if (rc != 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched sedf");
+ return ERROR_FAIL;
+ }
+
+ scinfo->period = period / 1000000;
+ scinfo->slice = slice / 1000000;
+ scinfo->latency = latency / 1000000;
+ scinfo->extratime = extratime;
+ scinfo->weight = weight;
+
+ return 0;
+}
+
+int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
+ libxl_sched_sedf *scinfo)
+{
+ xc_domaininfo_t domaininfo;
+ int rc;
+
+ rc = xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo);
+ if (rc < 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
+ return ERROR_FAIL;
+ }
+ if (rc != 1 || domaininfo.domain != domid)
+ return ERROR_INVAL;
+
+
+ rc = xc_sedf_domain_set(ctx->xch, domid, scinfo->period * 1000000,
+ scinfo->slice * 1000000, scinfo->latency * 1000000,
+ scinfo->extratime, scinfo->weight);
+ if ( rc < 0 ) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched sedf");
+ return ERROR_FAIL;
+ }
+
+ return 0;
+}
+
static int trigger_type_from_string(char *trigger_name)
{
if (!strcmp(trigger_name, "nmi"))
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Mon Nov 28 13:31:37 2011 +0100
+++ b/tools/libxl/libxl.h Mon Nov 28 13:37:17 2011 +0100
@@ -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);
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Mon Nov 28 13:31:37 2011 +0100
+++ b/tools/libxl/libxl_types.idl Mon Nov 28 13:37:17 2011 +0100
@@ -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)
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/xl.h
--- a/tools/libxl/xl.h Mon Nov 28 13:31:37 2011 +0100
+++ b/tools/libxl/xl.h Mon Nov 28 13:37:17 2011 +0100
@@ -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);
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Mon Nov 28 13:31:37 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Mon Nov 28 13:37:17 2011 +0100
@@ -3770,6 +3770,58 @@ static int sched_credit2_domain_output(
return 0;
}
+static int sched_sedf_domain_get(
+ int domid, libxl_sched_sedf *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_sedf_domain_get(ctx, domid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_sedf_domain_get failed.\n");
+
+ return rc;
+}
+
+static int sched_sedf_domain_set(
+ int domid, libxl_sched_sedf *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_sedf_domain_set(ctx, domid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_sedf_domain_set failed.\n");
+
+ return rc;
+}
+
+static int sched_sedf_domain_output(
+ int domid)
+{
+ char *domname;
+ libxl_sched_sedf scinfo;
+ int rc;
+
+ if (domid < 0) {
+ printf("%-33s %4s %6s %-6s %7s %5s %6s\n", "Name", "ID", "Period",
+ "Slice", "Latency", "Extra", "Weight");
+ return 0;
+ }
+ rc = sched_sedf_domain_get(domid, &scinfo);
+ if (rc)
+ return rc;
+ domname = libxl_domid_to_name(ctx, domid);
+ printf("%-33s %4d %6d %6d %7d %5d %6d\n",
+ domname,
+ domid,
+ scinfo.period,
+ scinfo.slice,
+ scinfo.latency,
+ scinfo.extratime,
+ scinfo.weight);
+ free(domname);
+ return 0;
+}
+
static int sched_domain_output(
uint32_t sched, int (*output)(int), const char *cpupool)
{
@@ -3973,6 +4025,124 @@ int main_sched_credit2(int argc, char **
if (opt_w)
scinfo.weight = weight;
rc = sched_credit2_domain_set(domid, &scinfo);
+ if (rc)
+ return -rc;
+ }
+ }
+
+ return 0;
+}
+
+int main_sched_sedf(int argc, char **argv)
+{
+ libxl_sched_sedf scinfo;
+ const char *dom = NULL;
+ const char *cpupool = NULL;
+ int period = 0, opt_p = 0;
+ int slice = 0, opt_s = 0;
+ int latency = 0, opt_l = 0;
+ int extra = 0, opt_e = 0;
+ int weight = 0, opt_w = 0;
+ int opt, rc;
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"period", 1, 0, 'p'},
+ {"slice", 1, 0, 's'},
+ {"latency", 1, 0, 'l'},
+ {"extra", 1, 0, 'e'},
+ {"weight", 1, 0, 'w'},
+ {"cpupool", 1, 0, 'c'},
+ {"help", 0, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ while (1) {
+ opt = getopt_long(argc, argv, "d:p:s:l:e:w:c:h", long_options,
+ &option_index);
+ if (opt == -1)
+ break;
+ switch (opt) {
+ case 0: case 2:
+ return opt;
+ case 'd':
+ dom = optarg;
+ break;
+ case 'p':
+ period = strtol(optarg, NULL, 10);
+ opt_p = 1;
+ break;
+ case 's':
+ slice = strtol(optarg, NULL, 10);
+ opt_s = 1;
+ break;
+ case 'l':
+ latency = strtol(optarg, NULL, 10);
+ opt_l = 1;
+ break;
+ case 'e':
+ extra = strtol(optarg, NULL, 10);
+ opt_e = 1;
+ break;
+ case 'w':
+ weight = strtol(optarg, NULL, 10);
+ opt_w = 1;
+ break;
+ case 'c':
+ cpupool = optarg;
+ break;
+ case 'h':
+ help("sched-sedf");
+ return 0;
+ }
+ }
+
+ if (cpupool && (dom || opt_p || opt_s || opt_l || opt_e || opt_w)) {
+ fprintf(stderr, "Specifying a cpupool is not allowed with other "
+ "options.\n");
+ return 1;
+ }
+ if (!dom && (opt_p || opt_s || opt_l || opt_e || opt_w)) {
+ fprintf(stderr, "Must specify a domain.\n");
+ return 1;
+ }
+ if (opt_w && (opt_p || opt_s)) {
+ fprintf(stderr, "Specifying a weight AND period or slice is not "
+ "allowed.\n");
+ }
+
+ if (!dom) { /* list all domain's credit scheduler info */
+ return -sched_domain_output(XEN_SCHEDULER_SEDF,
+ sched_sedf_domain_output, cpupool);
+ } else {
+ find_domain(dom);
+
+ rc = sched_sedf_domain_get(domid, &scinfo);
+ if (rc)
+ return -rc;
+
+ if (!opt_p && !opt_s && !opt_l && !opt_e && !opt_w) {
+ /* output sedf scheduler info */
+ sched_sedf_domain_output(-1);
+ return -sched_sedf_domain_output(domid);
+ } else { /* set sedf scheduler paramaters */
+ if (opt_p) {
+ scinfo.period = period;
+ scinfo.weight = 0;
+ }
+ if (opt_s) {
+ scinfo.slice = slice;
+ scinfo.weight = 0;
+ }
+ if (opt_l)
+ scinfo.latency = latency;
+ if (opt_e)
+ scinfo.extratime = extra;
+ if (opt_w) {
+ scinfo.weight = weight;
+ scinfo.period = 0;
+ scinfo.slice = 0;
+ }
+ rc = sched_sedf_domain_set(domid, &scinfo);
if (rc)
return -rc;
}
diff -r 40d8819d98ff -r 49e94f727d87 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Mon Nov 28 13:31:37 2011 +0100
+++ b/tools/libxl/xl_cmdtable.c Mon Nov 28 13:37:17 2011 +0100
@@ -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,
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2011-11-28 12:46 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 12:00 [PATCH 0 of 5] xl scheduler support Juergen Gross
2011-11-17 12:00 ` [PATCH 1 of 5] xl sched-credit: support long options Juergen Gross
2011-11-17 12:00 ` [PATCH 2 of 5] Support cpupools in xl sched-credit Juergen Gross
2011-11-17 12:00 ` [PATCH 3 of 5] Support of xl sched-credit2 Juergen Gross
2011-11-17 12:00 ` [PATCH 4 of 5] Correct error message in libxl_sched_credit_domain_get() Juergen Gross
2011-11-17 12:00 ` [PATCH 5 of 5] Support of xl sched-sedf Juergen Gross
2011-11-23 9:11 ` [PATCH 0 of 5] xl scheduler support Dario Faggioli
2011-11-23 9:21 ` Juergen Gross
2011-11-23 10:23 ` Dario Faggioli
2011-11-23 9:24 ` Ian Campbell
2011-11-23 10:24 ` Dario Faggioli
2011-11-23 10:55 ` Dario Faggioli
2011-11-23 11:38 ` Ian Campbell
2011-11-23 12:07 ` Dario Faggioli
-- strict thread matches above, loose matches on Subject: below --
2011-11-28 12:45 [PATCH 0 of 5] v2: " Juergen Gross
2011-11-28 12:46 ` [PATCH 5 of 5] Support of xl sched-sedf Juergen Gross
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).