[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 for Xen 4.6 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler



Add xc_sched_rtds_vcpu_get/set functions to interact with Xen to get/set a 
domain's
per-VCPU parameters.

Changes on PATCH v2:

1) Minor modifications due to the change of struct xen_domctl_scheduler_op.

Signed-off-by: Chong Li <chong.li@xxxxxxxxx>
Signed-off-by: Meng Xu <mengxu@xxxxxxxxxxxxx>
Signed-off-by: Sisu Xi <xisisu@xxxxxxxxx>

---
CC: <dario.faggioli@xxxxxxxxxx>
CC: <george.dunlap@xxxxxxxxxxxxx>
CC: <dgolomb@xxxxxxxxxxxxxx>
CC: <mengxu@xxxxxxxxxxxxx>
CC: <wei.liu2@xxxxxxxxxx>
CC: <lichong659@xxxxxxxxx>
---
 tools/libxc/include/xenctrl.h |  9 ++++++
 tools/libxc/xc_csched.c       |  4 +--
 tools/libxc/xc_csched2.c      |  4 +--
 tools/libxc/xc_rt.c           | 64 +++++++++++++++++++++++++++++++++++++++----
 tools/libxc/xc_sedf.c         |  4 +--
 5 files changed, 74 insertions(+), 11 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_csched.c b/tools/libxc/xc_csched.c
index 390c645..5a2bdf4 100644
--- a/tools/libxc/xc_csched.c
+++ b/tools/libxc/xc_csched.c
@@ -36,7 +36,7 @@ xc_sched_credit_domain_set(
     domctl.domain = (domid_t) domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
-    domctl.u.scheduler_op.u.credit = *sdom;
+    domctl.u.scheduler_op.u.d.credit = *sdom;
 
     return do_domctl(xch, &domctl);
 }
@@ -57,7 +57,7 @@ xc_sched_credit_domain_get(
 
     err = do_domctl(xch, &domctl);
     if ( err == 0 )
-        *sdom = domctl.u.scheduler_op.u.credit;
+        *sdom = domctl.u.scheduler_op.u.d.credit;
 
     return err;
 }
diff --git a/tools/libxc/xc_csched2.c b/tools/libxc/xc_csched2.c
index 6da6a46..a604278 100644
--- a/tools/libxc/xc_csched2.c
+++ b/tools/libxc/xc_csched2.c
@@ -36,7 +36,7 @@ xc_sched_credit2_domain_set(
     domctl.domain = (domid_t) domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT2;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
-    domctl.u.scheduler_op.u.credit2 = *sdom;
+    domctl.u.scheduler_op.u.d.credit2 = *sdom;
 
     return do_domctl(xch, &domctl);
 }
@@ -57,7 +57,7 @@ xc_sched_credit2_domain_get(
 
     err = do_domctl(xch, &domctl);
     if ( err == 0 )
-        *sdom = domctl.u.scheduler_op.u.credit2;
+        *sdom = domctl.u.scheduler_op.u.d.credit2;
 
     return err;
 }
diff --git a/tools/libxc/xc_rt.c b/tools/libxc/xc_rt.c
index b2d1cc5..ee139b1 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;
@@ -36,8 +36,8 @@ int xc_sched_rtds_domain_set(xc_interface *xch,
     domctl.domain = (domid_t) domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
-    domctl.u.scheduler_op.u.rtds.period = sdom->period;
-    domctl.u.scheduler_op.u.rtds.budget = sdom->budget;
+    domctl.u.scheduler_op.u.d.rtds.period = sdom->period;
+    domctl.u.scheduler_op.u.d.rtds.budget = sdom->budget;
 
     rc = do_domctl(xch, &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;
@@ -59,7 +59,61 @@ int xc_sched_rtds_domain_get(xc_interface *xch,
     rc = do_domctl(xch, &domctl);
 
     if ( rc == 0 )
-        *sdom = domctl.u.scheduler_op.u.rtds;
+        *sdom = domctl.u.scheduler_op.u.d.rtds;
+
+    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;
 }
diff --git a/tools/libxc/xc_sedf.c b/tools/libxc/xc_sedf.c
index db372ca..a1cf5f0 100644
--- a/tools/libxc/xc_sedf.c
+++ b/tools/libxc/xc_sedf.c
@@ -34,7 +34,7 @@ int xc_sedf_domain_set(
     uint16_t weight)
 {
     DECLARE_DOMCTL;
-    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
+    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.d.sedf;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
     domctl.domain  = (domid_t)domid;
@@ -60,7 +60,7 @@ int xc_sedf_domain_get(
 {
     DECLARE_DOMCTL;
     int ret;
-    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
+    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.d.sedf;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
     domctl.domain = (domid_t)domid;
-- 
1.9.1


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.