All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: amit.shah@redhat.com, quintela@redhat.com
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com, wency@cn.fujitsu.com,
	lizhijian@cn.fujitsu.com, zhangchen.fnst@cn.fujitsu.com,
	xiecl.fnst@cn.fujitsu.com,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH COLO-Frame (Base) v20 10/17] COLO: Add checkpoint-delay parameter for migrate-set-parameters
Date: Thu, 29 Sep 2016 16:46:30 +0800	[thread overview]
Message-ID: <1475138797-9908-11-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
In-Reply-To: <1475138797-9908-1-git-send-email-zhang.zhanghailiang@huawei.com>

Add checkpoint-delay parameter for migrate-set-parameters, so that
we can control the checkpoint frequency when COLO is in periodic mode.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
v12:
- Change checkpoint-delay to x-checkpoint-delay (Dave's suggestion)
- Add Reviewed-by tag
v11:
- Move this patch ahead of the patch where uses 'checkpoint_delay'
 (Dave's suggestion)
v10:
- Fix related qmp command
---
 docs/qmp-commands.txt |  1 +
 hmp.c                 |  7 +++++++
 migration/migration.c | 18 ++++++++++++++++++
 qapi-schema.json      | 17 ++++++++++++++---
 4 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/docs/qmp-commands.txt b/docs/qmp-commands.txt
index 5c88fed..72551c6 100644
--- a/docs/qmp-commands.txt
+++ b/docs/qmp-commands.txt
@@ -2913,6 +2913,7 @@ Set migration parameters
                           throttled for auto-converge (json-int)
 - "cpu-throttle-increment": set throttle increasing percentage for
                             auto-converge (json-int)
+- "x-checkpoint-delay": set the delay time for periodic checkpoint (json-int)
 
 Arguments:
 
diff --git a/hmp.c b/hmp.c
index 336e7bf..4faffac 100644
--- a/hmp.c
+++ b/hmp.c
@@ -304,6 +304,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, " %s: '%s'",
             MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
             params->tls_hostname ? : "");
+        monitor_printf(mon, " %s: %" PRId64,
+            MigrationParameter_lookup[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY],
+            params->x_checkpoint_delay);
         monitor_printf(mon, "\n");
     }
 
@@ -1263,6 +1266,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
     bool has_tls_creds = false;
     bool has_tls_hostname = false;
     bool use_int_value = false;
+    bool has_x_checkpoint_delay = false;
     int i;
 
     for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
@@ -1286,6 +1290,8 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
                 break;
             case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT:
                 has_cpu_throttle_increment = true;
+            case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY:
+                has_x_checkpoint_delay = true;
                 break;
             case MIGRATION_PARAMETER_TLS_CREDS:
                 has_tls_creds = true;
@@ -1310,6 +1316,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
                                        has_cpu_throttle_increment, valueint,
                                        has_tls_creds, valuestr,
                                        has_tls_hostname, valuestr,
+                                       has_x_checkpoint_delay, valueint,
                                        &err);
             break;
         }
diff --git a/migration/migration.c b/migration/migration.c
index 34b34b8..db618db 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -59,6 +59,11 @@
 /* Migration XBZRLE default cache size */
 #define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024)
 
+/* The delay time (in ms) between two COLO checkpoints
+ * Note: Please change this default value to 10000 when we support hybrid mode.
+ */
+#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY 200
+
 static NotifierList migration_state_notifiers =
     NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
 
@@ -90,6 +95,7 @@ MigrationState *migrate_get_current(void)
             .decompress_threads = DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT,
             .cpu_throttle_initial = DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL,
             .cpu_throttle_increment = DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT,
+            .x_checkpoint_delay = DEFAULT_MIGRATE_X_CHECKPOINT_DELAY,
         },
     };
 
@@ -582,6 +588,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
     params->cpu_throttle_increment = s->parameters.cpu_throttle_increment;
     params->tls_creds = g_strdup(s->parameters.tls_creds);
     params->tls_hostname = g_strdup(s->parameters.tls_hostname);
+    params->x_checkpoint_delay = s->parameters.x_checkpoint_delay;
 
     return params;
 }
@@ -801,6 +808,8 @@ void qmp_migrate_set_parameters(bool has_compress_level,
                                 const char *tls_creds,
                                 bool has_tls_hostname,
                                 const char *tls_hostname,
+                                bool has_x_checkpoint_delay,
+                                int64_t x_checkpoint_delay,
                                 Error **errp)
 {
     MigrationState *s = migrate_get_current();
@@ -836,6 +845,11 @@ void qmp_migrate_set_parameters(bool has_compress_level,
                    "cpu_throttle_increment",
                    "an integer in the range of 1 to 99");
     }
+    if (has_x_checkpoint_delay && (x_checkpoint_delay < 0)) {
+        error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+                    "x_checkpoint_delay",
+                    "is invalid, it should be positive");
+    }
 
     if (has_compress_level) {
         s->parameters.compress_level = compress_level;
@@ -860,6 +874,10 @@ void qmp_migrate_set_parameters(bool has_compress_level,
         g_free(s->parameters.tls_hostname);
         s->parameters.tls_hostname = g_strdup(tls_hostname);
     }
+
+    if (has_x_checkpoint_delay) {
+        s->parameters.x_checkpoint_delay = x_checkpoint_delay;
+    }
 }
 
 
diff --git a/qapi-schema.json b/qapi-schema.json
index ae241cb..8b25580 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -667,12 +667,16 @@
 #                hostname must be provided so that the server's x509
 #                certificate identity can be validated. (Since 2.7)
 #
+# @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in
+#          periodic mode. (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'] }
+           'tls-creds', 'tls-hostname',
+           'x-checkpoint-delay' ] }
 
 #
 # @migrate-set-parameters
@@ -708,6 +712,8 @@
 #                hostname must be provided so that the server's x509
 #                certificate identity can be validated. (Since 2.7)
 #
+# @x-checkpoint-delay: the delay time between two checkpoints. (Since 2.8)
+#
 # Since: 2.4
 ##
 { 'command': 'migrate-set-parameters',
@@ -717,7 +723,8 @@
             '*cpu-throttle-initial': 'int',
             '*cpu-throttle-increment': 'int',
             '*tls-creds': 'str',
-            '*tls-hostname': 'str'} }
+            '*tls-hostname': 'str',
+            '*x-checkpoint-delay': 'int' } }
 
 #
 # @MigrationParameters
@@ -751,6 +758,8 @@
 #                hostname must be provided so that the server's x509
 #                certificate identity can be validated. (Since 2.7)
 #
+# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
+#
 # Since: 2.4
 ##
 { 'struct': 'MigrationParameters',
@@ -760,7 +769,9 @@
             'cpu-throttle-initial': 'int',
             'cpu-throttle-increment': 'int',
             'tls-creds': 'str',
-            'tls-hostname': 'str'} }
+            'tls-hostname': 'str',
+            'x-checkpoint-delay': 'int'} }
+
 ##
 # @query-migrate-parameters
 #
-- 
1.8.3.1

  parent reply	other threads:[~2016-09-29  8:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29  8:46 [Qemu-devel] [PATCH COLO-Frame (Base) v20 00/17] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 01/17] migration: Introduce capability 'x-colo' to migration zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 02/17] COLO: migrate COLO related info to secondary node zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 03/17] migration: Enter into COLO mode after migration if COLO is enabled zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 04/17] migration: Switch to COLO process after finishing loadvm zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 05/17] COLO: Establish a new communicating path for COLO zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 06/17] COLO: Introduce checkpointing protocol zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 07/17] COLO: Add a new RunState RUN_STATE_COLO zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 08/17] COLO: Send PVM state to secondary side when do checkpoint zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 09/17] COLO: Load VMState into QIOChannelBuffer before restore it zhanghailiang
2016-09-29  8:46 ` zhanghailiang [this message]
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 11/17] COLO: Synchronize PVM's state to SVM periodically zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 12/17] COLO: Add 'x-colo-lost-heartbeat' command to trigger failover zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 13/17] COLO: Introduce state to record failover process zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 14/17] COLO: Implement the process of failover for primary VM zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 15/17] COLO: Implement failover work for secondary VM zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 16/17] docs: Add documentation for COLO feature zhanghailiang
2016-09-29 11:45   ` Jonathan Neuschäfer
2016-10-05 13:37   ` Eric Blake
2016-10-08  9:32     ` Hailiang Zhang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 17/17] configure: Support enable/disable " zhanghailiang
2016-09-29 12:10 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 00/17] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) no-reply
2016-09-30  5:53 ` Amit Shah
2016-09-30  6:27   ` Hailiang Zhang
2016-10-05 12:13     ` Amit Shah
2016-10-09  1:21       ` Hailiang Zhang

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=1475138797-9908-11-git-send-email-zhang.zhanghailiang@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xiecl.fnst@cn.fujitsu.com \
    --cc=zhangchen.fnst@cn.fujitsu.com \
    /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.