From patchwork Fri Jun 3 07:52:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhanghailiang X-Patchwork-Id: 9152075 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 436E26072B for ; Fri, 3 Jun 2016 08:12:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F0952675C for ; Fri, 3 Jun 2016 08:12:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2007F282E8; Fri, 3 Jun 2016 08:12:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 657082675C for ; Fri, 3 Jun 2016 08:12:16 +0000 (UTC) Received: from localhost ([::1]:53123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8kDH-0006gP-Gk for patchwork-qemu-devel@patchwork.kernel.org; Fri, 03 Jun 2016 04:12:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8jvZ-0006yV-JL for qemu-devel@nongnu.org; Fri, 03 Jun 2016 03:53:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8jvU-0004jl-EG for qemu-devel@nongnu.org; Fri, 03 Jun 2016 03:53:56 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:23601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8jvT-0004Rb-Fr for qemu-devel@nongnu.org; Fri, 03 Jun 2016 03:53:52 -0400 Received: from 172.24.1.136 (EHLO szxeml430-hub.china.huawei.com) ([172.24.1.136]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CCR25113; Fri, 03 Jun 2016 15:53:13 +0800 (CST) Received: from localhost (10.177.24.212) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.235.1; Fri, 3 Jun 2016 15:53:04 +0800 From: zhanghailiang To: , , , Date: Fri, 3 Jun 2016 15:52:26 +0800 Message-ID: <1464940366-9880-15-git-send-email-zhang.zhanghailiang@huawei.com> X-Mailer: git-send-email 2.7.2.windows.1 In-Reply-To: <1464940366-9880-1-git-send-email-zhang.zhanghailiang@huawei.com> References: <1464940366-9880-1-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.24.212] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.5751377D.001D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 33c4847c0ab7b7d0f9633aa3c6422a6b X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Subject: [Qemu-devel] [PATCH COLO-Frame v17 14/34] COLO: Add checkpoint-delay parameter for migrate-set-parameters 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: xiecl.fnst@cn.fujitsu.com, lizhijian@cn.fujitsu.com, Markus Armbruster , yunhong.jiang@intel.com, eddie.dong@intel.com, peter.huangpeng@huawei.com, Luiz Capitulino , zhanghailiang , arei.gonglei@huawei.com, stefanha@redhat.com, zhangchen.fnst@cn.fujitsu.com, hongyang.yang@easystack.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Eric Blake Cc: Markus Armbruster Signed-off-by: zhanghailiang Signed-off-by: Li Zhijian Reviewed-by: Dr. David Alan Gilbert --- 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 --- hmp.c | 7 +++++++ migration/migration.c | 18 ++++++++++++++++++ qapi-schema.json | 17 ++++++++++++++--- qmp-commands.hx | 3 ++- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c index a4b1d3d..05174b9 100644 --- a/hmp.c +++ b/hmp.c @@ -300,6 +300,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"); } @@ -1260,6 +1263,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++) { @@ -1283,6 +1287,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; @@ -1307,6 +1313,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 71a81fb..8d735fc 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; } @@ -799,6 +806,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(); @@ -834,6 +843,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; @@ -858,6 +872,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 724bcf7..08e64fe 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -642,12 +642,16 @@ # hostname must be provided so that the server's x509 # certificate identity canbe validated. (Since 2.7) # +# @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in +# periodic mode. (Since 2.7) +# # 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 @@ -683,6 +687,8 @@ # hostname must be provided so that the server's x509 # certificate identity canbe validated. (Since 2.7) # +# @x-checkpoint-delay: the delay time between two checkpoints. (Since 2.7) +# # Since: 2.4 ## { 'command': 'migrate-set-parameters', @@ -692,7 +698,8 @@ '*cpu-throttle-initial': 'int', '*cpu-throttle-increment': 'int', '*tls-creds': 'str', - '*tls-hostname': 'str'} } + '*tls-hostname': 'str', + '*x-checkpoint-delay': 'int' } } # # @MigrationParameters @@ -726,6 +733,8 @@ # hostname must be provided so that the server's x509 # certificate identity canbe validated. (Since 2.6) # +# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.7) +# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -735,7 +744,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 # diff --git a/qmp-commands.hx b/qmp-commands.hx index 34d82c3..e70eae5 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3751,6 +3751,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: @@ -3764,7 +3765,7 @@ EQMP { .name = "migrate-set-parameters", .args_type = - "compress-level:i?,compress-threads:i?,decompress-threads:i?,cpu-throttle-initial:i?,cpu-throttle-increment:i?", + "compress-level:i?,compress-threads:i?,decompress-threads:i?,cpu-throttle-initial:i?,cpu-throttle-increment:i?,x-checkpoint-delay:i?", .mhandler.cmd_new = qmp_marshal_migrate_set_parameters, }, SQMP