From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com
Subject: [PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et
Date: Tue, 21 Feb 2012 13:34:14 +0000 [thread overview]
Message-ID: <d70161aab13edea6f2f4.1329831254@kodo2> (raw)
In-Reply-To: <patchbomb.1329831246@kodo2>
Implement functions to set credit scheduler global parameters.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 127b33c09db2 -r d70161aab13e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Tue Feb 21 12:14:32 2012 +0000
+++ b/tools/libxl/libxl.c Tue Feb 21 12:17:12 2012 +0000
@@ -3032,6 +3032,65 @@ int libxl_sched_credit_domain_set(libxl_
return 0;
}
+int libxl_sched_credit_param_get(libxl_ctx *ctx, uint32_t poolid, libxl_sched_credit_param *scinfo)
+{
+ struct xen_sysctl_credit_schedule sparam;
+ int rc;
+
+ rc = xc_sched_credit_param_get(ctx->xch, poolid, &sparam);
+ if (rc != 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting sched credit param");
+ return ERROR_FAIL;
+ }
+
+ scinfo->tslice_ms = sparam.tslice_ms;
+ scinfo->ratelimit_us = sparam.ratelimit_us;
+
+ return 0;
+}
+
+int libxl_sched_credit_param_set(libxl_ctx *ctx, uint32_t poolid, libxl_sched_credit_param *scinfo)
+{
+ struct xen_sysctl_credit_schedule sparam;
+ int rc=0;
+
+ if (scinfo->tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN
+ || scinfo->tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "Time slice out of range, valid range is from %d to %d",
+ XEN_SYSCTL_CSCHED_TSLICE_MIN,
+ XEN_SYSCTL_CSCHED_TSLICE_MAX);
+ return ERROR_INVAL;
+ }
+ if (scinfo->ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN
+ || scinfo->ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "Ratelimit out of range, valid range is from %d to %d",
+ XEN_SYSCTL_SCHED_RATELIMIT_MIN,
+ XEN_SYSCTL_SCHED_RATELIMIT_MAX);
+ return ERROR_INVAL;
+ }
+ if (scinfo->ratelimit_us > scinfo->tslice_ms*1000) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "Ratelimit cannot be greater than timeslice\n");
+ return ERROR_INVAL;
+ }
+
+ sparam.tslice_ms = scinfo->tslice_ms;
+ sparam.ratelimit_us = scinfo->ratelimit_us;
+
+ rc = xc_sched_credit_param_set(ctx->xch, poolid, &sparam);
+ if ( rc < 0 ) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting sched credit param");
+ return ERROR_FAIL;
+ }
+
+ scinfo->tslice_ms = sparam.tslice_ms;
+ scinfo->ratelimit_us = sparam.ratelimit_us;
+
+ return 0;
+}
+
int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
libxl_sched_credit2_domain *scinfo)
{
diff -r 127b33c09db2 -r d70161aab13e tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Tue Feb 21 12:14:32 2012 +0000
+++ b/tools/libxl/libxl.h Tue Feb 21 12:17:12 2012 +0000
@@ -591,6 +591,10 @@ int libxl_sched_credit_domain_get(libxl_
libxl_sched_credit_domain *scinfo);
int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
libxl_sched_credit_domain *scinfo);
+int libxl_sched_credit_param_get(libxl_ctx *ctx, uint32_t poolid,
+ libxl_sched_credit_param *scinfo);
+int libxl_sched_credit_param_set(libxl_ctx *ctx, uint32_t poolid,
+ libxl_sched_credit_param *scinfo);
int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
libxl_sched_credit2_domain *scinfo);
int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
diff -r 127b33c09db2 -r d70161aab13e tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Tue Feb 21 12:14:32 2012 +0000
+++ b/tools/libxl/libxl_types.idl Tue Feb 21 12:17:12 2012 +0000
@@ -395,6 +395,11 @@ libxl_sched_credit_domain = Struct("sche
("cap", integer),
], dispose_fn=None)
+libxl_sched_credit_param = Struct("sched_credit_param", [
+ ("tslice_ms", integer),
+ ("ratelimit_us", integer),
+ ], dispose_fn=None)
+
libxl_sched_credit2_domain = Struct("sched_credit2_domain", [
("weight", integer),
], dispose_fn=None)
next prev parent reply other threads:[~2012-02-21 13:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-21 13:34 [PATCH 00 of 10] Allow user to configure credit scheduler parameters George Dunlap
2012-02-21 13:34 ` [PATCH 01 of 10] cleanup: Remove dependency files in efi directory during a make clean George Dunlap
2012-02-21 13:34 ` [PATCH 02 of 10] xen: Add a #define for the default ratelimit George Dunlap
2012-02-21 13:34 ` [PATCH 03 of 10] xen: Print ratelimit in scheduler debugkey George Dunlap
2012-02-21 13:34 ` [PATCH 04 of 10] xen: Implement SCHEDOP sysctl for credit scheduler George Dunlap
2012-02-21 13:34 ` [PATCH 05 of 10] libxc: " George Dunlap
2012-02-21 17:49 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 06 of 10] libxl: cleanup: Remove pointless ERRNOVAL George Dunlap
2012-02-21 17:46 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 07 of 10] libxl: Rename libxl_sched_* to include _domain George Dunlap
2012-02-21 17:52 ` Ian Jackson
2012-02-21 17:54 ` George Dunlap
2012-02-21 13:34 ` George Dunlap [this message]
2012-02-21 17:51 ` [PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et Ian Jackson
2012-02-21 17:56 ` George Dunlap
2012-02-21 17:57 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 09 of 10] xl: Refactor sched_domain_output to have a callback for pool information George Dunlap
2012-02-21 17:49 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 10 of 10] xl: Implement sched-credit schedule parameter command-line interface George Dunlap
2012-02-21 17:56 ` Ian Jackson
2012-02-21 18:11 ` George Dunlap
2012-02-21 18:17 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d70161aab13edea6f2f4.1329831254@kodo2 \
--to=george.dunlap@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).