Skip to contentSkip to conversation

libxc: enabling XL to set per-VCPU parameters of a domain for RTDS scheduler

PATCH In review Chong Li 2 participants 2 messages May 26, 2015 – Jun 5, 2015

lore
Share & tools
lore

Chong Li

author
#0 lore raw

PATCH v2 2/4 libxc: enabling XL to set per-VCPU parameters of a domain for RTDS scheduler

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

---
 tools/libxc/include/xenctrl.h |  9 ++++++++
 tools/libxc/xc_rt.c           | 53 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
tools/libxc/include/xenctrl.h +9 -0
index 6994c51..45cbf91 100644
@@ -892,6 +892,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,
+                            struct xen_domctl_sched_rtds_params *sdom,
+                            uint16_t num_vcpus);
+int xc_sched_rtds_vcpu_get(xc_interface *xch,
+                            uint32_t domid,
+                            struct xen_domctl_sched_rtds_params *sdom,
+                            uint16_t num_vcpus);
+
 int
 xc_sched_arinc653_schedule_set(
     xc_interface *xch,
tools/libxc/xc_rt.c +53 -0

56 lines not on this page · raw message

Signature · 1 line
1.9.1
Acked-by on v2 2/4
#1 lore raw
Quoted 6 lines · Chong Li

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

It looks like there is still some discussion around the shape of the underlying hypercall interface.

I think this is an ok wrapping of the interface as it is n the previous patch, so if that goes ahead:

Obviously if this needs to change due to changes in the underlying interface then this won't apply.

One nit below.

Quoted 33 lines
---
 tools/libxc/include/xenctrl.h |  9 ++++++++
 tools/libxc/xc_rt.c           | 53 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
tools/libxc/include/xenctrl.h +9 -0
index 6994c51..45cbf91 100644
@@ -892,6 +892,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,
+                            struct xen_domctl_sched_rtds_params *sdom,
+                            uint16_t num_vcpus);
+int xc_sched_rtds_vcpu_get(xc_interface *xch,
+                            uint32_t domid,
+                            struct xen_domctl_sched_rtds_params *sdom,
+                            uint16_t num_vcpus);
+
 int
 xc_sched_arinc653_schedule_set(
     xc_interface *xch,
tools/libxc/xc_rt.c +0 -0
index b2d1cc5..42aea22 100644
@@ -63,3 +63,56 @@ int xc_sched_rtds_domain_get(xc_interface *xch,
 
     return rc;
 }

tools/libxc/xc_rt.c int xc_sched_rtds_domain_get(xc_interface *xch, · line 75

Quoted 10 lines
tools/libxc/xc_rt.c +10 -0
+
+int xc_sched_rtds_vcpu_set(xc_interface *xch,
+                           uint32_t domid,
+                           struct xen_domctl_sched_rtds_params *sdom,
+                           uint16_t num_vcpus)
+{
+    int rc;
+    DECLARE_DOMCTL;
+    DECLARE_HYPERCALL_BOUNCE(sdom, sizeof(*sdom) * num_vcpus,
+            XC_HYPERCALL_BUFFER_BOUNCE_IN);

Blank line here please.

Quoted 43 lines
tools/libxc/xc_rt.c +43 -0
+    if ( xc_hypercall_bounce_pre(xch, sdom) )
+        return -1;
+
+    domctl.cmd = XEN_DOMCTL_scheduler_vcpu_op;
+    domctl.domain = (domid_t) domid;
+    domctl.u.scheduler_vcpu_op.sched_id = XEN_SCHEDULER_RTDS;
+    domctl.u.scheduler_vcpu_op.cmd = XEN_DOMCTL_SCHEDOP_putvcpuinfo;
+    domctl.u.scheduler_vcpu_op.u.rtds.nr_vcpus = num_vcpus;
+    set_xen_guest_handle(domctl.u.scheduler_vcpu_op.u.rtds.vcpus, sdom);
+
+    rc = do_domctl(xch, &domctl);
+
+    xc_hypercall_bounce_post(xch, sdom);
+
+    return rc;
+}
+
+int xc_sched_rtds_vcpu_get(xc_interface *xch,
+                           uint32_t domid,
+                           struct xen_domctl_sched_rtds_params *sdom,
+                           uint16_t num_vcpus)
+{
+    int rc;
+    DECLARE_DOMCTL;
+    DECLARE_HYPERCALL_BOUNCE(sdom, sizeof(*sdom) * num_vcpus,
+            XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+
+    if ( xc_hypercall_bounce_pre(xch, sdom) )
+        return -1;
+
+    domctl.cmd = XEN_DOMCTL_scheduler_vcpu_op;
+    domctl.domain = (domid_t) domid;
+    domctl.u.scheduler_vcpu_op.sched_id = XEN_SCHEDULER_RTDS;
+    domctl.u.scheduler_vcpu_op.cmd = XEN_DOMCTL_SCHEDOP_getvcpuinfo;
+    domctl.u.scheduler_vcpu_op.u.rtds.nr_vcpus=num_vcpus;
+    set_xen_guest_handle(domctl.u.scheduler_vcpu_op.u.rtds.vcpus, sdom);
+
+    rc = do_domctl(xch, &domctl);
+
+    xc_hypercall_bounce_post(xch, sdom);
+
+    return rc;
+}