xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <juergen.gross@ts.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1 of 3] Support of getting scheduler defaults
Date: Tue, 22 May 2012 11:16:52 +0200	[thread overview]
Message-ID: <56c50b3f6cc3eb1de8b8.1337678212@nehalem1> (raw)
In-Reply-To: <patchbomb.1337678211@nehalem1>

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

Support a new sysctl schedop sub-command to get the scheduling defaults of a
specific scheduler.

Additionally correct parameter checking of the sysctl handling in schedule.c
(checked wrong sub-commands: domctl instead of sysctl).

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>


6 files changed, 69 insertions(+), 22 deletions(-)
xen/common/sched_credit.c   |    5 +++++
xen/common/sched_credit2.c  |   17 +++++++++++++++++
xen/common/sched_sedf.c     |   20 ++++++++++++++++++++
xen/common/schedule.c       |    5 +++--
xen/include/public/domctl.h |   38 ++++++++++++++++++++------------------
xen/include/public/sysctl.h |    6 ++++--



[-- Attachment #2: xen-staging.hg-3.patch --]
[-- Type: text/x-patch, Size: 6493 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1337674472 -7200
# Node ID 56c50b3f6cc3eb1de8b86024d0e41e65345d9a79
# Parent  238900a4ed227d04c164d4cd12dfc66f7a25b946
Support of getting scheduler defaults

Support a new sysctl schedop sub-command to get the scheduling defaults of a
specific scheduler.

Additionally correct parameter checking of the sysctl handling in schedule.c
(checked wrong sub-commands: domctl instead of sysctl).

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>

diff -r 238900a4ed22 -r 56c50b3f6cc3 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Mon May 21 12:03:32 2012 +0200
+++ b/xen/common/sched_credit.c	Tue May 22 10:14:32 2012 +0200
@@ -858,6 +858,11 @@ csched_sys_cntl(const struct scheduler *
         params->ratelimit_us = prv->ratelimit_us;
         rc = 0;
         break;
+    case XEN_SYSCTL_SCHEDOP_getdefaults:
+        sc->u.defaults.credit.weight = CSCHED_DEFAULT_WEIGHT;
+        sc->u.defaults.credit.cap = 0U;
+        rc = 0;
+        break;
     }
     out:
     return rc;
diff -r 238900a4ed22 -r 56c50b3f6cc3 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Mon May 21 12:03:32 2012 +0200
+++ b/xen/common/sched_credit2.c	Tue May 22 10:14:32 2012 +0200
@@ -1423,6 +1423,22 @@ csched_dom_cntl(
     return 0;
 }
 
+static int
+csched_sys_cntl(const struct scheduler *ops,
+                        struct xen_sysctl_scheduler_op *sc)
+{
+    int rc = -EINVAL;
+
+    switch ( sc->cmd )
+    {
+    case XEN_SYSCTL_SCHEDOP_getdefaults:
+        sc->u.defaults.credit2.weight = CSCHED_DEFAULT_WEIGHT;
+        rc = 0;
+        break;
+    }
+    return rc;
+}
+
 static void *
 csched_alloc_domdata(const struct scheduler *ops, struct domain *dom)
 {
@@ -2110,6 +2126,7 @@ const struct scheduler sched_credit2_def
     .wake           = csched_vcpu_wake,
 
     .adjust         = csched_dom_cntl,
+    .adjust_global  = csched_sys_cntl,
 
     .pick_cpu       = csched_cpu_pick,
     .migrate        = csched_vcpu_migrate,
diff -r 238900a4ed22 -r 56c50b3f6cc3 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Mon May 21 12:03:32 2012 +0200
+++ b/xen/common/sched_sedf.c	Tue May 22 10:14:32 2012 +0200
@@ -1502,6 +1502,25 @@ out:
     return rc;
 }
 
+static int sedf_adjust_global(const struct scheduler *ops,
+                              struct xen_sysctl_scheduler_op *sc)
+{
+    int rc = -EINVAL;
+
+    switch ( sc->cmd )
+    {
+    case XEN_SYSCTL_SCHEDOP_getdefaults:
+        sc->u.defaults.sedf.period = WEIGHT_PERIOD;
+        sc->u.defaults.sedf.slice = 0;
+        sc->u.defaults.sedf.latency = 0;
+        sc->u.defaults.sedf.extratime = EXTRA_AWARE;
+        sc->u.defaults.sedf.weight = 0;
+        rc = 0;
+        break;
+    }
+    return rc;
+}
+
 static struct sedf_priv_info _sedf_priv;
 
 const struct scheduler sched_sedf_def = {
@@ -1531,6 +1550,7 @@ const struct scheduler sched_sedf_def = 
     .sleep          = sedf_sleep,
     .wake           = sedf_wake,
     .adjust         = sedf_adjust,
+    .adjust_global  = sedf_adjust_global,
 };
 
 /*
diff -r 238900a4ed22 -r 56c50b3f6cc3 xen/common/schedule.c
--- a/xen/common/schedule.c	Mon May 21 12:03:32 2012 +0200
+++ b/xen/common/schedule.c	Tue May 22 10:14:32 2012 +0200
@@ -1029,8 +1029,9 @@ long sched_adjust_global(struct xen_sysc
     struct cpupool *pool;
     int rc;
 
-    if ( (op->cmd != XEN_DOMCTL_SCHEDOP_putinfo) &&
-         (op->cmd != XEN_DOMCTL_SCHEDOP_getinfo) )
+    if ( (op->cmd != XEN_SYSCTL_SCHEDOP_putinfo) &&
+         (op->cmd != XEN_SYSCTL_SCHEDOP_getinfo) &&
+         (op->cmd != XEN_SYSCTL_SCHEDOP_getdefaults))
         return -EINVAL;
 
     pool = cpupool_get_by_id(op->cpupool_id);
diff -r 238900a4ed22 -r 56c50b3f6cc3 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Mon May 21 12:03:32 2012 +0200
+++ b/xen/include/public/domctl.h	Tue May 22 10:14:32 2012 +0200
@@ -303,28 +303,30 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_v
 #define XEN_SCHEDULER_CREDIT   5
 #define XEN_SCHEDULER_CREDIT2  6
 #define XEN_SCHEDULER_ARINC653 7
+/* Scheduling parameters (used in sysctl.h, too) */
+union xen_sched_par {
+    struct xen_domctl_sched_sedf {
+        uint64_aligned_t period;
+        uint64_aligned_t slice;
+        uint64_aligned_t latency;
+        uint32_t extratime;
+        uint32_t weight;
+    } sedf;
+    struct xen_domctl_sched_credit {
+        uint16_t weight;
+        uint16_t cap;
+    } credit;
+    struct xen_domctl_sched_credit2 {
+        uint16_t weight;
+    } credit2;
+};
 /* Set or get info? */
-#define XEN_DOMCTL_SCHEDOP_putinfo 0
-#define XEN_DOMCTL_SCHEDOP_getinfo 1
+#define XEN_DOMCTL_SCHEDOP_putinfo  0
+#define XEN_DOMCTL_SCHEDOP_getinfo  1
 struct xen_domctl_scheduler_op {
     uint32_t sched_id;  /* XEN_SCHEDULER_* */
     uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
-    union {
-        struct xen_domctl_sched_sedf {
-            uint64_aligned_t period;
-            uint64_aligned_t slice;
-            uint64_aligned_t latency;
-            uint32_t extratime;
-            uint32_t weight;
-        } sedf;
-        struct xen_domctl_sched_credit {
-            uint16_t weight;
-            uint16_t cap;
-        } credit;
-        struct xen_domctl_sched_credit2 {
-            uint16_t weight;
-        } credit2;
-    } u;
+    union xen_sched_par u;
 };
 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
diff -r 238900a4ed22 -r 56c50b3f6cc3 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Mon May 21 12:03:32 2012 +0200
+++ b/xen/include/public/sysctl.h	Tue May 22 10:14:32 2012 +0200
@@ -579,8 +579,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_credi
 
 /* XEN_SYSCTL_scheduler_op */
 /* Set or get info? */
-#define XEN_SYSCTL_SCHEDOP_putinfo 0
-#define XEN_SYSCTL_SCHEDOP_getinfo 1
+#define XEN_SYSCTL_SCHEDOP_putinfo     0
+#define XEN_SYSCTL_SCHEDOP_getinfo     1
+#define XEN_SYSCTL_SCHEDOP_getdefaults 2
 struct xen_sysctl_scheduler_op {
     uint32_t cpupool_id; /* Cpupool whose scheduler is to be targetted. */
     uint32_t sched_id;   /* XEN_SCHEDULER_* (domctl.h) */
@@ -590,6 +591,7 @@ struct xen_sysctl_scheduler_op {
             XEN_GUEST_HANDLE_64(xen_sysctl_arinc653_schedule_t) schedule;
         } sched_arinc653;
         struct xen_sysctl_credit_schedule sched_credit;
+        union xen_sched_par defaults;
     } u;
 };
 typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2012-05-22  9:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22  9:16 [PATCH 0 of 3] support of setting scheduler parameters on domain creation Juergen Gross
2012-05-22  9:16 ` Juergen Gross [this message]
2012-05-22 12:22   ` [PATCH 1 of 3] Support of getting scheduler defaults Ian Campbell
2012-05-22 12:29     ` Juergen Gross
2012-05-22 12:32       ` Ian Campbell
2012-05-22 12:58         ` Juergen Gross
2012-05-22 13:05           ` George Dunlap
2012-05-22 13:16             ` Ian Campbell
2012-05-22 13:40             ` Ian Campbell
2012-05-22 14:59               ` Ian Campbell
2012-05-22 23:46                 ` Dario Faggioli
2012-05-23  5:34                   ` Juergen Gross
2012-05-23  7:22                     ` Dario Faggioli
2012-05-23  7:41                       ` Ian Campbell
2012-05-23  8:45                         ` Juergen Gross
2012-05-23  9:17                           ` Ian Campbell
2012-05-23 10:18                           ` Dario Faggioli
2012-05-23  8:48                       ` Juergen Gross
2012-05-22  9:16 ` [PATCH 2 of 3] Support getting scheduler defaults in libxc Juergen Gross
2012-05-22  9:16 ` [PATCH 3 of 3] full support of setting scheduler parameters on domain creation Juergen Gross
2012-05-22 12:30   ` Ian Campbell
2012-05-22 12:39     ` Juergen Gross
2012-05-22 12:51       ` Ian Campbell
2012-05-22 22:15       ` Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56c50b3f6cc3eb1de8b8.1337678212@nehalem1 \
    --to=juergen.gross@ts.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).