From patchwork Mon Feb 22 02:40:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhanghailiang X-Patchwork-Id: 8370511 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 7EA569F314 for ; Mon, 22 Feb 2016 02:47:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 996A020390 for ; Mon, 22 Feb 2016 02:47:29 +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 83C532038D for ; Mon, 22 Feb 2016 02:47:28 +0000 (UTC) Received: from localhost ([::1]:46100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXgX1-0005Vh-Si for patchwork-qemu-devel@patchwork.kernel.org; Sun, 21 Feb 2016 21:47:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXgRO-0001F8-KW for qemu-devel@nongnu.org; Sun, 21 Feb 2016 21:41:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXgRM-0007TT-La for qemu-devel@nongnu.org; Sun, 21 Feb 2016 21:41:38 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:13705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXgRL-0007Sa-Gx for qemu-devel@nongnu.org; Sun, 21 Feb 2016 21:41:36 -0500 Received: from 172.24.1.50 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.50]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BWL15727; Mon, 22 Feb 2016 10:41:14 +0800 (CST) Received: from localhost (10.177.24.212) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Mon, 22 Feb 2016 10:41:07 +0800 From: zhanghailiang To: Date: Mon, 22 Feb 2016 10:40:09 +0800 Message-ID: <1456108832-24212-16-git-send-email-zhang.zhanghailiang@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1456108832-24212-1-git-send-email-zhang.zhanghailiang@huawei.com> References: <1456108832-24212-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.0A090205.56CA7550.0002, 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: 941ef4f13de3fdb568342f39a6eee222 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: xiecl.fnst@cn.fujitsu.com, lizhijian@cn.fujitsu.com, quintela@redhat.com, armbru@redhat.com, yunhong.jiang@intel.com, eddie.dong@intel.com, peter.huangpeng@huawei.com, dgilbert@redhat.com, zhanghailiang , arei.gonglei@huawei.com, stefanha@redhat.com, amit.shah@redhat.com, zhangchen.fnst@cn.fujitsu.com, Luiz Capitulino , hongyang.yang@easystack.cn Subject: [Qemu-devel] [PATCH COLO-Frame v15 15/38] COLO: Add checkpoint-delay parameter for migrate-set-parameters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org 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 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 | 24 +++++++++++++++++++++++- qapi-schema.json | 19 ++++++++++++++++--- qmp-commands.hx | 3 ++- 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/hmp.c b/hmp.c index bfbd667..786954d 100644 --- a/hmp.c +++ b/hmp.c @@ -285,6 +285,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_CHECKPOINT_DELAY], + params->x_checkpoint_delay); monitor_printf(mon, "\n"); } @@ -1241,6 +1244,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_checkpoint_delay = false; int i; for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) { @@ -1260,6 +1264,8 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) break; case MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT: has_x_cpu_throttle_increment = true; + case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY: + has_x_checkpoint_delay = true; break; } qmp_migrate_set_parameters(has_compress_level, value, @@ -1267,6 +1273,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) has_decompress_threads, value, has_x_cpu_throttle_initial, value, has_x_cpu_throttle_increment, value, + has_x_checkpoint_delay, value, &err); break; } diff --git a/migration/migration.c b/migration/migration.c index 6e19c15..324dcb6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -57,6 +57,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); @@ -92,6 +97,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_CHECKPOINT_DELAY] = + DEFAULT_MIGRATE_X_CHECKPOINT_DELAY, }; if (!once) { @@ -531,6 +538,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_checkpoint_delay = + s->parameters[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY]; return params; } @@ -738,7 +747,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_x_checkpoint_delay, + int64_t x_checkpoint_delay, + Error **errp) { MigrationState *s = migrate_get_current(); @@ -773,6 +785,11 @@ void qmp_migrate_set_parameters(bool has_compress_level, "x_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[MIGRATION_PARAMETER_COMPRESS_LEVEL] = compress_level; @@ -793,6 +810,11 @@ void qmp_migrate_set_parameters(bool has_compress_level, s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT] = x_cpu_throttle_increment; } + + if (has_x_checkpoint_delay) { + s->parameters[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY] = + x_checkpoint_delay; + } } void qmp_migrate_start_postcopy(Error **errp) diff --git a/qapi-schema.json b/qapi-schema.json index 935870d..582407d 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -621,11 +621,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-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in +# periodic mode. (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-checkpoint-delay' ] } # # @migrate-set-parameters @@ -645,6 +650,9 @@ # @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-checkpoint-delay: the delay time between two checkpoints. (Since 2.6) +# # Since: 2.4 ## { 'command': 'migrate-set-parameters', @@ -652,7 +660,8 @@ '*compress-threads': 'int', '*decompress-threads': 'int', '*x-cpu-throttle-initial': 'int', - '*x-cpu-throttle-increment': 'int'} } + '*x-cpu-throttle-increment': 'int', + '*x-checkpoint-delay': 'int' } } # # @MigrationParameters @@ -671,6 +680,8 @@ # auto-converge detects that migration is not making # progress. The default value is 10. (Since 2.5) # +# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.6) +# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -678,7 +689,9 @@ 'compress-threads': 'int', 'decompress-threads': 'int', 'x-cpu-throttle-initial': 'int', - 'x-cpu-throttle-increment': 'int'} } + 'x-cpu-throttle-increment': 'int', + 'x-checkpoint-delay': 'int'} } + ## # @query-migrate-parameters # diff --git a/qmp-commands.hx b/qmp-commands.hx index bf27c38..8e08989 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3718,6 +3718,7 @@ Set migration parameters throttled for auto-converge (json-int) - "x-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: @@ -3731,7 +3732,7 @@ EQMP { .name = "migrate-set-parameters", .args_type = - "compress-level:i?,compress-threads:i?,decompress-threads:i?,x-cpu-throttle-initial:i?,x-cpu-throttle-increment:i?", + "compress-level:i?,compress-threads:i?,decompress-threads:i?,x-cpu-throttle-initial:i?,x-cpu-throttle-increment:i?,x-checkpoint-delay:i?", .mhandler.cmd_new = qmp_marshal_migrate_set_parameters, }, SQMP