qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] migration: check the value of cpu throttle in migra


From: Chao Fan
Subject: [Qemu-devel] [PATCH] migration: check the value of cpu throttle in migrate_set_parameters
Date: Wed, 23 Nov 2016 18:16:34 +0800

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 <address@hidden>
---
 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]