All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH 04/13] migration: Create x-multifd-threads parameter
Date: Fri, 21 Oct 2016 21:42:06 +0200	[thread overview]
Message-ID: <1477078935-7182-5-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1477078935-7182-1-git-send-email-quintela@redhat.com>

Indicates the number of threads that we would create.  By default we
create 2 threads.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

  parent reply	other threads:[~2016-10-21 19:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 19:42 [Qemu-devel] [RFC 00/13] Multifd v2 Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 01/13] migration: create Migration Incoming State at init time Juan Quintela
2016-10-26 18:05   ` Dr. David Alan Gilbert
2016-10-21 19:42 ` [Qemu-devel] [PATCH 02/13] migration: [HACK] Don't create decompression threads if not enabled Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 03/13] migration: Add multifd capability Juan Quintela
2016-10-26 17:57   ` Dr. David Alan Gilbert
2016-10-21 19:42 ` Juan Quintela [this message]
2016-10-26 18:33   ` [Qemu-devel] [PATCH 04/13] migration: Create x-multifd-threads parameter Dr. David Alan Gilbert
2016-10-26 21:16   ` Eric Blake
2016-10-21 19:42 ` [Qemu-devel] [PATCH 05/13] migration: create multifd migration threads Juan Quintela
2016-10-26 18:43   ` Dr. David Alan Gilbert
2017-01-23 17:15     ` Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 06/13] migration: Start of multiple fd work Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 07/13] migration: create ram_multifd_page Juan Quintela
2016-10-26 18:50   ` Dr. David Alan Gilbert
2017-01-23 17:13     ` Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 08/13] migration: Create thread infrastructure for multifd send side Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 09/13] migration: Send the fd number which we are going to use for this page Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 10/13] migration: Create thread infrastructure for multifd recv side Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 11/13] migration: Test new fd infrastructure Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 12/13] migration: [HACK]Transfer pages over new channels Juan Quintela
2016-10-26 19:08   ` Dr. David Alan Gilbert
2016-10-21 19:42 ` [Qemu-devel] [PATCH 13/13] migration: flush receive queue Juan Quintela
2016-10-26 19:10   ` Dr. David Alan Gilbert
2016-10-21 20:26 ` [Qemu-devel] [RFC 00/13] Multifd v2 no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477078935-7182-5-git-send-email-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.