[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/13] migration: Create x-multifd-threads parameter
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 04/13] migration: Create x-multifd-threads parameter |
Date: |
Fri, 21 Oct 2016 21:42:06 +0200 |
Indicates the number of threads that we would create. By default we
create 2 threads.
Signed-off-by: Juan Quintela <address@hidden>
---
hmp.c | 7 +++++++
include/migration/migration.h | 2 ++
migration/migration.c | 24 ++++++++++++++++++++++++
qapi-schema.json | 11 +++++++++--
4 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/hmp.c b/hmp.c
index 80f7f1f..54f9f03 100644
--- a/hmp.c
+++ b/hmp.c
@@ -318,6 +318,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict
*qdict)
monitor_printf(mon, " %s: %" PRId64 " milliseconds",
MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT],
params->downtime_limit);
+ monitor_printf(mon, " %s: %" PRId64,
+ MigrationParameter_lookup[MIGRATION_PARAMETER_X_MULTIFD_THREADS],
+ params->x_multifd_threads);
monitor_printf(mon, "\n");
}
@@ -1386,6 +1389,9 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
p.has_downtime_limit = true;
use_int_value = true;
break;
+ case MIGRATION_PARAMETER_X_MULTIFD_THREADS:
+ p.has_x_multifd_threads = true;
+ break;
}
if (use_int_value) {
@@ -1402,6 +1408,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
p.cpu_throttle_initial = valueint;
p.cpu_throttle_increment = valueint;
p.downtime_limit = valueint;
+ p.x_multifd_threads = valueint;
}
qmp_migrate_set_parameters(&p, &err);
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 5666068..709355e 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -240,6 +240,8 @@ bool migration_in_postcopy(MigrationState *);
bool migration_in_postcopy_after_devices(MigrationState *);
MigrationState *migrate_get_current(void);
+int migrate_multifd_threads(void);
+
void migrate_compress_threads_create(void);
void migrate_compress_threads_join(void);
void migrate_decompress_threads_create(void);
diff --git a/migration/migration.c b/migration/migration.c
index 5f7a570..217ccbc 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -62,6 +62,8 @@
/* Migration XBZRLE default cache size */
#define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024)
+#define DEFAULT_MIGRATE_MULTIFD_THREADS 2
+
static NotifierList migration_state_notifiers =
NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
@@ -94,6 +96,7 @@ MigrationState *migrate_get_current(void)
.cpu_throttle_increment = DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT,
.max_bandwidth = MAX_THROTTLE,
.downtime_limit = DEFAULT_MIGRATE_SET_DOWNTIME,
+ .x_multifd_threads = DEFAULT_MIGRATE_MULTIFD_THREADS,
},
};
@@ -567,6 +570,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error
**errp)
params->max_bandwidth = s->parameters.max_bandwidth;
params->has_downtime_limit = true;
params->downtime_limit = s->parameters.downtime_limit;
+ params->has_x_multifd_threads = true;
+ params->x_multifd_threads = s->parameters.x_multifd_threads;
return params;
}
@@ -813,6 +818,13 @@ void qmp_migrate_set_parameters(MigrationParameters
*params, Error **errp)
"an integer in the range of 0 to 2000000 milliseconds");
return;
}
+ if (params->has_x_multifd_threads &&
+ (params->x_multifd_threads < 1 || params->x_multifd_threads >
255)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "multifd_threads",
+ "is invalid, it should be in the range of 1 to 255");
+ return;
+ }
if (params->has_compress_level) {
s->parameters.compress_level = params->compress_level;
@@ -847,6 +859,9 @@ void qmp_migrate_set_parameters(MigrationParameters
*params, Error **errp)
if (params->has_downtime_limit) {
s->parameters.downtime_limit = params->downtime_limit;
}
+ if (params->has_x_multifd_threads) {
+ s->parameters.x_multifd_threads = params->x_multifd_threads;
+ }
}
@@ -1282,6 +1297,15 @@ bool migrate_multifd(void)
return s->enabled_capabilities[MIGRATION_CAPABILITY_X_MULTIFD];
}
+int migrate_multifd_threads(void)
+{
+ MigrationState *s;
+
+ s = migrate_get_current();
+
+ return s->parameters.x_multifd_threads;
+}
+
int migrate_use_xbzrle(void)
{
MigrationState *s;
diff --git a/qapi-schema.json b/qapi-schema.json
index bc96ee4..b5c9a06 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -665,13 +665,16 @@
# @downtime-limit: set maximum tolerated downtime for migration. maximum
# downtime in milliseconds (Since 2.8)
#
+# @x-multifd-threads: Number of threads used to migrate data in parallel
+# The default value is 1 (since 2.8)
+#
# Since: 2.4
##
{ 'enum': 'MigrationParameter',
'data': ['compress-level', 'compress-threads', 'decompress-threads',
'cpu-throttle-initial', 'cpu-throttle-increment',
'tls-creds', 'tls-hostname', 'max-bandwidth',
- 'downtime-limit'] }
+ 'downtime-limit', 'x-multifd-threads'] }
#
# @migrate-set-parameters
@@ -726,6 +729,9 @@
# @downtime-limit: set maximum tolerated downtime for migration. maximum
# downtime in milliseconds (Since 2.8)
#
+# @x-multifd-threads: Number of threads used to migrate data in parallel
+# The default value is 1 (since 2.8)
+#
# Since: 2.4
##
{ 'struct': 'MigrationParameters',
@@ -737,7 +743,8 @@
'*tls-creds': 'str',
'*tls-hostname': 'str',
'*max-bandwidth': 'int',
- '*downtime-limit': 'int'} }
+ '*downtime-limit': 'int',
+ '*x-multifd-threads': 'int'} }
##
# @query-migrate-parameters
#
--
2.7.4
- [Qemu-devel] [RFC 00/13] Multifd v2, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 02/13] migration: [HACK] Don't create decompression threads if not enabled, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 03/13] migration: Add multifd capability, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 04/13] migration: Create x-multifd-threads parameter,
Juan Quintela <=
- [Qemu-devel] [PATCH 01/13] migration: create Migration Incoming State at init time, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 05/13] migration: create multifd migration threads, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 06/13] migration: Start of multiple fd work, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 07/13] migration: create ram_multifd_page, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 09/13] migration: Send the fd number which we are going to use for this page, Juan Quintela, 2016/10/21