All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Dario Faggioli <dario.faggioli@citrix.com>,
	xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH 15/24] xl: allow to set the ratelimit value online for Credit2
Date: Wed, 28 Sep 2016 16:46:21 +0100	[thread overview]
Message-ID: <56235acc-d4ed-15f7-e045-3b70c9b9f329@citrix.com> (raw)
In-Reply-To: <147145435877.25877.13837636606605138738.stgit@Solace.fritz.box>

On 17/08/16 18:19, Dario Faggioli wrote:
> Last part of the wiring necessary for allowing to
> change the value of the ratelimit_us parameter online,
> for Credit2 (like it is already for Credit1).
> 
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> ---
>  docs/man/xl.pod.1.in      |    9 ++++
>  tools/libxl/xl_cmdimpl.c  |   91 +++++++++++++++++++++++++++++++++++++--------
>  tools/libxl/xl_cmdtable.c |    2 +
>  3 files changed, 86 insertions(+), 16 deletions(-)
> 
> diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in
> index 1adf322..013591b 100644
> --- a/docs/man/xl.pod.1.in
> +++ b/docs/man/xl.pod.1.in
> @@ -1089,6 +1089,15 @@ to 65535 and the default is 256.
>  
>  Restrict output to domains in the specified cpupool.
>  
> +=item B<-s>, B<--schedparam>
> +
> +Specify to list or set pool-wide scheduler parameters.
> +
> +=item B<-r RLIMIT>, B<--ratelimit_us=RLIMIT>
> +
> +Attempts to limit the rate of context switching. It is basically the same
> +as B<--ratelimit_us> in B<sched-credit>
> +

This is a bit of a strange interface, but it follows suit with what the
credit1 command does, so:

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

>  =back
>  
>  =item B<sched-rtds> [I<OPTIONS>]
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 7f961e3..5bdeda8 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -6452,8 +6452,29 @@ static int sched_credit_pool_output(uint32_t poolid)
>      return 0;
>  }
>  
> -static int sched_credit2_domain_output(
> -    int domid)
> +static int sched_credit2_params_set(int poolid,
> +                                    libxl_sched_credit2_params *scinfo)
> +{
> +    if (libxl_sched_credit2_params_set(ctx, poolid, scinfo)) {
> +        fprintf(stderr, "libxl_sched_credit2_params_set failed.\n");
> +        return 1;
> +    }
> +
> +    return 0;
> +}
> +
> +static int sched_credit2_params_get(int poolid,
> +                                    libxl_sched_credit2_params *scinfo)
> +{
> +    if (libxl_sched_credit2_params_get(ctx, poolid, scinfo)) {
> +        fprintf(stderr, "libxl_sched_credit2_params_get failed.\n");
> +        return 1;
> +    }
> +
> +    return 0;
> +}
> +
> +static int sched_credit2_domain_output(int domid)
>  {
>      char *domname;
>      libxl_domain_sched_params scinfo;
> @@ -6478,6 +6499,22 @@ static int sched_credit2_domain_output(
>      return 0;
>  }
>  
> +static int sched_credit2_pool_output(uint32_t poolid)
> +{
> +    libxl_sched_credit2_params scparam;
> +    char *poolname = libxl_cpupoolid_to_name(ctx, poolid);
> +
> +    if (sched_credit2_params_get(poolid, &scparam))
> +        printf("Cpupool %s: [sched params unavailable]\n", poolname);
> +    else
> +        printf("Cpupool %s: ratelimit=%dus\n",
> +               poolname, scparam.ratelimit_us);
> +
> +    free(poolname);
> +
> +    return 0;
> +}
> +
>  static int sched_rtds_domain_output(
>      int domid)
>  {
> @@ -6577,17 +6614,6 @@ static int sched_rtds_pool_output(uint32_t poolid)
>      return 0;
>  }
>  
> -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)
>  {
> @@ -6833,17 +6859,22 @@ int main_sched_credit2(int argc, char **argv)
>  {
>      const char *dom = NULL;
>      const char *cpupool = NULL;
> +    int ratelimit = 0;
>      int weight = 256;
> +    bool opt_s = false;
> +    bool opt_r = false;
>      bool opt_w = false;
>      int opt, rc;
>      static struct option opts[] = {
>          {"domain", 1, 0, 'd'},
>          {"weight", 1, 0, 'w'},
> +        {"schedparam", 0, 0, 's'},
> +        {"ratelimit_us", 1, 0, 'r'},
>          {"cpupool", 1, 0, 'p'},
>          COMMON_LONG_OPTS
>      };
>  
> -    SWITCH_FOREACH_OPT(opt, "d:w:p:", opts, "sched-credit2", 0) {
> +    SWITCH_FOREACH_OPT(opt, "d:w:p:r:s", opts, "sched-credit2", 0) {
>      case 'd':
>          dom = optarg;
>          break;
> @@ -6851,6 +6882,13 @@ int main_sched_credit2(int argc, char **argv)
>          weight = strtol(optarg, NULL, 10);
>          opt_w = true;
>          break;
> +    case 's':
> +        opt_s = true;
> +        break;
> +    case 'r':
> +        ratelimit = strtol(optarg, NULL, 10);
> +        opt_r = true;
> +        break;
>      case 'p':
>          cpupool = optarg;
>          break;
> @@ -6866,10 +6904,31 @@ int main_sched_credit2(int argc, char **argv)
>          return EXIT_FAILURE;
>      }
>  
> -    if (!dom) { /* list all domain's credit scheduler info */
> +    if (opt_s) {
> +        libxl_sched_credit2_params scparam;
> +        uint32_t poolid = 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 EXIT_FAILURE;
> +            }
> +        }
> +
> +        if (!opt_r) { /* Output scheduling parameters */
> +            if (sched_credit2_pool_output(poolid))
> +                return EXIT_FAILURE;
> +        } else {      /* Set scheduling parameters (so far, just ratelimit) */
> +            scparam.ratelimit_us = ratelimit;
> +            if (sched_credit2_params_set(poolid, &scparam))
> +                return EXIT_FAILURE;
> +        }
> +    } else if (!dom) { /* list all domain's credit scheduler info */
>          if (sched_domain_output(LIBXL_SCHEDULER_CREDIT2,
>                                  sched_credit2_domain_output,
> -                                sched_default_pool_output,
> +                                sched_credit2_pool_output,
>                                  cpupool))
>              return EXIT_FAILURE;
>      } else {
> diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
> index 85c1e0f..a420415 100644
> --- a/tools/libxl/xl_cmdtable.c
> +++ b/tools/libxl/xl_cmdtable.c
> @@ -265,6 +265,8 @@ struct cmd_spec cmd_table[] = {
>        "[-d <Domain> [-w[=WEIGHT]]] [-p CPUPOOL]",
>        "-d DOMAIN, --domain=DOMAIN     Domain to modify\n"
>        "-w WEIGHT, --weight=WEIGHT     Weight (int)\n"
> +      "-s         --schedparam        Query / modify scheduler parameters\n"
> +      "-r RLIMIT, --ratelimit_us=RLIMIT Set the scheduling rate limit, in microseconds\n"
>        "-p CPUPOOL, --cpupool=CPUPOOL  Restrict output to CPUPOOL"
>      },
>      { "sched-rtds",
> 


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

  reply	other threads:[~2016-09-28 15:46 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 17:17 [PATCH 00/24] sched: Credit1 and Credit2 improvements... and soft-affinity for Credit2! Dario Faggioli
2016-08-17 17:17 ` [PATCH 01/24] xen: credit1: small optimization in Credit1's tickling logic Dario Faggioli
2016-09-12 15:01   ` George Dunlap
2016-08-17 17:17 ` [PATCH 02/24] xen: credit1: fix mask to be used for tickling in Credit1 Dario Faggioli
2016-08-17 23:42   ` Dario Faggioli
2016-09-12 15:04     ` George Dunlap
2016-08-17 17:17 ` [PATCH 03/24] xen: credit1: return the 'time remaining to the limit' as next timeslice Dario Faggioli
2016-09-12 15:14   ` George Dunlap
2016-09-12 17:00     ` Dario Faggioli
2016-09-14  9:34       ` George Dunlap
2016-09-14 13:54         ` Dario Faggioli
2016-08-17 17:18 ` [PATCH 04/24] xen: credit2: properly schedule migration of a running vcpu Dario Faggioli
2016-09-12 17:11   ` George Dunlap
2016-08-17 17:18 ` [PATCH 05/24] xen: credit2: make tickling more deterministic Dario Faggioli
2016-08-31 17:10   ` anshul makkar
2016-09-05 13:47     ` Dario Faggioli
2016-09-07 12:25       ` anshul makkar
2016-09-13 11:13       ` George Dunlap
2016-09-29 15:24         ` Dario Faggioli
2016-09-13 11:28   ` George Dunlap
2016-09-30  2:22     ` Dario Faggioli
2016-08-17 17:18 ` [PATCH 06/24] xen: credit2: implement yield() Dario Faggioli
2016-09-13 13:33   ` George Dunlap
2016-09-29 16:05     ` Dario Faggioli
2016-09-20 13:25   ` George Dunlap
2016-09-20 13:37     ` George Dunlap
2016-08-17 17:18 ` [PATCH 07/24] xen: sched: don't rate limit context switches in case of yields Dario Faggioli
2016-09-20 13:32   ` George Dunlap
2016-09-29 16:46     ` Dario Faggioli
2016-08-17 17:18 ` [PATCH 08/24] xen: tracing: add trace records for schedule and rate-limiting Dario Faggioli
2016-08-18  0:57   ` Meng Xu
2016-08-18  9:41     ` Dario Faggioli
2016-09-20 13:50   ` George Dunlap
2016-08-17 17:18 ` [PATCH 09/24] xen/tools: tracing: improve tracing of context switches Dario Faggioli
2016-09-20 14:08   ` George Dunlap
2016-08-17 17:18 ` [PATCH 10/24] xen: tracing: improve Credit2's tickle_check and burn_credits records Dario Faggioli
2016-09-20 14:35   ` George Dunlap
2016-09-29 17:23     ` Dario Faggioli
2016-09-29 17:28       ` George Dunlap
2016-09-29 20:53         ` Dario Faggioli
2016-08-17 17:18 ` [PATCH 11/24] tools: tracing: handle more scheduling related events Dario Faggioli
2016-09-20 14:37   ` George Dunlap
2016-08-17 17:18 ` [PATCH 12/24] xen: libxc: allow to set the ratelimit value online Dario Faggioli
2016-09-20 14:43   ` George Dunlap
2016-09-20 14:45     ` Wei Liu
2016-09-28 15:44   ` George Dunlap
2016-08-17 17:19 ` [PATCH 13/24] libxc: improve error handling of xc Credit1 and Credit2 helpers Dario Faggioli
2016-09-20 15:10   ` Wei Liu
2016-08-17 17:19 ` [PATCH 14/24] libxl: allow to set the ratelimit value online for Credit2 Dario Faggioli
2016-08-22  9:21   ` Ian Jackson
2016-09-05 14:02     ` Dario Faggioli
2016-08-22  9:28   ` Ian Jackson
2016-09-28 15:37     ` George Dunlap
2016-09-30  1:03     ` Dario Faggioli
2016-09-28 15:39   ` George Dunlap
2016-08-17 17:19 ` [PATCH 15/24] xl: " Dario Faggioli
2016-09-28 15:46   ` George Dunlap [this message]
2016-08-17 17:19 ` [PATCH 16/24] xen: sched: factor affinity helpers out of sched_credit.c Dario Faggioli
2016-09-28 15:49   ` George Dunlap
2016-08-17 17:19 ` [PATCH 17/24] xen: credit2: soft-affinity awareness in runq_tickle() Dario Faggioli
2016-09-01 10:52   ` anshul makkar
2016-09-05 14:55     ` Dario Faggioli
2016-09-07 13:24       ` anshul makkar
2016-09-07 13:31         ` Dario Faggioli
2016-09-28 20:44   ` George Dunlap
2016-08-17 17:19 ` [PATCH 18/24] xen: credit2: soft-affinity awareness fallback_cpu() and cpu_pick() Dario Faggioli
2016-09-01 11:08   ` anshul makkar
2016-09-05 13:26     ` Dario Faggioli
2016-09-07 12:52       ` anshul makkar
2016-09-29 11:11   ` George Dunlap
2016-08-17 17:19 ` [PATCH 19/24] xen: credit2: soft-affinity awareness in load balancing Dario Faggioli
2016-09-02 11:46   ` anshul makkar
2016-09-05 12:49     ` Dario Faggioli
2016-08-17 17:19 ` [PATCH 20/24] xen: credit2: kick away vcpus not running within their soft-affinity Dario Faggioli
2016-08-17 17:20 ` [PATCH 21/24] xen: credit2: optimize runq_candidate() a little bit Dario Faggioli
2016-08-17 17:20 ` [PATCH 22/24] xen: credit2: "relax" CSCHED2_MAX_TIMER Dario Faggioli
2016-09-30 15:30   ` George Dunlap
2016-08-17 17:20 ` [PATCH 23/24] xen: credit2: optimize runq_tickle() a little bit Dario Faggioli
2016-09-02 12:38   ` anshul makkar
2016-09-05 12:52     ` Dario Faggioli
2016-08-17 17:20 ` [PATCH 24/24] xen: credit2: try to avoid tickling cpus subject to ratelimiting Dario Faggioli
2016-08-18  0:11 ` [PATCH 00/24] sched: Credit1 and Credit2 improvements... and soft-affinity for Credit2! Dario Faggioli
2016-08-18 11:49 ` Dario Faggioli
2016-08-18 11:53 ` Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56235acc-d4ed-15f7-e045-3b70c9b9f329@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.