From: George Dunlap Subject: [PATCH 05 of 10] libxc: Implement SCHEDOP sysctl for credit scheduler Date: Tue, 21 Feb 2012 13:34:11 +0000 Message-ID: <5e3ca9be617e7c82d305.1329831251@kodo2> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 Cc: george.dunlap@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Signed-off-by: George Dunlap 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);