From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Li Qiang <liq3ea@gmail.com>
Cc: pbonzini@redhat.com, crosthwaite.peter@gmail.com,
rth@twiddle.net, quintela@redhat.com, eblake@redhat.com,
armbru@redhat.com, liqiang02@corp.netease.com,
hzliuyingdong@corp.netease.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] migration: Add qmp command for migrate_set_max_cpu_throttle
Date: Tue, 31 Jul 2018 12:29:06 +0100 [thread overview]
Message-ID: <20180731112906.GG2476@work-vm> (raw)
In-Reply-To: <1533026124-6740-3-git-send-email-liq3ea@gmail.com>
* Li Qiang (liq3ea@gmail.com) wrote:
> The default max cpu throttle is 99, this is too big that may
> influence the guest loads. Add a qmp to config it can make it
> more flexible.
>
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
This should be done as a migration parameter rather than a new command.
For example, follow the cpu-throttle-increment parameter; and this
should work just like it.
Dave
> ---
> cpus.c | 5 +++++
> include/qom/cpu.h | 8 ++++++++
> migration/migration.c | 10 ++++++++++
> qapi/migration.json | 13 +++++++++++++
> 4 files changed, 36 insertions(+)
>
> diff --git a/cpus.c b/cpus.c
> index 6569c73d24..0505477086 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -765,6 +765,11 @@ void cpu_throttle_set(int new_throttle_pct)
> CPU_THROTTLE_TIMESLICE_NS);
> }
>
> +void set_cpu_max_throttle(int64_t max_pct)
> +{
> + throttle_percentage_max = max_pct;
> +}
> +
> void cpu_throttle_stop(void)
> {
> atomic_set(&throttle_percentage, 0);
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index bd796579ee..4328d2e8ad 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -816,6 +816,14 @@ CPUState *cpu_by_arch_id(int64_t id);
> void cpu_throttle_set(int new_throttle_pct);
>
> /**
> + * set_cpu_max_throttle:
> + * @max_pct: the max percent of sleep time. Valid range is 1 to 99.
> + *
> + * Set the max throttle percentage.
> + */
> +void set_cpu_max_throttle(int64_t max_pct);
> +
> +/**
> * cpu_throttle_stop:
> *
> * Stops the vcpu throttling started by cpu_throttle_set.
> diff --git a/migration/migration.c b/migration/migration.c
> index b7d9854bda..9c7a6f7477 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1774,6 +1774,16 @@ void qmp_migrate_set_speed(int64_t value, Error **errp)
> qmp_migrate_set_parameters(&p, errp);
> }
>
> +void qmp_migrate_set_max_cpu_throttle(int64_t value, Error **errp)
> +{
> + if (value > 99 || value < 1) {
> + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, " max cpu throttle",
> + "not in 1 between 99");
> + return;
> + }
> + set_cpu_max_throttle(value);
> +}
> +
> void qmp_migrate_set_downtime(double value, Error **errp)
> {
> if (value < 0 || value > MAX_MIGRATE_DOWNTIME_SECONDS) {
> diff --git a/qapi/migration.json b/qapi/migration.json
> index 186e8a7303..2ef3ddfe43 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -997,6 +997,19 @@
> { 'command': 'migrate_set_speed', 'data': {'value': 'int'} }
>
> ##
> +# @migrate_set_max_cpu_throttle:
> +#
> +# Set maximum cpu throttle for migration.
> +#
> +# @value: maximum cpu throttle.
> +#
> +# Returns: nothing on success
> +#
> +# Since: 2.12
> +##
> +{ 'command': 'migrate_set_max_cpu_throttle', 'data': {'value': 'int'} }
> +
> +##
> # @migrate-set-cache-size:
> #
> # Set cache size to be used by XBZRLE migration
> --
> 2.11.0
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2018-07-31 11:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 8:35 [Qemu-devel] [PATCH 0/3] Add a new migrate_set_max_cpu_throttle qmp command Li Qiang
2018-07-31 8:35 ` [Qemu-devel] [PATCH 1/3] migrate: replace the cpu throttle percentage max with a variable Li Qiang
2018-07-31 8:35 ` [Qemu-devel] [PATCH 2/3] migration: Add qmp command for migrate_set_max_cpu_throttle Li Qiang
2018-07-31 11:29 ` Dr. David Alan Gilbert [this message]
2018-07-31 12:22 ` Eric Blake
2018-07-31 14:48 ` Juan Quintela
2018-07-31 15:38 ` Dr. David Alan Gilbert
2018-07-31 15:50 ` Daniel P. Berrangé
2018-08-01 1:14 ` Li Qiang
2018-08-01 8:01 ` Juan Quintela
2018-07-31 8:35 ` [Qemu-devel] [PATCH 3/3] hmp: add hmp " Li Qiang
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=20180731112906.GG2476@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=crosthwaite.peter@gmail.com \
--cc=eblake@redhat.com \
--cc=hzliuyingdong@corp.netease.com \
--cc=liq3ea@gmail.com \
--cc=liqiang02@corp.netease.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).