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

2015-07-07 Thread Chong Li
On Tue, Jul 7, 2015 at 10:34 AM, Dario Faggioli
dario.faggi...@citrix.com wrote:
 On Sun, 2015-06-28 at 21:44 -0500, Chong Li wrote:
 Change main_sched_rtds and related output functions to support per-VCPU 
 settings.

 Changes on PATCH v2:

 1) Remove per-domain output functions for RTDS scheduler.

 2) Users now use '-v all' to specify all VCPUs.

 3) Support outputting a subset of the parameters of the VCPUs of a specific 
 domain.

 4) When setting all VCPUs with the same parameters (by only one command), no 
 per-domain function is invoked.

 Signed-off-by: Chong Li chong...@wustl.edu
 Signed-off-by: Meng Xu men...@cis.upenn.edu
 Signed-off-by: Sisu Xi xis...@gmail.com

 I think this patch is fine. I've asked already, when replying to the
 cover message, what happens if one uses just:

  # xl sched-rtds

 or

 # xl sched-rtds -d vm1

 and it looks to me that, instead of getting rid of
 sched_rtds_domain_output(), you can leave it there and make it respond
 to the above calls, with the effect of returning the default values, as
 agreed and implemented.

I agree. I'll do that in the next version.

Chong


 Dario
 --
 This happens because I choose it to happen! (Raistlin Majere)
 -
 Dario Faggioli, Ph.D, http://about.me/dario.faggioli
 Senior Software Engineer, Citrix Systems RD Ltd., Cambridge (UK)



-- 
Chong Li
Department of Computer Science and Engineering
Washington University in St.louis

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


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

2015-07-07 Thread Dario Faggioli
On Sun, 2015-06-28 at 21:44 -0500, Chong Li wrote:
 Change main_sched_rtds and related output functions to support per-VCPU 
 settings.
 
 Changes on PATCH v2:
 
 1) Remove per-domain output functions for RTDS scheduler.
 
 2) Users now use '-v all' to specify all VCPUs.
 
 3) Support outputting a subset of the parameters of the VCPUs of a specific 
 domain.
 
 4) When setting all VCPUs with the same parameters (by only one command), no 
 per-domain function is invoked.
 
 Signed-off-by: Chong Li chong...@wustl.edu
 Signed-off-by: Meng Xu men...@cis.upenn.edu
 Signed-off-by: Sisu Xi xis...@gmail.com
 
I think this patch is fine. I've asked already, when replying to the
cover message, what happens if one uses just:

 # xl sched-rtds

or

# xl sched-rtds -d vm1

and it looks to me that, instead of getting rid of
sched_rtds_domain_output(), you can leave it there and make it respond
to the above calls, with the effect of returning the default values, as
agreed and implemented.

What do you think? If not done like this (and if I'm not missing
something), is there a way to retrieve those values from xl?

Dario
-- 
This happens because I choose it to happen! (Raistlin Majere)
-
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems RD Ltd., Cambridge (UK)


signature.asc
Description: This is a digitally signed message part
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


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

2015-06-28 Thread Chong Li
Change main_sched_rtds and related output functions to support per-VCPU 
settings.

Changes on PATCH v2:

1) Remove per-domain output functions for RTDS scheduler.

2) Users now use '-v all' to specify all VCPUs.

3) Support outputting a subset of the parameters of the VCPUs of a specific 
domain.

4) When setting all VCPUs with the same parameters (by only one command), no 
per-domain function is invoked.

Signed-off-by: Chong Li chong...@wustl.edu
Signed-off-by: Meng Xu men...@cis.upenn.edu
Signed-off-by: Sisu Xi xis...@gmail.com

---
CC: dario.faggi...@citrix.com
CC: george.dun...@eu.citrix.com
CC: dgol...@seas.upenn.edu
CC: men...@cis.upenn.edu
CC: wei.l...@citrix.com
CC: lichong...@gmail.com
---
 docs/man/xl.pod.1 |   4 +
 tools/libxl/xl_cmdimpl.c  | 284 +++---
 tools/libxl/xl_cmdtable.c |  10 +-
 3 files changed, 250 insertions(+), 48 deletions(-)

diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1
index 4eb929d..d35e169 100644
--- a/docs/man/xl.pod.1
+++ b/docs/man/xl.pod.1
@@ -1093,6 +1093,10 @@ BOPTIONS
 Specify domain for which scheduler parameters are to be modified or retrieved.
 Mandatory for modifying scheduler parameters.
 
+=item B-v VCPUID/all, B--vcpuid=VCPUID/all
+
+Specify vcpu for which scheduler parameters are to be modified or retrieved.
+
 =item B-p PERIOD, B--period=PERIOD
 
 Period of time, in microseconds, over which to replenish the budget.
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index c858068..7f120af 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5630,6 +5630,37 @@ static int sched_domain_set(int domid, const 
libxl_domain_sched_params *scinfo)
 return rc;
 }
 
+static int sched_vcpu_get(libxl_scheduler sched, int domid,
+libxl_vcpu_sched_params *scinfo)
+{
+int rc;
+
+rc = libxl_vcpu_sched_params_get(ctx, domid, scinfo);
+if (rc) {
+fprintf(stderr, libxl_vcpu_sched_params_get failed.\n);
+return rc;
+}
+if (scinfo-sched != sched) {
+fprintf(stderr, libxl_vcpu_sched_params_get returned %s not %s.\n,
+libxl_scheduler_to_string(scinfo-sched),
+libxl_scheduler_to_string(sched));
+return ERROR_INVAL;
+}
+
+return 0;
+}
+
+static int sched_vcpu_set(int domid, const libxl_vcpu_sched_params *scinfo)
+{
+int rc;
+
+rc = libxl_vcpu_sched_params_set(ctx, domid, scinfo);
+if (rc)
+fprintf(stderr, libxl_vcpu_sched_params_set failed.\n);
+
+return rc;
+}
+
 static int sched_credit_params_set(int poolid, libxl_sched_credit_params 
*scinfo)
 {
 int rc;
@@ -5756,33 +5787,35 @@ static int sched_sedf_domain_output(
 return 0;
 }
 
-static int sched_rtds_domain_output(
-int domid)
+static int sched_rtds_vcpu_output(
+int domid, libxl_vcpu_sched_params *scinfo)
 {
 char *domname;
-libxl_domain_sched_params scinfo;
 int rc = 0;
+int i;
 
-if (domid  0) {
-printf(%-33s %4s %9s %9s\n, Name, ID, Period, Budget);
+   if (domid  0) {
+printf(%-33s %4s %4s %9s %9s\n, Name, ID,
+VCPU, Period, Budget);
 return 0;
 }
 
-libxl_domain_sched_params_init(scinfo);
-rc = sched_domain_get(LIBXL_SCHEDULER_RTDS, domid, scinfo);
+rc = sched_vcpu_get(LIBXL_SCHEDULER_RTDS, domid, scinfo);
 if (rc)
 goto out;
 
 domname = libxl_domid_to_name(ctx, domid);
-printf(%-33s %4d %9d %9d\n,
-domname,
-domid,
-scinfo.period,
-scinfo.budget);
+ for( i = 0; i  scinfo-num_vcpus; i++ ) {
+printf(%-33s %4d %4d %9PRIu32 %9PRIu32\n,
+domname,
+domid,
+scinfo-vcpus[i].vcpuid,
+scinfo-vcpus[i].period,
+scinfo-vcpus[i].budget);
+}
 free(domname);
 
 out:
-libxl_domain_sched_params_dispose(scinfo);
 return rc;
 }
 
@@ -5859,6 +5892,65 @@ static int sched_domain_output(libxl_scheduler sched, 
int (*output)(int),
 return 0;
 }
 
+static int sched_vcpu_output(libxl_scheduler sched,
+   int (*output)(int, libxl_vcpu_sched_params *),
+   int (*pooloutput)(uint32_t), const char 
*cpupool)
+{
+libxl_dominfo *info;
+libxl_cpupoolinfo *poolinfo = NULL;
+uint32_t poolid;
+int nb_domain, n_pools = 0, i, p;
+int rc = 0;
+
+if (cpupool) {
+if (libxl_cpupool_qualifier_to_cpupoolid(ctx, cpupool, poolid, NULL) 
||
+!libxl_cpupoolid_is_valid(ctx, poolid)) {
+fprintf(stderr, unknown cpupool \'%s\'\n, cpupool);
+return -ERROR_FAIL;
+}
+}
+
+info = libxl_list_domain(ctx, nb_domain);
+if (!info) {
+fprintf(stderr, libxl_list_domain failed.\n);
+return 1;
+}
+poolinfo = libxl_list_cpupool(ctx, n_pools);
+if (!poolinfo) {
+fprintf(stderr, error getting cpupool info\n);
+