From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: [PATCH 1 of 3] Support of getting scheduler defaults Date: Tue, 22 May 2012 11:16:52 +0200 Message-ID: <56c50b3f6cc3eb1de8b8.1337678212@nehalem1> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4599931488081339510==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============4599931488081339510== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 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 ++++-- --===============4599931488081339510== Content-Type: text/x-patch; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xen-staging.hg-3.patch # HG changeset patch # User Juergen Gross # 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 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; --===============4599931488081339510== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============4599931488081339510==--