[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/13] migration: Create x-multifd-threads parameter
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 05/13] migration: Create x-multifd-threads parameter |
Date: |
Wed, 20 Apr 2016 16:44:33 +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 | 8 ++++++++
include/migration/migration.h | 2 ++
migration/migration.c | 30 +++++++++++++++++++++++++++++-
qapi-schema.json | 19 ++++++++++++++++---
4 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/hmp.c b/hmp.c
index d510236..2a40f1f 100644
--- a/hmp.c
+++ b/hmp.c
@@ -286,6 +286,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict
*qdict)
monitor_printf(mon, " %s: %" PRId64,
MigrationParameter_lookup[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT],
params->x_cpu_throttle_increment);
+ monitor_printf(mon, " %s: %" PRId64,
+ MigrationParameter_lookup[MIGRATION_PARAMETER_X_MULTIFD_THREADS],
+ params->x_multifd_threads);
monitor_printf(mon, "\n");
}
@@ -1242,6 +1245,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
bool has_decompress_threads = false;
bool has_x_cpu_throttle_initial = false;
bool has_x_cpu_throttle_increment = false;
+ bool has_x_multifd_threads = false;
int i;
for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
@@ -1262,12 +1266,16 @@ void hmp_migrate_set_parameter(Monitor *mon, const
QDict *qdict)
case MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT:
has_x_cpu_throttle_increment = true;
break;
+ case MIGRATION_PARAMETER_X_MULTIFD_THREADS:
+ has_x_multifd_threads = true;
+ break;
}
qmp_migrate_set_parameters(has_compress_level, value,
has_compress_threads, value,
has_decompress_threads, value,
has_x_cpu_throttle_initial, value,
has_x_cpu_throttle_increment, value,
+ has_x_multifd_threads, value,
&err);
break;
}
diff --git a/include/migration/migration.h b/include/migration/migration.h
index a626b7d..19d535d 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -219,6 +219,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 92e6dc4..29e43ff 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -56,6 +56,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);
@@ -91,6 +93,8 @@ MigrationState *migrate_get_current(void)
DEFAULT_MIGRATE_X_CPU_THROTTLE_INITIAL,
.parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT] =
DEFAULT_MIGRATE_X_CPU_THROTTLE_INCREMENT,
+ .parameters[MIGRATION_PARAMETER_X_MULTIFD_THREADS] =
+ DEFAULT_MIGRATE_MULTIFD_THREADS,
};
if (!once) {
@@ -521,6 +525,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error
**errp)
s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL];
params->x_cpu_throttle_increment =
s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT];
+ params->x_multifd_threads =
+ s->parameters[MIGRATION_PARAMETER_X_MULTIFD_THREADS];
return params;
}
@@ -717,7 +723,10 @@ void qmp_migrate_set_parameters(bool has_compress_level,
bool has_x_cpu_throttle_initial,
int64_t x_cpu_throttle_initial,
bool has_x_cpu_throttle_increment,
- int64_t x_cpu_throttle_increment, Error **errp)
+ int64_t x_cpu_throttle_increment,
+ bool has_multifd_threads,
+ int64_t multifd_threads,
+ Error **errp)
{
MigrationState *s = migrate_get_current();
@@ -753,6 +762,13 @@ void qmp_migrate_set_parameters(bool has_compress_level,
"an integer in the range of 1 to 99");
}
+ if (has_multifd_threads &&
+ (multifd_threads < 1 || 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 (has_compress_level) {
s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL] = compress_level;
}
@@ -772,6 +788,9 @@ void qmp_migrate_set_parameters(bool has_compress_level,
s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT] =
x_cpu_throttle_increment;
}
+ if (has_multifd_threads) {
+ s->parameters[MIGRATION_PARAMETER_X_MULTIFD_THREADS] = multifd_threads;
+ }
}
void qmp_migrate_start_postcopy(Error **errp)
@@ -1196,6 +1215,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[MIGRATION_PARAMETER_X_MULTIFD_THREADS];
+}
+
int migrate_use_xbzrle(void)
{
MigrationState *s;
diff --git a/qapi-schema.json b/qapi-schema.json
index 9fdf902..6ff9ac6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -613,11 +613,16 @@
# @x-cpu-throttle-increment: throttle percentage increase each time
# auto-converge detects that migration is not making
# progress. The default value is 10. (Since 2.5)
+#
+# @x-multifd-threads: Number of threads used to migrate data in parallel
+# The default value is 1 (since 2.6)
+#
# Since: 2.4
##
{ 'enum': 'MigrationParameter',
'data': ['compress-level', 'compress-threads', 'decompress-threads',
- 'x-cpu-throttle-initial', 'x-cpu-throttle-increment'] }
+ 'x-cpu-throttle-initial', 'x-cpu-throttle-increment',
+ 'x-multifd-threads'] }
#
# @migrate-set-parameters
@@ -637,6 +642,10 @@
# @x-cpu-throttle-increment: throttle percentage increase each time
# auto-converge detects that migration is not making
# progress. The default value is 10. (Since 2.5)
+#
+# @x-multifd-threads: Number of threads used to migrate data in parallel
+# The default value is 1 (since 2.6)
+#
# Since: 2.4
##
{ 'command': 'migrate-set-parameters',
@@ -644,7 +653,8 @@
'*compress-threads': 'int',
'*decompress-threads': 'int',
'*x-cpu-throttle-initial': 'int',
- '*x-cpu-throttle-increment': 'int'} }
+ '*x-cpu-throttle-increment': 'int',
+ '*x-multifd-threads': 'int'} }
#
# @MigrationParameters
@@ -663,6 +673,8 @@
# auto-converge detects that migration is not making
# progress. The default value is 10. (Since 2.5)
#
+# @x-multifd-threads: Number of threads used to migrate data in parallel
+# The default value is 1 (since 2.6)
# Since: 2.4
##
{ 'struct': 'MigrationParameters',
@@ -670,7 +682,8 @@
'compress-threads': 'int',
'decompress-threads': 'int',
'x-cpu-throttle-initial': 'int',
- 'x-cpu-throttle-increment': 'int'} }
+ 'x-cpu-throttle-increment': 'int',
+ 'x-multifd-threads': 'int'} }
##
# @query-migrate-parameters
#
--
2.5.5
- [Qemu-devel] [RFC 00/13] Multiple fd migration support, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 01/13] migration: create Migration Incoming State at init time, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 03/13] migration: [HACK] Don't create decompression threads if not enabled, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 02/13] migration: Pass TCP args in an struct, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 09/13] migration: Create thread infrastructure for multifd send side, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 06/13] migration: create multifd migration threads, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 07/13] migration: Start of multiple fd work, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 04/13] migration: Add multifd capability, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 05/13] migration: Create x-multifd-threads parameter,
Juan Quintela <=
- [Qemu-devel] [PATCH 08/13] migration: create ram_multifd_page, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 10/13] migration: Send the fd number which we are going to use for this page, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 12/13] migration: Test new fd infrastructure, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 13/13] migration: [HACK]Transfer pages over new channels, Juan Quintela, 2016/04/20
- [Qemu-devel] [PATCH 11/13] migration: Create thread infrastructure for multifd recv side, Juan Quintela, 2016/04/20
- Re: [Qemu-devel] [RFC 00/13] Multiple fd migration support, Michael S. Tsirkin, 2016/04/20
- Re: [Qemu-devel] [RFC 00/13] Multiple fd migration support, Dr. David Alan Gilbert, 2016/04/22