All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] migration: check the value of cpu throttle in migrate_set_parameters
@ 2016-11-23 11:47 Chao Fan
  0 siblings, 0 replies; only message in thread
From: Chao Fan @ 2016-11-23 11:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: quintela, amit.shah, jjherne, caoj.fnst, douly.fnst, Chao Fan

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>

---
v2: fix the wrong variable type
---
 migration/migration.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index f498ab8..51fd20d 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 "%" PRId64 "",
+                   "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 "%" PRId64 "",
+                   "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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-23 11:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23 11:47 [Qemu-devel] [PATCH v2] migration: check the value of cpu throttle in migrate_set_parameters Chao Fan

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.