All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Jason J. Herne" <jjherne@linux.vnet.ibm.com>
Cc: quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com,
	borntraeger@de.ibm.com, amit.shah@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v3 2/5] migration: Parameters for auto-converge cpu throttling
Date: Fri, 26 Jun 2015 18:20:14 +0100	[thread overview]
Message-ID: <20150626172013.GI2186@work-vm> (raw)
In-Reply-To: <1435254377-13322-3-git-send-email-jjherne@linux.vnet.ibm.com>

* Jason J. Herne (jjherne@linux.vnet.ibm.com) wrote:
> Add migration parameters to allow the user to adjust the parameters
> that control cpu throttling when auto-converge is in effect. The added
> parameters are as follows:
> 
> x-cpu-throttle-initial : Initial percantage of time guest cpus are throttled
> when migration auto-converge is activated.
> 
> x-cpu-throttle-increment: throttle percantage increase each time
> auto-converge detects that migration is not making progress.
> 
> Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>

Other than your spelling of 'percantage':

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hmp.c                 | 16 ++++++++++++++++
>  migration/migration.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
>  qapi-schema.json      | 33 ++++++++++++++++++++++++++++++---
>  3 files changed, 91 insertions(+), 4 deletions(-)
> 
> diff --git a/hmp.c b/hmp.c
> index e17852d..eb65998 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -269,6 +269,12 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
>          monitor_printf(mon, " %s: %" PRId64,
>              MigrationParameter_lookup[MIGRATION_PARAMETER_DECOMPRESS_THREADS],
>              params->decompress_threads);
> +        monitor_printf(mon, " %s: %" PRId64,
> +            MigrationParameter_lookup[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL],
> +            params->x_cpu_throttle_initial);
> +        monitor_printf(mon, " %s: %" PRId64,
> +            MigrationParameter_lookup[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT],
> +            params->x_cpu_throttle_increment);
>          monitor_printf(mon, "\n");
>      }
>  
> @@ -1216,6 +1222,8 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
>      bool has_compress_level = false;
>      bool has_compress_threads = false;
>      bool has_decompress_threads = false;
> +    bool has_x_cpu_throttle_initial = false;
> +    bool has_x_cpu_throttle_increment = false;
>      int i;
>  
>      for (i = 0; i < MIGRATION_PARAMETER_MAX; i++) {
> @@ -1230,10 +1238,18 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
>              case MIGRATION_PARAMETER_DECOMPRESS_THREADS:
>                  has_decompress_threads = true;
>                  break;
> +            case MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL:
> +                has_x_cpu_throttle_initial = true;
> +                break;
> +            case MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT:
> +                has_x_cpu_throttle_increment = true;
> +                break;
>              }
>              qmp_migrate_set_parameters(has_compress_level, value,
>                                         has_compress_threads, value,
>                                         has_decompress_threads, value,
> +                                       has_x_cpu_throttle_initial, value,
> +                                       has_x_cpu_throttle_increment, value,
>                                         &err);
>              break;
>          }
> diff --git a/migration/migration.c b/migration/migration.c
> index 732d229..05790e9 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -40,6 +40,9 @@
>  #define DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT 2
>  /*0: means nocompress, 1: best speed, ... 9: best compress ratio */
>  #define DEFAULT_MIGRATE_COMPRESS_LEVEL 1
> +/* Define default autoconverge cpu throttle migration parameters */
> +#define DEFAULT_MIGRATE_X_CPU_THROTTLE_INITIAL 20
> +#define DEFAULT_MIGRATE_X_CPU_THROTTLE_INCREMENT 10
>  
>  /* Migration XBZRLE default cache size */
>  #define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024)
> @@ -66,6 +69,10 @@ MigrationState *migrate_get_current(void)
>                  DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT,
>          .parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS] =
>                  DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT,
> +        .parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL] =
> +                DEFAULT_MIGRATE_X_CPU_THROTTLE_INITIAL,
> +        .parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT] =
> +                DEFAULT_MIGRATE_X_CPU_THROTTLE_INCREMENT,
>      };
>  
>      return &current_migration;
> @@ -199,6 +206,10 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
>              s->parameters[MIGRATION_PARAMETER_COMPRESS_THREADS];
>      params->decompress_threads =
>              s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS];
> +    params->x_cpu_throttle_initial =
> +            s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL];
> +    params->x_cpu_throttle_increment =
> +            s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT];
>  
>      return params;
>  }
> @@ -321,7 +332,11 @@ void qmp_migrate_set_parameters(bool has_compress_level,
>                                  bool has_compress_threads,
>                                  int64_t compress_threads,
>                                  bool has_decompress_threads,
> -                                int64_t decompress_threads, Error **errp)
> +                                int64_t decompress_threads,
> +                                bool has_x_cpu_throttle_initial,
> +                                int64_t x_cpu_throttle_initial,
> +                                bool has_x_cpu_throttle_increment,
> +                                int64_t x_cpu_throttle_increment, Error **errp)
>  {
>      MigrationState *s = migrate_get_current();
>  
> @@ -344,6 +359,18 @@ void qmp_migrate_set_parameters(bool has_compress_level,
>                    "is invalid, it should be in the range of 1 to 255");
>          return;
>      }
> +    if (has_x_cpu_throttle_initial &&
> +            (x_cpu_throttle_initial < 1 || x_cpu_throttle_initial > 99)) {
> +        error_set(errp, QERR_INVALID_PARAMETER_VALUE,
> +                  "x_cpu_throttle_initial",
> +                  "an integer in the range of 1 to 99");
> +    }
> +    if (has_x_cpu_throttle_increment &&
> +            (x_cpu_throttle_increment < 1 || x_cpu_throttle_increment > 99)) {
> +        error_set(errp, QERR_INVALID_PARAMETER_VALUE,
> +                  "x_cpu_throttle_increment",
> +                  "an integer in the range of 1 to 99");
> +    }
>  
>      if (has_compress_level) {
>          s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL] = compress_level;
> @@ -355,6 +382,15 @@ void qmp_migrate_set_parameters(bool has_compress_level,
>          s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS] =
>                                                      decompress_threads;
>      }
> +    if (has_x_cpu_throttle_initial) {
> +        s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL] =
> +                                                    x_cpu_throttle_initial;
> +    }
> +
> +    if (has_x_cpu_throttle_increment) {
> +        s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT] =
> +                                                    x_cpu_throttle_increment;
> +    }
>  }
>  
>  /* shared migration helpers */
> @@ -470,6 +506,10 @@ static MigrationState *migrate_init(const MigrationParams *params)
>              s->parameters[MIGRATION_PARAMETER_COMPRESS_THREADS];
>      int decompress_thread_count =
>              s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS];
> +    int x_cpu_throttle_initial =
> +            s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL];
> +    int x_cpu_throttle_increment =
> +            s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT];
>  
>      memcpy(enabled_capabilities, s->enabled_capabilities,
>             sizeof(enabled_capabilities));
> @@ -485,6 +525,10 @@ static MigrationState *migrate_init(const MigrationParams *params)
>                 compress_thread_count;
>      s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS] =
>                 decompress_thread_count;
> +    s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL] =
> +                x_cpu_throttle_initial;
> +    s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT] =
> +                x_cpu_throttle_increment;
>      s->bandwidth_limit = bandwidth_limit;
>      s->state = MIGRATION_STATUS_SETUP;
>      trace_migrate_set_state(MIGRATION_STATUS_SETUP);
> diff --git a/qapi-schema.json b/qapi-schema.json
> index f97ffa1..7dd324e 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -587,10 +587,18 @@
>  #          compression, so set the decompress-threads to the number about 1/4
>  #          of compress-threads is adequate.
>  #
> +# @x-cpu-throttle-initial: Initial percantage of time guest cpus are throttled
> +#                          when migration auto-converge is activated.
> +#                          (Since 2.4)
> +#
> +# @x-cpu-throttle-increment: throttle percantage increase each time
> +#                            auto-converge detects that migration is not making
> +#                            progress. (Since 2.4)
>  # Since: 2.4
>  ##
>  { 'enum': 'MigrationParameter',
> -  'data': ['compress-level', 'compress-threads', 'decompress-threads'] }
> +  'data': ['compress-level', 'compress-threads', 'decompress-threads',
> +           'x-cpu-throttle-initial', 'x-cpu-throttle-increment'] }
>  
>  #
>  # @migrate-set-parameters
> @@ -603,12 +611,22 @@
>  #
>  # @decompress-threads: decompression thread count
>  #
> +# @x-cpu-throttle-initial: Initial percantage of time guest cpus are throttled
> +#                          when migration auto-converge is activated.
> +#                          (Since 2.4)
> +#
> +# @x-cpu-throttle-increment: throttle percantage increase each time
> +#                            auto-converge detects that migration is not making
> +#                            progress. (Since 2.4)
> +#
>  # Since: 2.4
>  ##
>  { 'command': 'migrate-set-parameters',
>    'data': { '*compress-level': 'int',
>              '*compress-threads': 'int',
> -            '*decompress-threads': 'int'} }
> +            '*decompress-threads': 'int',
> +            '*x-cpu-throttle-initial': 'int',
> +            '*x-cpu-throttle-increment': 'int'} }
>  
>  #
>  # @MigrationParameters
> @@ -618,13 +636,22 @@
>  # @compress-threads: compression thread count
>  #
>  # @decompress-threads: decompression thread count
> +# @x-cpu-throttle-initial: Initial percantage of time guest cpus are throttled
> +#                          when migration auto-converge is activated.
> +#                          (Since 2.4)
> +#
> +# @x-cpu-throttle-increment: throttle percantage increase each time
> +#                            auto-converge detects that migration is not making
> +#                            progress. (Since 2.4)
>  #
>  # Since: 2.4
>  ##
>  { 'struct': 'MigrationParameters',
>    'data': { 'compress-level': 'int',
>              'compress-threads': 'int',
> -            'decompress-threads': 'int'} }
> +            'decompress-threads': 'int',
> +            'x-cpu-throttle-initial': 'int',
> +            'x-cpu-throttle-increment': 'int'} }
>  ##
>  # @query-migrate-parameters
>  #
> -- 
> 1.9.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2015-06-26 17:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 17:46 [Qemu-devel] [PATCH v3 0/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 1/5] cpu: Provide vcpu throttling interface Jason J. Herne
2015-06-26 18:07   ` Dr. David Alan Gilbert
2015-06-26 19:02     ` Jason J. Herne
2015-06-29  9:27       ` Dr. David Alan Gilbert
2015-06-29 14:42       ` Jason J. Herne
2015-07-01 14:03     ` Paolo Bonzini
2015-07-02 14:25       ` Jason J. Herne
2015-07-02 14:27         ` Paolo Bonzini
2015-07-02 16:33       ` Jason J. Herne
2015-07-02 16:34         ` Paolo Bonzini
2015-07-01 13:57   ` Paolo Bonzini
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 2/5] migration: Parameters for auto-converge cpu throttling Jason J. Herne
2015-06-26 17:20   ` Dr. David Alan Gilbert [this message]
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 3/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-06-26 17:54   ` Dr. David Alan Gilbert
2015-06-26 18:42     ` Jason J. Herne
2015-06-26 19:07     ` Jason J. Herne
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 4/5] qmp/hmp: Add throttle ratio to query-migrate and info migrate Jason J. Herne
2015-06-26 18:32   ` Dr. David Alan Gilbert
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 5/5] migration: Disambiguate MAX_THROTTLE Jason J. Herne
2015-06-26 18:36   ` Dr. David Alan Gilbert

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=20150626172013.GI2186@work-vm \
    --to=dgilbert@redhat.com \
    --cc=afaerber@suse.de \
    --cc=amit.shah@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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.