Skip to contentSkip to conversation

Implement xl interface for setting credit 1 scheduler parameters

PATCH New George Dunlap 2 participants 4 messages Mar 2, 2012 – Mar 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Implement xl interface for setting credit 1 scheduler parameters

This is a refresh of the last two patches of my previous series, all the rest of which have been applied.

There was some discussion of changing the interface to be several commands, but there wasn't enough interest to motivate me to do the work.

#1 lore raw

PATCH 1/1 xl: Refactor sched_domain_output to have a callback for pool information

Allow a scheduler to provide a callback to display pool-wide information, providing a default. This is in preparation for displaying pool-wide scheduler parameters on this line.

tools/libxl/xl_cmdimpl.c +23 -9
diff -r 5e38c834f795 -r 70b0b974a29b tools/libxl/xl_cmdimpl.c
@@ -4055,13 +4055,23 @@ static int sched_sedf_domain_output(
     return 0;
 }
 
-static int sched_domain_output(
-    libxl_scheduler sched, int (*output)(int), const char *cpupool)
+static int sched_default_pool_output(uint32_t poolid)
+{
+    char *poolname;
+
+    poolname = libxl_cpupoolid_to_name(ctx, poolid);
+    printf("Cpupool %s:\n",
+           poolname);
+    free(poolname);
+    return 0;
+}
+
+static int sched_domain_output(libxl_scheduler sched, int (*output)(int),
+                               int (*pooloutput)(uint32_t), const char *cpupool)
 {
     libxl_dominfo *info;
     libxl_cpupoolinfo *poolinfo = NULL;
     uint32_t poolid;
-    char *poolname;
     int nb_domain, n_pools = 0, i, p;
     int rc = 0;
 
@@ -4089,9 +4099,7 @@ static int sched_domain_output(
             (cpupool && (poolid != poolinfo[p].poolid)))
             continue;
 
-        poolname = libxl_cpupoolid_to_name(ctx, poolinfo[p].poolid);
-        printf("Cpupool %s:\n", poolname);
-        free(poolname);
+        pooloutput(poolinfo[p].poolid);
 
         output(-1);
         for (i = 0; i < nb_domain; i++) {
@@ -4167,7 +4175,9 @@ int main_sched_credit(int argc, char **a
 
     if (!dom) { /* list all domain's credit scheduler info */
         return -sched_domain_output(LIBXL_SCHEDULER_CREDIT,
-                                    sched_credit_domain_output, cpupool);
+                                    sched_credit_domain_output,
+                                    sched_default_pool_output,
+                                    cpupool);
     } else {
         find_domain(dom);
 
@@ -4244,7 +4254,9 @@ int main_sched_credit2(int argc, char **
 
     if (!dom) { /* list all domain's credit scheduler info */
         return -sched_domain_output(LIBXL_SCHEDULER_CREDIT2,
-                                    sched_credit2_domain_output, cpupool);
+                                    sched_credit2_domain_output,
+                                    sched_default_pool_output,
+                                    cpupool);
     } else {
         find_domain(dom);
 
@@ -4347,7 +4359,9 @@ int main_sched_sedf(int argc, char **arg
 
     if (!dom) { /* list all domain's credit scheduler info */
         return -sched_domain_output(LIBXL_SCHEDULER_SEDF,
-                                    sched_sedf_domain_output, cpupool);
+                                    sched_sedf_domain_output,
+                                    sched_default_pool_output,
+                                    cpupool);
     } else {
         find_domain(dom);
#2 lore raw

PATCH 1/1 xl: Implement sched-credit schedule parameter command-line interface

In reply to George Dunlap

Add features to the sched-credit interface to allow querying and displaying scheduler parameters.

v2:
- Change function line breaks
- Pool output deals gracefully with other schedulers
- Add new parameters, as well as a description of how they interact, to the xl man page

docs/man/xl.pod.1 +47 -0
diff -r 70b0b974a29b -r 3fd100808072 docs/man/xl.pod.1
@@ -714,6 +714,53 @@ no upper cap.
 
 Restrict output to domains in the specified cpupool.
 
+=item B<-s>, B<--schedparam>
+
+Specify to list or set pool-wide scheduler parameters.
+
+=item B<-t TSLICE>, B<--tslice_ms=TSLICE>
+
+Timeslice tells the scheduler how long to allow VMs to run before
+pre-empting.  The default is 30ms.  Valid ranges are 1ms to 1000ms.
+The length of the timeslice (in ms) must be higher than the length of
+the ratelimit (see below).
+
+=item B<-r RLIMIT>, B<--ratelimit_us=RLIMIT>
+
+Ratelimit attempts to limit the number of schedules per second.  It
+sets a minimum amount of time (in microseconds) a VM must run before
+we will allow a higher-prioirty VM to pre-empt it.  The default value
+is 1000 microseconds (1ms).  Valid range is 100 to 500000 (500ms).
+The ratelimit length must be lower than the timeslice length.
+
+=back
+
+B<COMBINATION>
+
+The following is the effect of combining the above options:
+
+=over 4
+
+=item B<E<lt>nothingE<gt>>             : List all domain params and sched params from all pools
+
+=item B<-d [domid]>            : List domain params for domain [domid]
+
+=item B<-d [domid] [params]>   : Set domain params for domain [domid]
+
+=item B<-p [pool]>             : list all domains and sched params for [pool]
+
+=item B<-s>                    : List sched params for poolid 0
+
+=item B<-s [params]>           : Set sched params for poolid 0
+
+=item B<-p [pool] -s>          : List sched params for [pool]
+
+=item B<-p [pool] -s [params]> : Set sched params for [pool]
+
+=item B<-p [pool] -d>...       : Illegal
+
+=item
+
 =back
 
 =item B<sched-credit2> [I<OPTIONS>]
tools/libxl/xl_cmdimpl.c +114 -13

195 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +8 -5
diff -r 70b0b974a29b -r 3fd100808072 tools/libxl/xl_cmdtable.c
@@ -204,11 +204,14 @@ struct cmd_spec cmd_table[] = {
     { "sched-credit",
       &main_sched_credit, 0,
       "Get/set credit scheduler parameters",
-      "[-d <Domain> [-w[=WEIGHT]|-c[=CAP]]] [-p CPUPOOL]",
-      "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
-      "-w WEIGHT, --weight=WEIGHT     Weight (int)\n"
-      "-c CAP, --cap=CAP              Cap (int)\n"
-      "-p CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
+      "[-d <Domain> [-w[=WEIGHT]|-c[=CAP]]] [-s [-t TSLICE] [-r RATELIMIT]] [-p CPUPOOL]",
+      "-d DOMAIN, --domain=DOMAIN        Domain to modify\n"
+      "-w WEIGHT, --weight=WEIGHT        Weight (int)\n"
+      "-c CAP, --cap=CAP                 Cap (int)\n"
+      "-s         --schedparam           Query / modify scheduler parameters\n"
+      "-t TSLICE, --tslice_ms=TSLICE     Set the timeslice, in milliseconds\n"
+      "-r RLIMIT, --ratelimit_us=RLIMIT  Set the scheduling rate limit, in microseconds\n"
+      "-p CPUPOOL, --cpupool=CPUPOOL     Restrict output to CPUPOOL"
     },
     { "sched-credit2",
       &main_sched_credit2, 0,
Acked-by on v1 1/1
#3 lore raw

Re: [PATCH 2 of 2] xl: Implement sched-credit schedule parameter command-line interface

George Dunlap writes ("[Xen-devel] [PATCH 2 of 2] xl: Implement sched-credit schedule parameter command-line interface"):

Quoted 2 lines

Add features to the sched-credit interface to allow querying and displaying scheduler parameters.

(applied both)

Thanks,
Ian.