The main purpose of the patch is to provide the xen-libxc
plumbing necessary to be able to change the value of the
ratelimit_us parameter online, for Credit2 (like it is
already for Credit1).
While there:
- mention in the Xen logs when rate limiting was enables
and is being disabled (and vice-versa);
- fix csched2_sys_cntl() which was always returning
-EINVAL in the XEN_SYSCTL_SCHEDOP_putinfo case.
And also:
- fix style of an if in csched_sys_cntl();
- fix the style of the switch in csched2_sys_cntl();
Signed-off-by: Dario Faggioli
---
Cc: George Dunlap
Cc: Anshul Makkar
Cc: Jan Beulich
Cc: Ian Jackson
Cc: Wei Liu
---
tools/libxc/include/xenctrl.h | 32 ++
tools/libxc/xc_csched2.c | 44 +
xen/common/sched_credit.c | 16 +--
xen/common/sched_credit2.c| 38 ---
xen/include/public/sysctl.h | 17 +---
5 files changed, 108 insertions(+), 39 deletions(-)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 560ce7b..7a50895 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -910,25 +910,31 @@ int xc_sched_credit_domain_get(xc_interface *xch,
uint32_t domid,
struct xen_domctl_sched_credit *sdom);
int xc_sched_credit_params_set(xc_interface *xch,
- uint32_t cpupool_id,
- struct xen_sysctl_credit_schedule *schedule);
+ uint32_t cpupool_id,
+ struct xen_sysctl_credit_schedule *schedule);
int xc_sched_credit_params_get(xc_interface *xch,
- uint32_t cpupool_id,
- struct xen_sysctl_credit_schedule *schedule);
+ uint32_t cpupool_id,
+ struct xen_sysctl_credit_schedule *schedule);
+
+int xc_sched_credit2_params_set(xc_interface *xch,
+uint32_t cpupool_id,
+struct xen_sysctl_credit2_schedule *schedule);
+int xc_sched_credit2_params_get(xc_interface *xch,
+uint32_t cpupool_id,
+struct xen_sysctl_credit2_schedule *schedule);
int xc_sched_credit2_domain_set(xc_interface *xch,
- uint32_t domid,
- struct xen_domctl_sched_credit2 *sdom);
-
+uint32_t domid,
+struct xen_domctl_sched_credit2 *sdom);
int xc_sched_credit2_domain_get(xc_interface *xch,
- uint32_t domid,
- struct xen_domctl_sched_credit2 *sdom);
+uint32_t domid,
+struct xen_domctl_sched_credit2 *sdom);
int xc_sched_rtds_domain_set(xc_interface *xch,
-uint32_t domid,
-struct xen_domctl_sched_rtds *sdom);
+ uint32_t domid,
+ struct xen_domctl_sched_rtds *sdom);
int xc_sched_rtds_domain_get(xc_interface *xch,
-uint32_t domid,
-struct xen_domctl_sched_rtds *sdom);
+ uint32_t domid,
+ struct xen_domctl_sched_rtds *sdom);
int xc_sched_rtds_vcpu_set(xc_interface *xch,
uint32_t domid,
struct xen_domctl_schedparam_vcpu *vcpus,
diff --git a/tools/libxc/xc_csched2.c b/tools/libxc/xc_csched2.c
index ed99605..5b62a5f 100644
--- a/tools/libxc/xc_csched2.c
+++ b/tools/libxc/xc_csched2.c
@@ -60,3 +60,47 @@ xc_sched_credit2_domain_get(
return err;
}
+
+int
+xc_sched_credit2_params_set(
+xc_interface *xch,
+uint32_t cpupool_id,
+struct xen_sysctl_credit2_schedule *schedule)
+{
+DECLARE_SYSCTL;
+
+sysctl.cmd = XEN_SYSCTL_scheduler_op;
+sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT2;
+sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_putinfo;
+
+sysctl.u.scheduler_op.u.sched_credit2 = *schedule;
+
+if ( do_sysctl(xch, ) )
+return -1;
+
+*schedule = sysctl.u.scheduler_op.u.sched_credit2;
+
+return 0;
+}
+
+int
+xc_sched_credit2_params_get(
+xc_interface *xch,
+uint32_t cpupool_id,
+struct xen_sysctl_credit2_schedule *schedule)
+{
+DECLARE_SYSCTL;
+
+sysctl.cmd = XEN_SYSCTL_scheduler_op;
+sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT2;
+sysctl.u.scheduler_op.cmd =