From: Chao Fan <fanc.fnst@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: quintela@redhat.com, amit.shah@redhat.com,
jjherne@linux.vnet.ibm.com, caoj.fnst@cn.fujitsu.com,
douly.fnst@cn.fujitsu.com, Chao Fan <fanc.fnst@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH] migration: check the value of cpu throttle in migrate_set_parameters
Date: Wed, 23 Nov 2016 18:16:34 +0800 [thread overview]
Message-ID: <1479896194-32672-1-git-send-email-fanc.fnst@cn.fujitsu.com> (raw)
When cpu thrpttle is turned on in migration, the first throttle value
is cpu_throttle_initial. And then, when more throttle is needed,
the next throttle value will be cpu_throttle_increment, so maybe
it should be smaller than the percentage of CPU frequency after
first throttle. Otherwise, cpu_throttle_increment will be useless,
as the the percentage of CPU frequency will be 1, the least value.
Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
---
migration/migration.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/migration/migration.c b/migration/migration.c
index f498ab8..a6d0334 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -832,6 +832,15 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
"an integer in the range of 1 to 99");
return;
}
+ if (params->has_cpu_throttle_initial &&
+ (100 - params->cpu_throttle_initial <=
+ s->parameters.cpu_throttle_increment)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE " %ld",
+ "cpu_throttle_initial",
+ "an integer smaller than",
+ 100 - s->parameters.cpu_throttle_increment);
+ return;
+ }
if (params->has_cpu_throttle_increment &&
(params->cpu_throttle_increment < 1 ||
params->cpu_throttle_increment > 99)) {
@@ -840,6 +849,15 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
"an integer in the range of 1 to 99");
return;
}
+ if (params->has_cpu_throttle_increment &&
+ (params->cpu_throttle_increment >=
+ 100 - s->parameters.cpu_throttle_initial)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE " %ld",
+ "cpu_throttle_increment",
+ "an integer smaller than",
+ 100 - s->parameters.cpu_throttle_initial);
+ return;
+ }
if (params->has_max_bandwidth &&
(params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) {
error_setg(errp, "Parameter 'max_bandwidth' expects an integer in the"
--
2.7.4
next reply other threads:[~2016-11-23 10:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 10:16 Chao Fan [this message]
2016-11-23 10:43 ` [Qemu-devel] [PATCH] migration: check the value of cpu throttle in migrate_set_parameters no-reply
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=1479896194-32672-1-git-send-email-fanc.fnst@cn.fujitsu.com \
--to=fanc.fnst@cn.fujitsu.com \
--cc=amit.shah@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=douly.fnst@cn.fujitsu.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 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).