Re: [Xen-devel] [PATCH 12/24] xen: libxc: allow to set the ratelimit value online

2016-09-28 Thread George Dunlap
On 17/08/16 18:18, Dario Faggioli wrote:
> 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 

BTW, I've applied both this and the following patch.

When I did a rebase of the series on top of this, this patch erroneously
double-applies the hunk in xc_csched2.c, causing the subsequent patch to
report a merge conflict.  So you may want to beware of that if you just
do a plain git rebase. :-)

 -George


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 12/24] xen: libxc: allow to set the ratelimit value online

2016-09-20 Thread Wei Liu
On Tue, Sep 20, 2016 at 03:43:57PM +0100, George Dunlap wrote:
> On 17/08/16 18:18, Dario Faggioli wrote:
> > 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.
> 
> How weird!
> 
> > 
> > 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 
> 
> Reviewed-by: George Dunlap 
> 
> Wei / Ian, I think this is relatively independent of other changes -- if
> you give me an Ack for the tools side I can check this in.
> 

Here you go:

Acked-by: Wei Liu 

>   -George

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 12/24] xen: libxc: allow to set the ratelimit value online

2016-09-20 Thread George Dunlap
On 17/08/16 18:18, Dario Faggioli wrote:
> 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.

How weird!

> 
> 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 

Reviewed-by: George Dunlap 

Wei / Ian, I think this is relatively independent of other changes -- if
you give me an Ack for the tools side I can check this in.

  -George

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH 12/24] xen: libxc: allow to set the ratelimit value online

2016-08-17 Thread Dario Faggioli
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 =