From patchwork Wed Apr 20 14:44:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 8890701 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B24DC9F39A for ; Wed, 20 Apr 2016 14:49:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE89A20260 for ; Wed, 20 Apr 2016 14:49:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E119820165 for ; Wed, 20 Apr 2016 14:49:35 +0000 (UTC) Received: from localhost ([::1]:50586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1astRf-0008HA-AQ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Apr 2016 10:49:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1astNA-0006WX-Uq for qemu-devel@nongnu.org; Wed, 20 Apr 2016 10:45:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1astN6-0002ex-Ie for qemu-devel@nongnu.org; Wed, 20 Apr 2016 10:44:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1astN6-0002en-A9 for qemu-devel@nongnu.org; Wed, 20 Apr 2016 10:44:52 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D26DFC05E16F for ; Wed, 20 Apr 2016 14:44:51 +0000 (UTC) Received: from emacs.mitica (ovpn-116-52.ams2.redhat.com [10.36.116.52]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3KEigqr020907; Wed, 20 Apr 2016 10:44:50 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 20 Apr 2016 16:44:33 +0200 Message-Id: <1461163481-11439-6-git-send-email-quintela@redhat.com> In-Reply-To: <1461163481-11439-1-git-send-email-quintela@redhat.com> References: <1461163481-11439-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 05/13] migration: Create x-multifd-threads parameter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amit.shah@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Indicates the number of threads that we would create. By default we create 2 threads. Signed-off-by: Juan Quintela --- 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 #