All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters
@ 2012-02-22 16:15 George Dunlap
  2012-02-22 16:15 ` [PATCH 1 of 9] cleanup: Remove dependency files in efi directory during a make clean George Dunlap
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

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.

v2:
 - Fixed some line-length issues
 - Renamed structures and functions "params" rather than "param"
 - Added options to xl man page

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1 of 9] cleanup: Remove dependency files in efi directory during a make clean
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-02-22 16:15 ` [PATCH 2 of 9] xen: Add a #define for the default ratelimit George Dunlap
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r a4d93d0e0df2 -r 6d6667ea47ed xen/arch/x86/Makefile
--- a/xen/arch/x86/Makefile	Wed Feb 22 14:33:24 2012 +0000
+++ b/xen/arch/x86/Makefile	Wed Feb 22 16:08:28 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2 of 9] xen: Add a #define for the default ratelimit
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
  2012-02-22 16:15 ` [PATCH 1 of 9] cleanup: Remove dependency files in efi directory during a make clean George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-02-22 16:15 ` [PATCH 3 of 9] xen: Print ratelimit in scheduler debugkey George Dunlap
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r 6d6667ea47ed -r efd21e08e0fd xen/common/schedule.c
--- a/xen/common/schedule.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/xen/common/schedule.c	Wed Feb 22 16:08:28 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 6d6667ea47ed -r efd21e08e0fd xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h	Wed Feb 22 16:08:28 2012 +0000
+++ b/xen/include/xen/sched-if.h	Wed Feb 22 16:08:28 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;

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 3 of 9] xen: Print ratelimit in scheduler debugkey
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
  2012-02-22 16:15 ` [PATCH 1 of 9] cleanup: Remove dependency files in efi directory during a make clean George Dunlap
  2012-02-22 16:15 ` [PATCH 2 of 9] xen: Add a #define for the default ratelimit George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-02-22 16:15 ` [PATCH 4 of 9] xen: Implement SCHEDOP sysctl for credit scheduler George Dunlap
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r efd21e08e0fd -r a4e58388859e xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/xen/common/sched_credit.c	Wed Feb 22 16:08:28 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);

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 4 of 9] xen: Implement SCHEDOP sysctl for credit scheduler
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
                   ` (2 preceding siblings ...)
  2012-02-22 16:15 ` [PATCH 3 of 9] xen: Print ratelimit in scheduler debugkey George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-02-22 16:15 ` [PATCH 5 of 9] libxc: " George Dunlap
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Allow tslice_ms and ratelimit_us to be modified.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r a4e58388859e -r 0b230c5ac8b7 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/xen/common/sched_credit.c	Wed Feb 22 16:08:28 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 a4e58388859e -r 0b230c5ac8b7 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Wed Feb 22 16:08:28 2012 +0000
+++ b/xen/include/public/sysctl.h	Wed Feb 22 16:08:28 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;

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 5 of 9] libxc: Implement SCHEDOP sysctl for credit scheduler
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
                   ` (3 preceding siblings ...)
  2012-02-22 16:15 ` [PATCH 4 of 9] xen: Implement SCHEDOP sysctl for credit scheduler George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-02-22 16:15 ` [PATCH 6 of 9] libxl: Rename libxl_sched_* to include _domain George Dunlap
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r 0b230c5ac8b7 -r b5d446a34508 tools/libxc/xc_csched.c
--- a/tools/libxc/xc_csched.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxc/xc_csched.c	Wed Feb 22 16:08:28 2012 +0000
@@ -61,3 +61,47 @@ xc_sched_credit_domain_get(
 
     return err;
 }
+
+int
+xc_sched_credit_params_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_params_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 0b230c5ac8b7 -r b5d446a34508 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxc/xenctrl.h	Wed Feb 22 16:08:28 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_params_set(xc_interface *xch,
+                              uint32_t cpupool_id,
+                              struct xen_sysctl_credit_schedule *schedule);
+int xc_sched_credit_params_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);

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 6 of 9] libxl: Rename libxl_sched_* to include _domain
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
                   ` (4 preceding siblings ...)
  2012-02-22 16:15 ` [PATCH 5 of 9] libxc: " George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-02-23 10:20   ` Keir Fraser
  2012-02-22 16:15 ` [PATCH 7 of 9] libxl: Implement libxl_sched_credit_param_[gs]et George Dunlap
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

In preparation for introducing a schedule parameter-based structure,
rename libxl_sched_{credit,credit2,sedf} to libxl_sched_{}_domain.

No functional changes.

v2: Wrap long lines while I'm at it

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r b5d446a34508 -r af02b1ea16da tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/libxl.c	Wed Feb 22 16:08:28 2012 +0000
@@ -2975,7 +2975,8 @@ 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 +2993,8 @@ 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 +3035,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 +3053,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 +3088,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 +3114,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 b5d446a34508 -r af02b1ea16da tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/libxl.h	Wed Feb 22 16:08:28 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 b5d446a34508 -r af02b1ea16da tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Wed Feb 22 16:08:28 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 b5d446a34508 -r af02b1ea16da tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Wed Feb 22 16:08:28 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 b5d446a34508 -r af02b1ea16da tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Wed Feb 22 16:08:28 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);

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 7 of 9] libxl: Implement libxl_sched_credit_param_[gs]et
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
                   ` (5 preceding siblings ...)
  2012-02-22 16:15 ` [PATCH 6 of 9] libxl: Rename libxl_sched_* to include _domain George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-03-01 18:22   ` Ian Jackson
  2012-02-22 16:15 ` [PATCH 8 of 9] xl: Refactor sched_domain_output to have a callback for pool information George Dunlap
  2012-02-22 16:15 ` [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface George Dunlap
  8 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Implement functions to set credit scheduler global parameters.

v2:
 - Use "params" rather than "param"
 - Fix long lines

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r af02b1ea16da -r acbe35e4fb4a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/libxl.c	Wed Feb 22 16:08:28 2012 +0000
@@ -3034,6 +3034,67 @@ int libxl_sched_credit_domain_set(libxl_
     return 0;
 }
 
+int libxl_sched_credit_params_get(libxl_ctx *ctx, uint32_t poolid,
+                                  libxl_sched_credit_params *scinfo)
+{
+    struct xen_sysctl_credit_schedule sparam;
+    int rc;
+
+    rc = xc_sched_credit_params_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_params_set(libxl_ctx *ctx, uint32_t poolid,
+                                  libxl_sched_credit_params *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_params_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 af02b1ea16da -r acbe35e4fb4a tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/libxl.h	Wed Feb 22 16:08:28 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_params_get(libxl_ctx *ctx, uint32_t poolid,
+                                  libxl_sched_credit_params *scinfo);
+int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,
+                                  libxl_sched_credit_params *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 af02b1ea16da -r acbe35e4fb4a tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Wed Feb 22 16:08:28 2012 +0000
@@ -395,6 +395,11 @@ libxl_sched_credit_domain = Struct("sche
     ("cap", integer),
     ], dispose_fn=None)
 
+libxl_sched_credit_params = Struct("sched_credit_params", [
+    ("tslice_ms", integer),
+    ("ratelimit_us", integer),
+    ], dispose_fn=None)
+
 libxl_sched_credit2_domain = Struct("sched_credit2_domain", [
     ("weight", integer),
     ], dispose_fn=None)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 8 of 9] xl: Refactor sched_domain_output to have a callback for pool information
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
                   ` (6 preceding siblings ...)
  2012-02-22 16:15 ` [PATCH 7 of 9] libxl: Implement libxl_sched_credit_param_[gs]et George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-03-01 18:24   ` Ian Jackson
  2012-02-22 16:15 ` [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface George Dunlap
  8 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

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>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r acbe35e4fb4a -r 5600db2bcd0e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Wed Feb 22 16:08:28 2012 +0000
@@ -4059,13 +4059,23 @@ static int sched_sedf_domain_output(
     return 0;
 }
 
-static int sched_domain_output(
-    uint32_t sched, int (*output)(int), const char *cpupool)
+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),
+                               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 +4103,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 +4179,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 +4257,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 +4361,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);

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface
  2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
                   ` (7 preceding siblings ...)
  2012-02-22 16:15 ` [PATCH 8 of 9] xl: Refactor sched_domain_output to have a callback for pool information George Dunlap
@ 2012-02-22 16:15 ` George Dunlap
  2012-02-23 14:51   ` George Dunlap
  8 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2012-02-22 16:15 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Add features to the sched-credit interface to allow querying and
displaying scheduler parameters.

v2:
 - Change function line breaks
 - Pool output deals gracefully with other schedulers
 - Add new parameters, as well as a description of how they
   interact, to the xl man page

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r 5600db2bcd0e -r 0f91ce7b095a docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Wed Feb 22 16:08:28 2012 +0000
+++ b/docs/man/xl.pod.1	Wed Feb 22 16:08:28 2012 +0000
@@ -714,6 +714,53 @@ no upper cap.
 
 Restrict output to domains in the specified cpupool.
 
+=item B<-s>, B<--schedparam>
+
+Specify to list or set pool-wide scheduler parameters.
+
+=item B<-t TSLICE>, B<--tslice_ms=TSLICE>
+
+Timeslice tells the scheduler how long to allow VMs to run before
+pre-empting.  The default is 30ms.  Valid ranges are 1ms to 1000ms.
+The length of the timeslice (in ms) must be higher than the length of
+the ratelimit (see below).
+
+=item B<-r RLIMIT>, B<--ratelimit_us=RLIMIT>
+
+Ratelimit attempts to limit the number of schedules per second.  It
+sets a minimum amount of time (in microseconds) a VM must run before
+we will allow a higher-prioirty VM to pre-empt it.  The default value
+is 1000 microseconds (1ms).  Valid range is 100 to 500000 (500ms).
+The ratelimit length must be lower than the timeslice length.
+
+=back
+
+B<COMBINATION>
+
+The following is the effect of combining the above options:
+
+=over 4
+
+=item B<E<lt>nothingE<gt>>             : List all domain params and sched params from all pools
+
+=item B<-d [domid]>            : List domain params for domain [domid]
+
+=item B<-d [domid] [params]>   : Set domain params for domain [domid]
+
+=item B<-p [pool]>             : list all domains and sched params for [pool]
+
+=item B<-s>                    : List sched params for poolid 0
+
+=item B<-s [params]>           : Set sched params for poolid 0
+
+=item B<-p [pool] -s>          : List sched params for [pool]
+
+=item B<-p [pool] -s [params]> : Set sched params for [pool]
+
+=item B<-p [pool] -d>...       : Illegal
+
+=item
+
 =back
 
 =item B<sched-credit2> [I<OPTIONS>]
diff -r 5600db2bcd0e -r 0f91ce7b095a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Wed Feb 22 16:08:28 2012 +0000
@@ -3912,8 +3912,7 @@ int main_sharing(int argc, char **argv)
     return 0;
 }
 
-static int sched_credit_domain_get(
-    int domid, libxl_sched_credit_domain *scinfo)
+static int sched_credit_domain_get(int domid, libxl_sched_credit_domain *scinfo)
 {
     int rc;
 
@@ -3924,8 +3923,7 @@ static int sched_credit_domain_get(
     return rc;
 }
 
-static int sched_credit_domain_set(
-    int domid, libxl_sched_credit_domain *scinfo)
+static int sched_credit_domain_set(int domid, libxl_sched_credit_domain *scinfo)
 {
     int rc;
 
@@ -3936,8 +3934,29 @@ static int sched_credit_domain_set(
     return rc;
 }
 
-static int sched_credit_domain_output(
-    int domid)
+static int sched_credit_params_set(int poolid, libxl_sched_credit_params *scinfo)
+{
+    int rc;
+
+    rc = libxl_sched_credit_params_set(ctx, poolid, scinfo);
+    if (rc)
+        fprintf(stderr, "libxl_sched_credit_params_set failed.\n");
+
+    return rc;
+}
+
+static int sched_credit_params_get(int poolid, libxl_sched_credit_params *scinfo)
+{
+    int rc;
+
+    rc = libxl_sched_credit_params_get(ctx, poolid, scinfo);
+    if (rc)
+        fprintf(stderr, "libxl_sched_credit_params_get failed.\n");
+
+    return rc;
+}
+
+static int sched_credit_domain_output(int domid)
 {
     char *domname;
     libxl_sched_credit_domain scinfo;
@@ -3960,6 +3979,27 @@ static int sched_credit_domain_output(
     return 0;
 }
 
+static int sched_credit_pool_output(uint32_t poolid)
+{
+    libxl_sched_credit_params scparam;
+    char *poolname;
+    int rc;
+
+    poolname = libxl_cpupoolid_to_name(ctx, poolid);
+    rc = sched_credit_params_get(poolid, &scparam);
+    if (rc) {
+        printf("Cpupool %s: [sched params unavailable]\n",
+               poolname);
+    } else {
+        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)
 {
@@ -4122,25 +4162,41 @@ static int sched_domain_output(uint32_t 
     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;
@@ -4158,6 +4214,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;
@@ -4167,20 +4234,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_params  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_params_get(poolid, &scparam);
+            if (rc)
+                return -rc;
+
+            if (opt_t)
+                scparam.tslice_ms = tslice;
+
+            if (opt_r)
+                scparam.ratelimit_us = ratelimit;
+
+            rc = sched_credit_params_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 5600db2bcd0e -r 0f91ce7b095a tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Wed Feb 22 16:08:28 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c	Wed Feb 22 16:08:28 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,

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 6 of 9] libxl: Rename libxl_sched_* to include _domain
  2012-02-22 16:15 ` [PATCH 6 of 9] libxl: Rename libxl_sched_* to include _domain George Dunlap
@ 2012-02-23 10:20   ` Keir Fraser
  0 siblings, 0 replies; 15+ messages in thread
From: Keir Fraser @ 2012-02-23 10:20 UTC (permalink / raw)
  To: George Dunlap, xen-devel; +Cc: Ian Jackson

On 22/02/2012 16:15, "George Dunlap" <George.Dunlap@eu.citrix.com> wrote:

> In preparation for introducing a schedule parameter-based structure,
> rename libxl_sched_{credit,credit2,sedf} to libxl_sched_{}_domain.
> 
> No functional changes.
> 
> v2: Wrap long lines while I'm at it

I've applied up to and including this patch (since it's Acked by Ian). I
leave the remaining three patches to a libxl maintainer.

 -- Keir

> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> diff -r b5d446a34508 -r af02b1ea16da tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c Wed Feb 22 16:08:28 2012 +0000
> +++ b/tools/libxl/libxl.c Wed Feb 22 16:08:28 2012 +0000
> @@ -2975,7 +2975,8 @@ 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 +2993,8 @@ 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 +3035,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 +3053,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 +3088,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 +3114,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 b5d446a34508 -r af02b1ea16da tools/libxl/libxl.h
> --- a/tools/libxl/libxl.h Wed Feb 22 16:08:28 2012 +0000
> +++ b/tools/libxl/libxl.h Wed Feb 22 16:08:28 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 b5d446a34508 -r af02b1ea16da tools/libxl/libxl_types.idl
> --- a/tools/libxl/libxl_types.idl Wed Feb 22 16:08:28 2012 +0000
> +++ b/tools/libxl/libxl_types.idl Wed Feb 22 16:08:28 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 b5d446a34508 -r af02b1ea16da tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c Wed Feb 22 16:08:28 2012 +0000
> +++ b/tools/libxl/xl_cmdimpl.c Wed Feb 22 16:08:28 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 b5d446a34508 -r af02b1ea16da tools/ocaml/libs/xl/xenlight_stubs.c
> --- a/tools/ocaml/libs/xl/xenlight_stubs.c Wed Feb 22 16:08:28 2012 +0000
> +++ b/tools/ocaml/libs/xl/xenlight_stubs.c Wed Feb 22 16:08:28 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);
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface
  2012-02-22 16:15 ` [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface George Dunlap
@ 2012-02-23 14:51   ` George Dunlap
  2012-03-01 18:24     ` Ian Jackson
  0 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2012-02-23 14:51 UTC (permalink / raw)
  To: xen-devel

On Wed, Feb 22, 2012 at 4:15 PM, George Dunlap
<george.dunlap@eu.citrix.com> wrote:
> Add features to the sched-credit interface to allow querying and
> displaying scheduler parameters.
>
> v2:
>  - Change function line breaks
>  - Pool output deals gracefully with other schedulers
>  - Add new parameters, as well as a description of how they
>   interact, to the xl man page

BTW, there was a brief suggestion that rather than sharing the same
command (which requires a big table to explain how the various options
interact), we break out sched-credit into two, possibly three
commands; one of which would read all scheduler information, the other
two which would specifically get or set domain and scheduler-wide
parameters.  Any thoughts on this?

 -G

>
> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
>
> diff -r 5600db2bcd0e -r 0f91ce7b095a docs/man/xl.pod.1
> --- a/docs/man/xl.pod.1 Wed Feb 22 16:08:28 2012 +0000
> +++ b/docs/man/xl.pod.1 Wed Feb 22 16:08:28 2012 +0000
> @@ -714,6 +714,53 @@ no upper cap.
>
>  Restrict output to domains in the specified cpupool.
>
> +=item B<-s>, B<--schedparam>
> +
> +Specify to list or set pool-wide scheduler parameters.
> +
> +=item B<-t TSLICE>, B<--tslice_ms=TSLICE>
> +
> +Timeslice tells the scheduler how long to allow VMs to run before
> +pre-empting.  The default is 30ms.  Valid ranges are 1ms to 1000ms.
> +The length of the timeslice (in ms) must be higher than the length of
> +the ratelimit (see below).
> +
> +=item B<-r RLIMIT>, B<--ratelimit_us=RLIMIT>
> +
> +Ratelimit attempts to limit the number of schedules per second.  It
> +sets a minimum amount of time (in microseconds) a VM must run before
> +we will allow a higher-prioirty VM to pre-empt it.  The default value
> +is 1000 microseconds (1ms).  Valid range is 100 to 500000 (500ms).
> +The ratelimit length must be lower than the timeslice length.
> +
> +=back
> +
> +B<COMBINATION>
> +
> +The following is the effect of combining the above options:
> +
> +=over 4
> +
> +=item B<E<lt>nothingE<gt>>             : List all domain params and sched params from all pools
> +
> +=item B<-d [domid]>            : List domain params for domain [domid]
> +
> +=item B<-d [domid] [params]>   : Set domain params for domain [domid]
> +
> +=item B<-p [pool]>             : list all domains and sched params for [pool]
> +
> +=item B<-s>                    : List sched params for poolid 0
> +
> +=item B<-s [params]>           : Set sched params for poolid 0
> +
> +=item B<-p [pool] -s>          : List sched params for [pool]
> +
> +=item B<-p [pool] -s [params]> : Set sched params for [pool]
> +
> +=item B<-p [pool] -d>...       : Illegal
> +
> +=item
> +
>  =back
>
>  =item B<sched-credit2> [I<OPTIONS>]
> diff -r 5600db2bcd0e -r 0f91ce7b095a tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c  Wed Feb 22 16:08:28 2012 +0000
> +++ b/tools/libxl/xl_cmdimpl.c  Wed Feb 22 16:08:28 2012 +0000
> @@ -3912,8 +3912,7 @@ int main_sharing(int argc, char **argv)
>     return 0;
>  }
>
> -static int sched_credit_domain_get(
> -    int domid, libxl_sched_credit_domain *scinfo)
> +static int sched_credit_domain_get(int domid, libxl_sched_credit_domain *scinfo)
>  {
>     int rc;
>
> @@ -3924,8 +3923,7 @@ static int sched_credit_domain_get(
>     return rc;
>  }
>
> -static int sched_credit_domain_set(
> -    int domid, libxl_sched_credit_domain *scinfo)
> +static int sched_credit_domain_set(int domid, libxl_sched_credit_domain *scinfo)
>  {
>     int rc;
>
> @@ -3936,8 +3934,29 @@ static int sched_credit_domain_set(
>     return rc;
>  }
>
> -static int sched_credit_domain_output(
> -    int domid)
> +static int sched_credit_params_set(int poolid, libxl_sched_credit_params *scinfo)
> +{
> +    int rc;
> +
> +    rc = libxl_sched_credit_params_set(ctx, poolid, scinfo);
> +    if (rc)
> +        fprintf(stderr, "libxl_sched_credit_params_set failed.\n");
> +
> +    return rc;
> +}
> +
> +static int sched_credit_params_get(int poolid, libxl_sched_credit_params *scinfo)
> +{
> +    int rc;
> +
> +    rc = libxl_sched_credit_params_get(ctx, poolid, scinfo);
> +    if (rc)
> +        fprintf(stderr, "libxl_sched_credit_params_get failed.\n");
> +
> +    return rc;
> +}
> +
> +static int sched_credit_domain_output(int domid)
>  {
>     char *domname;
>     libxl_sched_credit_domain scinfo;
> @@ -3960,6 +3979,27 @@ static int sched_credit_domain_output(
>     return 0;
>  }
>
> +static int sched_credit_pool_output(uint32_t poolid)
> +{
> +    libxl_sched_credit_params scparam;
> +    char *poolname;
> +    int rc;
> +
> +    poolname = libxl_cpupoolid_to_name(ctx, poolid);
> +    rc = sched_credit_params_get(poolid, &scparam);
> +    if (rc) {
> +        printf("Cpupool %s: [sched params unavailable]\n",
> +               poolname);
> +    } else {
> +        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)
>  {
> @@ -4122,25 +4162,41 @@ static int sched_domain_output(uint32_t
>     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;
> @@ -4158,6 +4214,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;
> @@ -4167,20 +4234,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_params  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_params_get(poolid, &scparam);
> +            if (rc)
> +                return -rc;
> +
> +            if (opt_t)
> +                scparam.tslice_ms = tslice;
> +
> +            if (opt_r)
> +                scparam.ratelimit_us = ratelimit;
> +
> +            rc = sched_credit_params_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 5600db2bcd0e -r 0f91ce7b095a tools/libxl/xl_cmdtable.c
> --- a/tools/libxl/xl_cmdtable.c Wed Feb 22 16:08:28 2012 +0000
> +++ b/tools/libxl/xl_cmdtable.c Wed Feb 22 16:08:28 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,
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 7 of 9] libxl: Implement libxl_sched_credit_param_[gs]et
  2012-02-22 16:15 ` [PATCH 7 of 9] libxl: Implement libxl_sched_credit_param_[gs]et George Dunlap
@ 2012-03-01 18:22   ` Ian Jackson
  0 siblings, 0 replies; 15+ messages in thread
From: Ian Jackson @ 2012-03-01 18:22 UTC (permalink / raw)
  To: George Dunlap; +Cc: xen-devel

George Dunlap writes ("[Xen-devel] [PATCH 7 of 9] libxl: Implement libxl_sched_credit_param_[gs]et"):
> Implement functions to set credit scheduler global parameters.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 8 of 9] xl: Refactor sched_domain_output to have a callback for pool information
  2012-02-22 16:15 ` [PATCH 8 of 9] xl: Refactor sched_domain_output to have a callback for pool information George Dunlap
@ 2012-03-01 18:24   ` Ian Jackson
  0 siblings, 0 replies; 15+ messages in thread
From: Ian Jackson @ 2012-03-01 18:24 UTC (permalink / raw)
  To: George Dunlap; +Cc: xen-devel

George Dunlap writes ("[Xen-devel] [PATCH 8 of 9] 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.

I'm afraid this needs a refresh.

Ian.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface
  2012-02-23 14:51   ` George Dunlap
@ 2012-03-01 18:24     ` Ian Jackson
  0 siblings, 0 replies; 15+ messages in thread
From: Ian Jackson @ 2012-03-01 18:24 UTC (permalink / raw)
  To: George Dunlap; +Cc: xen-devel

George Dunlap writes ("Re: [Xen-devel] [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface"):
> On Wed, Feb 22, 2012 at 4:15 PM, George Dunlap
> <george.dunlap@eu.citrix.com> wrote:
> > Add features to the sched-credit interface to allow querying and
> > displaying scheduler parameters.
> >
> > v2:
> >  - Change function line breaks
> >  - Pool output deals gracefully with other schedulers
> >  - Add new parameters, as well as a description of how they
> >   interact, to the xl man page
> 
> BTW, there was a brief suggestion that rather than sharing the same
> command (which requires a big table to explain how the various options
> interact), we break out sched-credit into two, possibly three
> commands; one of which would read all scheduler information, the other
> two which would specifically get or set domain and scheduler-wide
> parameters.  Any thoughts on this?

That would be fine by me.  I don't think we have a big established
user base.

Ian.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-03-01 18:24 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-22 16:15 [PATCH 0 of 9] V2 Allow user to configure credit scheduler parameters George Dunlap
2012-02-22 16:15 ` [PATCH 1 of 9] cleanup: Remove dependency files in efi directory during a make clean George Dunlap
2012-02-22 16:15 ` [PATCH 2 of 9] xen: Add a #define for the default ratelimit George Dunlap
2012-02-22 16:15 ` [PATCH 3 of 9] xen: Print ratelimit in scheduler debugkey George Dunlap
2012-02-22 16:15 ` [PATCH 4 of 9] xen: Implement SCHEDOP sysctl for credit scheduler George Dunlap
2012-02-22 16:15 ` [PATCH 5 of 9] libxc: " George Dunlap
2012-02-22 16:15 ` [PATCH 6 of 9] libxl: Rename libxl_sched_* to include _domain George Dunlap
2012-02-23 10:20   ` Keir Fraser
2012-02-22 16:15 ` [PATCH 7 of 9] libxl: Implement libxl_sched_credit_param_[gs]et George Dunlap
2012-03-01 18:22   ` Ian Jackson
2012-02-22 16:15 ` [PATCH 8 of 9] xl: Refactor sched_domain_output to have a callback for pool information George Dunlap
2012-03-01 18:24   ` Ian Jackson
2012-02-22 16:15 ` [PATCH 9 of 9] xl: Implement sched-credit schedule parameter command-line interface George Dunlap
2012-02-23 14:51   ` George Dunlap
2012-03-01 18:24     ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.