From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chong Li Subject: [PATCH v4 for Xen 4.6 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler Date: Fri, 10 Jul 2015 23:52:34 -0500 Message-ID: <1436590356-3706-3-git-send-email-chong.li@wustl.edu> References: <1436590356-3706-1-git-send-email-chong.li@wustl.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436590356-3706-1-git-send-email-chong.li@wustl.edu> 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.xen.org Cc: Chong Li , wei.liu2@citrix.com, Sisu Xi , george.dunlap@eu.citrix.com, dario.faggioli@citrix.com, Meng Xu , lichong659@gmail.com, dgolomb@seas.upenn.edu List-Id: xen-devel@lists.xenproject.org Add xc_sched_rtds_vcpu_get/set functions to interact with Xen to get/set a domain's per-VCPU parameters. Signed-off-by: Chong Li Signed-off-by: Meng Xu Signed-off-by: Sisu Xi --- CC: CC: CC: CC: CC: CC: --- tools/libxc/include/xenctrl.h | 9 +++++++ tools/libxc/xc_rt.c | 58 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index d1d2ab3..58f1a7a 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -915,6 +915,15 @@ int xc_sched_rtds_domain_get(xc_interface *xch, uint32_t domid, struct xen_domctl_sched_rtds *sdom); +int xc_sched_rtds_vcpu_set(xc_interface *xch, + uint32_t domid, + xen_domctl_schedparam_vcpu_t *vcpus, + uint16_t num_vcpus); +int xc_sched_rtds_vcpu_get(xc_interface *xch, + uint32_t domid, + xen_domctl_schedparam_vcpu_t *vcpus, + uint16_t num_vcpus); + int xc_sched_arinc653_schedule_set( xc_interface *xch, diff --git a/tools/libxc/xc_rt.c b/tools/libxc/xc_rt.c index b2d1cc5..257a962 100644 --- a/tools/libxc/xc_rt.c +++ b/tools/libxc/xc_rt.c @@ -27,7 +27,7 @@ int xc_sched_rtds_domain_set(xc_interface *xch, uint32_t domid, - struct xen_domctl_sched_rtds *sdom) + xen_domctl_sched_rtds_t *sdom) { int rc; DECLARE_DOMCTL; @@ -46,7 +46,7 @@ int xc_sched_rtds_domain_set(xc_interface *xch, int xc_sched_rtds_domain_get(xc_interface *xch, uint32_t domid, - struct xen_domctl_sched_rtds *sdom) + xen_domctl_sched_rtds_t *sdom) { int rc; DECLARE_DOMCTL; @@ -63,3 +63,57 @@ int xc_sched_rtds_domain_get(xc_interface *xch, return rc; } + +int xc_sched_rtds_vcpu_set(xc_interface *xch, + uint32_t domid, + xen_domctl_schedparam_vcpu_t *vcpus, + uint16_t num_vcpus) +{ + int rc; + DECLARE_DOMCTL; + DECLARE_HYPERCALL_BOUNCE(vcpus, sizeof(*vcpus) * num_vcpus, + XC_HYPERCALL_BUFFER_BOUNCE_IN); + + if ( xc_hypercall_bounce_pre(xch, vcpus) ) + return -1; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.domain = (domid_t) domid; + domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putvcpuinfo; + domctl.u.scheduler_op.u.v.nr_vcpus = num_vcpus; + set_xen_guest_handle(domctl.u.scheduler_op.u.v.vcpus, vcpus); + + rc = do_domctl(xch, &domctl); + + xc_hypercall_bounce_post(xch, vcpus); + + return rc; +} + +int xc_sched_rtds_vcpu_get(xc_interface *xch, + uint32_t domid, + xen_domctl_schedparam_vcpu_t *vcpus, + uint16_t num_vcpus) +{ + int rc; + DECLARE_DOMCTL; + DECLARE_HYPERCALL_BOUNCE(vcpus, sizeof(*vcpus) * num_vcpus, + XC_HYPERCALL_BUFFER_BOUNCE_BOTH); + + if ( xc_hypercall_bounce_pre(xch, vcpus) ) + return -1; + + domctl.cmd = XEN_DOMCTL_scheduler_op; + domctl.domain = (domid_t) domid; + domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS; + domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getvcpuinfo; + domctl.u.scheduler_op.u.v.nr_vcpus = num_vcpus; + set_xen_guest_handle(domctl.u.scheduler_op.u.v.vcpus, vcpus); + + rc = do_domctl(xch, &domctl); + + xc_hypercall_bounce_post(xch, vcpus); + + return rc; +} -- 1.9.1