George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 00 of 10] Allow user to configure credit scheduler parameters
This patch series introduces hypercalls to allow the timeslice and ratelimit parameters of the credit scheduler to be read and tweaked, and plumbed all the way through to the xl command-line. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 01 of 10] cleanup: Remove dependency files in efi directory during a make clean
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> diff -r 87218bd367be -r 0402fc3aeaf3 xen/arch/x86/Makefile --- a/xen/arch/x86/Makefile Fri Feb 17 12:24:38 2012 +0000 +++ b/xen/arch/x86/Makefile Tue Feb 21 11:25:21 2012 +0000 @@ -168,5 +168,5 @@ efi/mkreloc: efi/mkreloc.c clean:: rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32 rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d - rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc + rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc efi/.*.d rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 02 of 10] xen: Add a #define for the default ratelimit
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 0402fc3aeaf3 -r c91f3f39e7df xen/common/schedule.c
--- a/xen/common/schedule.c Tue Feb 21 11:25:21 2012 +0000
+++ b/xen/common/schedule.c Tue Feb 21 11:26:37 2012 +0000
@@ -50,7 +50,7 @@ boolean_param("sched_smt_power_savings",
/* Default scheduling rate limit: 1ms
* The behavior when sched_ratelimit_us is greater than sched_credit_tslice_ms
is undefined
* */
-int sched_ratelimit_us = 1000;
+int sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
integer_param("sched_ratelimit_us", sched_ratelimit_us);
/* Various timer handlers. */
static void s_timer_fn(void *unused);
diff -r 0402fc3aeaf3 -r c91f3f39e7df xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h Tue Feb 21 11:25:21 2012 +0000
+++ b/xen/include/xen/sched-if.h Tue Feb 21 11:26:37 2012 +0000
@@ -18,6 +18,7 @@ extern cpumask_t cpupool_free_cpus;
/* Scheduler generic parameters
* */
+#define SCHED_DEFAULT_RATELIMIT_US 1000
extern int sched_ratelimit_us;
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 03 of 10] xen: Print ratelimit in scheduler debugkey
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r c91f3f39e7df -r 38e532667238 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Tue Feb 21 11:26:37 2012 +0000
+++ b/xen/common/sched_credit.c Tue Feb 21 11:44:19 2012 +0000
@@ -1504,6 +1504,7 @@ csched_dump(const struct scheduler *ops)
"\trunq_sort = %u\n"
"\tdefault-weight = %d\n"
"\ttslice = %dms\n"
+ "\tratelimit = %dus\n"
"\tcredits per msec = %d\n"
"\tticks per tslice = %d\n"
"\tmigration delay = %uus\n",
@@ -1515,6 +1516,7 @@ csched_dump(const struct scheduler *ops)
prv->runq_sort,
CSCHED_DEFAULT_WEIGHT,
prv->tslice_ms,
+ prv->ratelimit_us,
CSCHED_CREDITS_PER_MSEC,
prv->ticks_per_tslice,
vcpu_migration_delay);
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 04 of 10] xen: Implement SCHEDOP sysctl for credit scheduler
Allow tslice_ms and ratelimit_us to be modified.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 38e532667238 -r 4ce1812b0249 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Tue Feb 21 11:44:19 2012 +0000
+++ b/xen/common/sched_credit.c Tue Feb 21 12:14:18 2012 +0000
@@ -833,6 +833,36 @@ csched_dom_cntl(
return 0;
}
+static int
+csched_sys_cntl(const struct scheduler *ops,
+ struct xen_sysctl_scheduler_op *sc)
+{
+ int rc = -EINVAL;
+ xen_sysctl_credit_schedule_t *params = &sc->u.sched_credit;
+ struct csched_private *prv = CSCHED_PRIV(ops);
+
+ switch ( sc->cmd )
+ {
+ case XEN_SYSCTL_SCHEDOP_putinfo:
+ if (params->tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+ || params->tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN
+ || params->ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+ || params->ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN
+ || MICROSECS(params->ratelimit_us) >
MILLISECS(params->tslice_ms) )
+ goto out;
+ prv->tslice_ms = params->tslice_ms;
+ prv->ratelimit_us = params->ratelimit_us;
+ /* FALLTHRU */
+ case XEN_SYSCTL_SCHEDOP_getinfo:
+ params->tslice_ms = prv->tslice_ms;
+ params->ratelimit_us = prv->ratelimit_us;
+ rc = 0;
+ break;
+ }
+ out:
+ return rc;
+}
+
static void *
csched_alloc_domdata(const struct scheduler *ops, struct domain *dom)
{
@@ -1566,6 +1596,28 @@ csched_init(struct scheduler *ops)
INIT_LIST_HEAD(&prv->active_sdom);
prv->master = UINT_MAX;
+ if ( sched_credit_tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+ || sched_credit_tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN )
+ {
+ printk("WARNING: sched_credit_tslice_ms outside of valid range
[%d,%d].\n"
+ " Resetting to default %u\n",
+ XEN_SYSCTL_CSCHED_TSLICE_MIN,
+ XEN_SYSCTL_CSCHED_TSLICE_MAX,
+ CSCHED_DEFAULT_TSLICE_MS);
+ sched_credit_tslice_ms = CSCHED_DEFAULT_TSLICE_MS;
+ }
+
+ if ( sched_ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+ || sched_ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN )
+ {
+ printk("WARNING: sched_ratelimit_us outside of valid range
[%d,%d].\n"
+ " Resetting to default %u\n",
+ XEN_SYSCTL_SCHED_RATELIMIT_MIN,
+ XEN_SYSCTL_SCHED_RATELIMIT_MAX,
+ SCHED_DEFAULT_RATELIMIT_US);
+ sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
+ }
+
prv->tslice_ms = sched_credit_tslice_ms;
prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE;
if ( prv->tslice_ms < prv->ticks_per_tslice )
@@ -1641,6 +1693,7 @@ const struct scheduler sched_credit_def
.yield = csched_vcpu_yield,
.adjust = csched_dom_cntl,
+ .adjust_global = csched_sys_cntl,
.pick_cpu = csched_cpu_pick,
.do_schedule = csched_schedule,
diff -r 38e532667238 -r 4ce1812b0249 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h Tue Feb 21 11:44:19 2012 +0000
+++ b/xen/include/public/sysctl.h Tue Feb 21 12:14:18 2012 +0000
@@ -564,6 +564,19 @@ struct xen_sysctl_arinc653_schedule {
typedef struct xen_sysctl_arinc653_schedule xen_sysctl_arinc653_schedule_t;
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_arinc653_schedule_t);
+struct xen_sysctl_credit_schedule {
+ /* Length of timeslice in milliseconds */
+#define XEN_SYSCTL_CSCHED_TSLICE_MAX 1000
+#define XEN_SYSCTL_CSCHED_TSLICE_MIN 1
+ unsigned tslice_ms;
+ /* Rate limit (minimum timeslice) in microseconds */
+#define XEN_SYSCTL_SCHED_RATELIMIT_MAX 500000
+#define XEN_SYSCTL_SCHED_RATELIMIT_MIN 100
+ unsigned ratelimit_us;
+};
+typedef struct xen_sysctl_credit_schedule xen_sysctl_credit_schedule_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_credit_schedule_t);
+
/* XEN_SYSCTL_scheduler_op */
/* Set or get info? */
#define XEN_SYSCTL_SCHEDOP_putinfo 0
@@ -576,6 +589,7 @@ struct xen_sysctl_scheduler_op {
struct xen_sysctl_sched_arinc653 {
XEN_GUEST_HANDLE_64(xen_sysctl_arinc653_schedule_t) schedule;
} sched_arinc653;
+ struct xen_sysctl_credit_schedule sched_credit;
} u;
};
typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 05 of 10] libxc: Implement SCHEDOP sysctl for credit scheduler
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 4ce1812b0249 -r 5e3ca9be617e tools/libxc/xc_csched.c
--- a/tools/libxc/xc_csched.c Tue Feb 21 12:14:18 2012 +0000
+++ b/tools/libxc/xc_csched.c Tue Feb 21 12:14:32 2012 +0000
@@ -61,3 +61,47 @@ xc_sched_credit_domain_get(
return err;
}
+
+int
+xc_sched_credit_param_set(
+ xc_interface *xch,
+ uint32_t cpupool_id,
+ struct xen_sysctl_credit_schedule *schedule)
+{
+ int rc;
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_scheduler_op;
+ sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+ sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+ sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_putinfo;
+
+ sysctl.u.scheduler_op.u.sched_credit = *schedule;
+
+ rc = do_sysctl(xch, &sysctl);
+
+ *schedule = sysctl.u.scheduler_op.u.sched_credit;
+
+ return rc;
+}
+
+int
+xc_sched_credit_param_get(
+ xc_interface *xch,
+ uint32_t cpupool_id,
+ struct xen_sysctl_credit_schedule *schedule)
+{
+ int rc;
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_scheduler_op;
+ sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+ sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+ sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_getinfo;
+
+ rc = do_sysctl(xch, &sysctl);
+
+ *schedule = sysctl.u.scheduler_op.u.sched_credit;
+
+ return rc;
+}
diff -r 4ce1812b0249 -r 5e3ca9be617e tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Tue Feb 21 12:14:18 2012 +0000
+++ b/tools/libxc/xenctrl.h Tue Feb 21 12:14:32 2012 +0000
@@ -668,7 +668,12 @@ int xc_sched_credit_domain_set(xc_interf
int xc_sched_credit_domain_get(xc_interface *xch,
uint32_t domid,
struct xen_domctl_sched_credit *sdom);
-
+int xc_sched_credit_param_set(xc_interface *xch,
+ uint32_t cpupool_id,
+ struct xen_sysctl_credit_schedule *schedule);
+int xc_sched_credit_param_get(xc_interface *xch,
+ uint32_t cpupool_id,
+ struct xen_sysctl_credit_schedule *schedule);
int xc_sched_credit2_domain_set(xc_interface *xch,
uint32_t domid,
struct xen_domctl_sched_credit2 *sdom);
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 06 of 10] libxl: cleanup: Remove pointless ERRNOVAL
Just call LIBXL__LOG rather than passing a meaningless ERRNOVAL.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 5e3ca9be617e -r 0f97e5c69eeb 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:14:32 2012 +0000
@@ -3008,13 +3008,13 @@ int libxl_sched_credit_domain_set(libxl_
if (scinfo->weight < 1 || scinfo->weight > 65535) {
- LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
"Cpu weight out of range, valid values are within range from 1
to 65535");
return ERROR_INVAL;
}
if (scinfo->cap < 0 || scinfo->cap > (domaininfo.max_vcpu_id +
1) * 100) {
- LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
"Cpu cap out of range, valid range is from 0 to %d for
specified number of vcpus",
((domaininfo.max_vcpu_id + 1) * 100));
return ERROR_INVAL;
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 07 of 10] libxl: Rename libxl_sched_* to include _domain
In preparation for introducing a schedule parameter-based structure,
rename libxl_sched_{credit,credit2,sedf} to libxl_sched_{}_domain.
No functional changes.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 0f97e5c69eeb -r 127b33c09db2 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:14:32 2012 +0000
@@ -2975,7 +2975,7 @@ int libxl_get_sched_id(libxl_ctx *ctx)
return sched;
}
-int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
libxl_sched_credit *scinfo)
+int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
libxl_sched_credit_domain *scinfo)
{
struct xen_domctl_sched_credit sdom;
int rc;
@@ -2992,7 +2992,7 @@ int libxl_sched_credit_domain_get(libxl_
return 0;
}
-int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
libxl_sched_credit *scinfo)
+int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
libxl_sched_credit_domain *scinfo)
{
struct xen_domctl_sched_credit sdom;
xc_domaininfo_t domaininfo;
@@ -3033,7 +3033,7 @@ int libxl_sched_credit_domain_set(libxl_
}
int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_credit2 *scinfo)
+ libxl_sched_credit2_domain *scinfo)
{
struct xen_domctl_sched_credit2 sdom;
int rc;
@@ -3051,7 +3051,7 @@ int libxl_sched_credit2_domain_get(libxl
}
int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_credit2 *scinfo)
+ libxl_sched_credit2_domain *scinfo)
{
struct xen_domctl_sched_credit2 sdom;
xc_domaininfo_t domaininfo;
@@ -3086,7 +3086,7 @@ int libxl_sched_credit2_domain_set(libxl
}
int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_sedf *scinfo)
+ libxl_sched_sedf_domain *scinfo)
{
uint64_t period;
uint64_t slice;
@@ -3112,7 +3112,7 @@ int libxl_sched_sedf_domain_get(libxl_ct
}
int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_sedf *scinfo)
+ libxl_sched_sedf_domain *scinfo)
{
xc_domaininfo_t domaininfo;
int rc;
diff -r 0f97e5c69eeb -r 127b33c09db2 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:14:32 2012 +0000
@@ -588,17 +588,17 @@ int libxl_get_sched_id(libxl_ctx *ctx);
int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_credit *scinfo);
+ libxl_sched_credit_domain *scinfo);
int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_credit *scinfo);
+ libxl_sched_credit_domain *scinfo);
int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_credit2 *scinfo);
+ libxl_sched_credit2_domain *scinfo);
int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_credit2 *scinfo);
+ libxl_sched_credit2_domain *scinfo);
int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_sedf *scinfo);
+ libxl_sched_sedf_domain *scinfo);
int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
- libxl_sched_sedf *scinfo);
+ libxl_sched_sedf_domain *scinfo);
int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
libxl_trigger trigger, uint32_t vcpuid);
int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
diff -r 0f97e5c69eeb -r 127b33c09db2 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:14:32 2012 +0000
@@ -390,16 +390,16 @@ libxl_cputopology = Struct("cputopology"
("node", uint32),
])
-libxl_sched_credit = Struct("sched_credit", [
+libxl_sched_credit_domain = Struct("sched_credit_domain", [
("weight", integer),
("cap", integer),
], dispose_fn=None)
-libxl_sched_credit2 = Struct("sched_credit2", [
+libxl_sched_credit2_domain = Struct("sched_credit2_domain", [
("weight", integer),
], dispose_fn=None)
-libxl_sched_sedf = Struct("sched_sedf", [
+libxl_sched_sedf_domain = Struct("sched_sedf_domain", [
("period", integer),
("slice", integer),
("latency", integer),
diff -r 0f97e5c69eeb -r 127b33c09db2 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Tue Feb 21 12:14:32 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c Tue Feb 21 12:14:32 2012 +0000
@@ -3913,7 +3913,7 @@ int main_sharing(int argc, char **argv)
}
static int sched_credit_domain_get(
- int domid, libxl_sched_credit *scinfo)
+ int domid, libxl_sched_credit_domain *scinfo)
{
int rc;
@@ -3925,7 +3925,7 @@ static int sched_credit_domain_get(
}
static int sched_credit_domain_set(
- int domid, libxl_sched_credit *scinfo)
+ int domid, libxl_sched_credit_domain *scinfo)
{
int rc;
@@ -3940,7 +3940,7 @@ static int sched_credit_domain_output(
int domid)
{
char *domname;
- libxl_sched_credit scinfo;
+ libxl_sched_credit_domain scinfo;
int rc;
if (domid < 0) {
@@ -3961,7 +3961,7 @@ static int sched_credit_domain_output(
}
static int sched_credit2_domain_get(
- int domid, libxl_sched_credit2 *scinfo)
+ int domid, libxl_sched_credit2_domain *scinfo)
{
int rc;
@@ -3973,7 +3973,7 @@ static int sched_credit2_domain_get(
}
static int sched_credit2_domain_set(
- int domid, libxl_sched_credit2 *scinfo)
+ int domid, libxl_sched_credit2_domain *scinfo)
{
int rc;
@@ -3988,7 +3988,7 @@ static int sched_credit2_domain_output(
int domid)
{
char *domname;
- libxl_sched_credit2 scinfo;
+ libxl_sched_credit2_domain scinfo;
int rc;
if (domid < 0) {
@@ -4008,7 +4008,7 @@ static int sched_credit2_domain_output(
}
static int sched_sedf_domain_get(
- int domid, libxl_sched_sedf *scinfo)
+ int domid, libxl_sched_sedf_domain *scinfo)
{
int rc;
@@ -4020,7 +4020,7 @@ static int sched_sedf_domain_get(
}
static int sched_sedf_domain_set(
- int domid, libxl_sched_sedf *scinfo)
+ int domid, libxl_sched_sedf_domain *scinfo)
{
int rc;
@@ -4035,7 +4035,7 @@ static int sched_sedf_domain_output(
int domid)
{
char *domname;
- libxl_sched_sedf scinfo;
+ libxl_sched_sedf_domain scinfo;
int rc;
if (domid < 0) {
@@ -4116,7 +4116,7 @@ static int sched_domain_output(
int main_sched_credit(int argc, char **argv)
{
- libxl_sched_credit scinfo;
+ libxl_sched_credit_domain scinfo;
const char *dom = NULL;
const char *cpupool = NULL;
int weight = 256, cap = 0, opt_w = 0, opt_c = 0;
@@ -4198,7 +4198,7 @@ int main_sched_credit(int argc, char **a
int main_sched_credit2(int argc, char **argv)
{
- libxl_sched_credit2 scinfo;
+ libxl_sched_credit2_domain scinfo;
const char *dom = NULL;
const char *cpupool = NULL;
int weight = 256, opt_w = 0;
@@ -4272,7 +4272,7 @@ int main_sched_credit2(int argc, char **
int main_sched_sedf(int argc, char **argv)
{
- libxl_sched_sedf scinfo;
+ libxl_sched_sedf_domain scinfo;
const char *dom = NULL;
const char *cpupool = NULL;
int period = 0, opt_p = 0;
diff -r 0f97e5c69eeb -r 127b33c09db2 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c Tue Feb 21 12:14:32 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c Tue Feb 21 12:14:32 2012 +0000
@@ -473,7 +473,7 @@ value stub_xl_sched_credit_domain_get(va
{
CAMLparam1(domid);
CAMLlocal1(scinfo);
- libxl_sched_credit c_scinfo;
+ libxl_sched_credit_domain c_scinfo;
int ret;
INIT_STRUCT();
@@ -483,18 +483,18 @@ value stub_xl_sched_credit_domain_get(va
failwith_xl("sched_credit_domain_get", &lg);
FREE_CTX();
- scinfo = Val_sched_credit(&gc, &lg, &c_scinfo);
+ scinfo = Val_sched_credit_domain(&gc, &lg, &c_scinfo);
CAMLreturn(scinfo);
}
value stub_xl_sched_credit_domain_set(value domid, value scinfo)
{
CAMLparam2(domid, scinfo);
- libxl_sched_credit c_scinfo;
+ libxl_sched_credit_domain c_scinfo;
int ret;
INIT_STRUCT();
- sched_credit_val(&gc, &lg, &c_scinfo, scinfo);
+ sched_credit_domain_val(&gc, &lg, &c_scinfo, scinfo);
INIT_CTX();
ret = libxl_sched_credit_domain_set(ctx, Int_val(domid), &c_scinfo);
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et
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)
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 09 of 10] xl: Refactor sched_domain_output to have a callback for pool information
Allow a scheduler to provide a callback to display pool-wide information,
providing a default. This is in preparation for displaying pool-wide
scheduler parameters on this line.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r d70161aab13e -r 6dc39f1a7167 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Tue Feb 21 12:17:12 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c Tue Feb 21 12:17:15 2012 +0000
@@ -4059,13 +4059,24 @@ static int sched_sedf_domain_output(
return 0;
}
+static int sched_default_pool_output(
+ uint32_t poolid)
+{
+ char *poolname;
+
+ poolname = libxl_cpupoolid_to_name(ctx, poolid);
+ printf("Cpupool %s:\n",
+ poolname);
+ free(poolname);
+ return 0;
+}
+
static int sched_domain_output(
- uint32_t sched, int (*output)(int), const char *cpupool)
+ uint32_t sched, int (*output)(int), int (*pooloutput)(uint32_t), 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;
@@ -4093,9 +4104,7 @@ static int sched_domain_output(
(cpupool && (poolid != poolinfo[p].poolid)))
continue;
- poolname = libxl_cpupoolid_to_name(ctx, poolinfo[p].poolid);
- printf("Cpupool %s:\n", poolname);
- free(poolname);
+ pooloutput(poolinfo[p].poolid);
output(-1);
for (i = 0; i < nb_domain; i++) {
@@ -4171,7 +4180,9 @@ int main_sched_credit(int argc, char **a
if (!dom) { /* list all domain''s credit scheduler info */
return -sched_domain_output(XEN_SCHEDULER_CREDIT,
- sched_credit_domain_output, cpupool);
+ sched_credit_domain_output,
+ sched_default_pool_output,
+ cpupool);
} else {
find_domain(dom);
@@ -4247,7 +4258,9 @@ int main_sched_credit2(int argc, char **
if (!dom) { /* list all domain''s credit scheduler info */
return -sched_domain_output(XEN_SCHEDULER_CREDIT2,
- sched_credit2_domain_output, cpupool);
+ sched_credit2_domain_output,
+ sched_default_pool_output,
+ cpupool);
} else {
find_domain(dom);
@@ -4349,7 +4362,9 @@ int main_sched_sedf(int argc, char **arg
if (!dom) { /* list all domain''s credit scheduler info */
return -sched_domain_output(XEN_SCHEDULER_SEDF,
- sched_sedf_domain_output, cpupool);
+ sched_sedf_domain_output,
+ sched_default_pool_output,
+ cpupool);
} else {
find_domain(dom);
George Dunlap
2012-Feb-21 13:34 UTC
[PATCH 10 of 10] xl: Implement sched-credit schedule parameter command-line interface
Add features to the sched-credit interface to allow querying and
displaying scheduler parameters. New interface works as follows:
<nothing> : List all domain params and sched params from all
pools
-d [domid] : List domain params for domain
-d [domid] [params] : Set domain params for domain
-p [pool] : list all domains and sched params for pool
-s : List sched params for poolid 0
-s [params] : Set sched params for poolid 0
-p [pool] -s : List sched params for pool
-p [pool] -s [params] : Set sched params for pool
-p [pool] -d... : Illegal
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 6dc39f1a7167 -r 4f3e3d701673 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Tue Feb 21 12:17:15 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c Tue Feb 21 12:17:18 2012 +0000
@@ -3936,6 +3936,30 @@ static int sched_credit_domain_set(
return rc;
}
+static int sched_credit_param_set(
+ int poolid, libxl_sched_credit_param *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_credit_param_set(ctx, poolid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_credit_param_set failed.\n");
+
+ return rc;
+}
+
+static int sched_credit_param_get(
+ int poolid, libxl_sched_credit_param *scinfo)
+{
+ int rc;
+
+ rc = libxl_sched_credit_param_get(ctx, poolid, scinfo);
+ if (rc)
+ fprintf(stderr, "libxl_sched_credit_domain_get failed.\n");
+
+ return rc;
+}
+
static int sched_credit_domain_output(
int domid)
{
@@ -3960,6 +3984,25 @@ static int sched_credit_domain_output(
return 0;
}
+static int sched_credit_pool_output(
+ uint32_t poolid)
+{
+ libxl_sched_credit_param scparam;
+ char *poolname;
+ int rc;
+
+ rc = sched_credit_param_get(poolid, &scparam);
+ if (rc)
+ return rc;
+ poolname = libxl_cpupoolid_to_name(ctx, poolid);
+ printf("Cpupool %s: tslice=%dms ratelimit=%dus\n",
+ poolname,
+ scparam.tslice_ms,
+ scparam.ratelimit_us);
+ free(poolname);
+ return 0;
+}
+
static int sched_credit2_domain_get(
int domid, libxl_sched_credit2_domain *scinfo)
{
@@ -4123,25 +4166,41 @@ static int sched_domain_output(
return 0;
}
+/*
+ * <nothing> : List all domain params and sched params from
all pools
+ * -d [domid] : List domain params for domain
+ * -d [domid] [params] : Set domain params for domain
+ * -p [pool] : list all domains and sched params for pool
+ * -s : List sched params for poolid 0
+ * -s [params] : Set sched params for poolid 0
+ * -p [pool] -s : List sched params for pool
+ * -p [pool] -s [params] : Set sched params for pool
+ * -p [pool] -d... : Illegal
+ */
int main_sched_credit(int argc, char **argv)
{
libxl_sched_credit_domain scinfo;
const char *dom = NULL;
const char *cpupool = NULL;
int weight = 256, cap = 0, opt_w = 0, opt_c = 0;
+ int opt_s = 0;
+ int tslice = 0, opt_t = 0, ratelimit = 0, opt_r = 0;
int opt, rc;
int option_index = 0;
static struct option long_options[] = {
{"domain", 1, 0, ''d''},
{"weight", 1, 0, ''w''},
{"cap", 1, 0, ''c''},
+ {"schedparam", 0, 0, ''s''},
+ {"tslice_ms", 1, 0, ''t''},
+ {"ratelimit_us", 1, 0, ''r''},
{"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,
+ opt = getopt_long(argc, argv, "d:w:c:p:t:r:hs", long_options,
&option_index);
if (opt == -1)
break;
@@ -4159,6 +4218,17 @@ int main_sched_credit(int argc, char **a
cap = strtol(optarg, NULL, 10);
opt_c = 1;
break;
+ case ''t'':
+ tslice = strtol(optarg, NULL, 10);
+ opt_t = 1;
+ break;
+ case ''r'':
+ ratelimit = strtol(optarg, NULL, 10);
+ opt_r = 1;
+ break;
+ case ''s'':
+ opt_s = 1;
+ break;
case ''p'':
cpupool = optarg;
break;
@@ -4168,20 +4238,54 @@ int main_sched_credit(int argc, char **a
}
}
- if (cpupool && (dom || opt_w || opt_c)) {
- fprintf(stderr, "Specifying a cpupool is not allowed with other
"
- "options.\n");
+ if ((cpupool || opt_s) && (dom || opt_w || opt_c)) {
+ fprintf(stderr, "Specifying a cpupool or schedparam is not "
+ "allowed with domain 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 */
+ if (!opt_s && (opt_t || opt_r)) {
+ fprintf(stderr, "Must specify schedparam to set schedule "
+ "parameter values.\n");
+ return 1;
+ }
+
+ if (opt_s) {
+ libxl_sched_credit_param scparam;
+ uint32_t poolid = 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;
+ }
+ }
+
+ if (!opt_t && !opt_r) { /* Output scheduling parameters */
+ return -sched_credit_pool_output(poolid);
+ } else { /* Set scheduling parameters*/
+ rc = sched_credit_param_get(poolid, &scparam);
+ if (rc)
+ return -rc;
+
+ if (opt_t)
+ scparam.tslice_ms = tslice;
+
+ if (opt_r)
+ scparam.ratelimit_us = ratelimit;
+
+ rc = sched_credit_param_set(poolid, &scparam);
+ if (rc)
+ return -rc;
+ }
+ } else if (!dom) { /* list all domain''s credit scheduler info */
return -sched_domain_output(XEN_SCHEDULER_CREDIT,
sched_credit_domain_output,
- sched_default_pool_output,
+ sched_credit_pool_output,
cpupool);
} else {
find_domain(dom);
diff -r 6dc39f1a7167 -r 4f3e3d701673 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Tue Feb 21 12:17:15 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c Tue Feb 21 12:17:18 2012 +0000
@@ -204,11 +204,14 @@ struct cmd_spec cmd_table[] = {
{ "sched-credit",
&main_sched_credit, 0,
"Get/set credit scheduler parameters",
- "[-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)\n"
- "-p CPUPOOL, --cpupool=CPUPOOL Restrict output to CPUPOOL"
+ "[-d <Domain> [-w[=WEIGHT]|-c[=CAP]]] [-s [-t TSLICE] [-r
RATELIMIT]] [-p CPUPOOL]",
+ "-d DOMAIN, --domain=DOMAIN Domain to modify\n"
+ "-w WEIGHT, --weight=WEIGHT Weight (int)\n"
+ "-c CAP, --cap=CAP Cap (int)\n"
+ "-s --schedparam Query / modify scheduler
parameters\n"
+ "-t TSLICE, --tslice_ms=TSLICE Set the timeslice, in
milliseconds\n"
+ "-r RLIMIT, --ratelimit_us=RLIMIT Set the scheduling rate limit, in
microseconds\n"
+ "-p CPUPOOL, --cpupool=CPUPOOL Restrict output to CPUPOOL"
},
{ "sched-credit2",
&main_sched_credit2, 0,
Ian Jackson
2012-Feb-21 17:46 UTC
Re: [PATCH 06 of 10] libxl: cleanup: Remove pointless ERRNOVAL
George Dunlap writes ("[Xen-devel] [PATCH 06 of 10] libxl: cleanup: Remove
pointless ERRNOVAL"):> Just call LIBXL__LOG rather than passing a meaningless ERRNOVAL.
>
> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson
2012-Feb-21 17:49 UTC
Re: [PATCH 09 of 10] xl: Refactor sched_domain_output to have a callback for pool information
George Dunlap writes ("[Xen-devel] [PATCH 09 of 10] xl: Refactor
sched_domain_output to have a callback for pool
information"):> Allow a scheduler to provide a callback to display pool-wide information,
> providing a default. This is in preparation for displaying pool-wide
> scheduler parameters on this line.
> +static int sched_default_pool_output(
> + uint32_t poolid)
> +{
Formatting glitch. I know sched_domain_output looks like that but
that''s because it needs it to avoid wrapping.
> static int sched_domain_output(
> - uint32_t sched, int (*output)(int), const char *cpupool)
> + uint32_t sched, int (*output)(int), int (*pooloutput)(uint32_t), const
char *cpupool)
And here you''ve failed to wrap it :-). I suggest
static int sched_domain_output(uint32_t sched, const char *cpupool,
int (*output)(int), int (*pooloutput)(uint32_t))
{
but anything plausible is fine by me.
Aside from those niggles,
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian.
Ian Jackson
2012-Feb-21 17:49 UTC
Re: [PATCH 05 of 10] libxc: Implement SCHEDOP sysctl for credit scheduler
George Dunlap writes ("[Xen-devel] [PATCH 05 of 10] libxc: Implement
SCHEDOP sysctl for credit scheduler"):> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
...> +xc_sched_credit_param_set(
> + xc_interface *xch,
> + uint32_t cpupool_id,
> + struct xen_sysctl_credit_schedule *schedule)
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian.
Ian Jackson
2012-Feb-21 17:51 UTC
Re: [PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et
George Dunlap writes ("[Xen-devel] [PATCH 08 of 10] libxl: Implement
libxl_sched_credit_param_[gs]et"):> Implement functions to set credit scheduler global parameters.
Again, just some niggles:
> +int libxl_sched_credit_param_get(libxl_ctx *ctx, uint32_t poolid,
libxl_sched_credit_param *scinfo)
Long line here and in _set.
Shouldn''t this be "params" rather than "param"
since it sets several
parameters ?
Ian.
Ian Jackson
2012-Feb-21 17:52 UTC
Re: [PATCH 07 of 10] libxl: Rename libxl_sched_* to include _domain
George Dunlap writes ("[Xen-devel] [PATCH 07 of 10] libxl: Rename
libxl_sched_* to include _domain"):> In preparation for introducing a schedule parameter-based structure,
> rename libxl_sched_{credit,credit2,sedf} to libxl_sched_{}_domain.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
If you''re feeling nice you could rewrap the long lines.
Ian.
George Dunlap
2012-Feb-21 17:54 UTC
Re: [PATCH 07 of 10] libxl: Rename libxl_sched_* to include _domain
On Tue, 2012-02-21 at 17:52 +0000, Ian Jackson wrote:> George Dunlap writes ("[Xen-devel] [PATCH 07 of 10] libxl: Rename libxl_sched_* to include _domain"): > > In preparation for introducing a schedule parameter-based structure, > > rename libxl_sched_{credit,credit2,sedf} to libxl_sched_{}_domain. > > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> > > If you''re feeling nice you could rewrap the long lines.Might as well. :-) -George> > Ian.
George Dunlap
2012-Feb-21 17:56 UTC
Re: [PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et
On Tue, 2012-02-21 at 17:51 +0000, Ian Jackson wrote:> George Dunlap writes ("[Xen-devel] [PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et"): > > Implement functions to set credit scheduler global parameters. > > Again, just some niggles: > > > +int libxl_sched_credit_param_get(libxl_ctx *ctx, uint32_t poolid, libxl_sched_credit_param *scinfo) > > Long line here and in _set. > > Shouldn''t this be "params" rather than "param" since it sets several > parameters ?Hmm, I suppose so. I think I accidentally said "param" because I originally wrote the patch series, the structure actually only contained one parameter. Then I thought I might as well do both at the same time, but didn''t have to re-write this patch. :-) -George
Ian Jackson
2012-Feb-21 17:56 UTC
Re: [PATCH 10 of 10] xl: Implement sched-credit schedule parameter command-line interface
George Dunlap writes ("[Xen-devel] [PATCH 10 of 10] xl: Implement
sched-credit schedule parameter command-line
interface"):> Add features to the sched-credit interface to allow querying and
> displaying scheduler parameters. New interface works as follows:
>
> <nothing> : List all domain params and sched params from
all pools
> -d [domid] : List domain params for domain
> -d [domid] [params] : Set domain params for domain
> -p [pool] : list all domains and sched params for pool
> -s : List sched params for poolid 0
> -s [params] : Set sched params for poolid 0
> -p [pool] -s : List sched params for pool
> -p [pool] -s [params] : Set sched params for pool
> -p [pool] -d... : Illegal
This information should be in the xl manpage, rather than in the
commit message and a code comment.
> +static int sched_credit_param_set(
> + int poolid, libxl_sched_credit_param *scinfo)
> +{
Formatting. It should be
static int sched_credit_param_set(int poolid, libxl_sched_credit_param *scinfo)
(79 columns) or
static int sched_credit_param_set(int poolid,
libxl_sched_credit_param *scinfo)
(67 columns).
This should be changed throughout I''m afraid.
> + } else { /* Set scheduling parameters*/
> + rc = sched_credit_param_get(poolid, &scparam);
What happens if the pool isn''t using the credit scheduler ?
Thanks,
Ian.
Ian Jackson
2012-Feb-21 17:57 UTC
Re: [PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et
George Dunlap writes ("Re: [Xen-devel] [PATCH 08 of 10] libxl: Implement
libxl_sched_credit_param_[gs]et"):> On Tue, 2012-02-21 at 17:51 +0000, Ian Jackson wrote:
> > Shouldn''t this be "params" rather than
"param" since it sets several
> > parameters ?
>
> Hmm, I suppose so. I think I accidentally said "param" because I
> originally wrote the patch series, the structure actually only contained
> one parameter. Then I thought I might as well do both at the same time,
> but didn''t have to re-write this patch. :-)
Well, a "params" struct containing only one param for this particular
scheduler is less weird than a "param" one containing several...
Ian.
George Dunlap
2012-Feb-21 18:11 UTC
Re: [PATCH 10 of 10] xl: Implement sched-credit schedule parameter command-line interface
On Tue, 2012-02-21 at 17:56 +0000, Ian Jackson wrote:> George Dunlap writes ("[Xen-devel] [PATCH 10 of 10] xl: Implement sched-credit schedule parameter command-line interface"): > > Add features to the sched-credit interface to allow querying and > > displaying scheduler parameters. New interface works as follows: > > > > <nothing> : List all domain params and sched params from all pools > > -d [domid] : List domain params for domain > > -d [domid] [params] : Set domain params for domain > > -p [pool] : list all domains and sched params for pool > > -s : List sched params for poolid 0 > > -s [params] : Set sched params for poolid 0 > > -p [pool] -s : List sched params for pool > > -p [pool] -s [params] : Set sched params for pool > > -p [pool] -d... : Illegal > > This information should be in the xl manpage, rather than in the > commit message and a code comment.Of course. And, is there some other documentation that this should be put into as well?> > > +static int sched_credit_param_set( > > + int poolid, libxl_sched_credit_param *scinfo) > > +{ > > Formatting. It should be > > static int sched_credit_param_set(int poolid, libxl_sched_credit_param *scinfo) > > (79 columns) or > > static int sched_credit_param_set(int poolid, > libxl_sched_credit_param *scinfo) > > (67 columns). > > This should be changed throughout I''m afraid.Ack.> > > + } else { /* Set scheduling parameters*/ > > + rc = sched_credit_param_get(poolid, &scparam); > > What happens if the pool isn''t using the credit scheduler ?Ah, good point. I suppose it should just print the pool name. What happens to output of domains when you use xl sched-credit and there is a pool that''s not using the credit scheduler? It looks like it will stop at that point and quit processing. It seems like having it print the domain ID and "[not sched-credit]" or something like that would be better. What would be *even* better is to unify these all somehow, so that xl would automatically detect the appropriate scheduler for the pool and behave accordingly. But that''s a patch series for another time, I think. -George
Ian Jackson
2012-Feb-21 18:17 UTC
Re: [PATCH 10 of 10] xl: Implement sched-credit schedule parameter command-line interface
George Dunlap writes ("Re: [Xen-devel] [PATCH 10 of 10] xl: Implement
sched-credit schedule parameter command-line
interface"):> On Tue, 2012-02-21 at 17:56 +0000, Ian Jackson wrote:
> > George Dunlap writes ("[Xen-devel] [PATCH 10 of 10] xl: Implement
sched-credit schedule parameter command-line interface"):
> > This information should be in the xl manpage, rather than in the
> > commit message and a code comment.
>
> Of course. And, is there some other documentation that this should be
> put into as well?
I think what you have in the usage message, plus the manpage, is
sufficient.
> What would be *even* better is to unify these all somehow, so that xl
> would automatically detect the appropriate scheduler for the pool and
> behave accordingly. But that''s a patch series for another time, I
> think.
Sure. I just wasn''t sure from the code that you''d considered
this
case. I''d be happy with an error message of some kind, and a zero
exit status.
Ian.