From patchwork Tue Oct 30 08:33:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 195429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BD6AE2C00A7 for ; Tue, 30 Oct 2012 21:47:46 +1100 (EST) Received: from localhost ([::1]:47813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT7HZ-00069A-Rp for incoming@patchwork.ozlabs.org; Tue, 30 Oct 2012 04:34:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT7GP-0004pN-5p for qemu-devel@nongnu.org; Tue, 30 Oct 2012 04:33:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TT7GD-0000am-Jg for qemu-devel@nongnu.org; Tue, 30 Oct 2012 04:33:33 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:44725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT7GC-0000Wn-Us for qemu-devel@nongnu.org; Tue, 30 Oct 2012 04:33:21 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id F09C3181D4; Tue, 30 Oct 2012 17:33:14 +0900 (JST) Received: (nullmailer pid 29498 invoked by uid 1000); Tue, 30 Oct 2012 08:33:14 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org, kvm@vger.kernel.org Date: Tue, 30 Oct 2012 17:33:10 +0900 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 210.128.90.3 Cc: benoit.hudzia@gmail.com, aarcange@redhat.com, aliguori@us.ibm.com, quintela@redhat.com, stefanha@gmail.com, t.hirofuchi@aist.go.jp, dlaor@redhat.com, satoshi.itoh@aist.go.jp, mdroth@linux.vnet.ibm.com, yoshikawa.takuya@oss.ntt.co.jp, owasserm@redhat.com, avi@redhat.com, pbonzini@redhat.com, chegu_vinod@hp.com Subject: [Qemu-devel] [PATCH v3 34/35] postcopy/outgoing: introduce precopy_count parameter 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Precopy with this loop number before postcopy mode. This will be implemented by the next patch. Signed-off-by: Isaku Yamahata --- hmp-commands.hx | 10 ++++++---- hmp.c | 2 ++ migration-postcopy.c | 2 +- migration.c | 2 ++ migration.h | 3 ++- qapi-schema.json | 4 +++- qmp-commands.hx | 2 +- savevm.c | 3 ++- 8 files changed, 19 insertions(+), 9 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 942f620..957bf76 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -826,9 +826,10 @@ ETEXI { .name = "migrate", - .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s," - "forward:i?,backward:i?", - .params = "[-d] [-b] [-i] [-p [-n] [-m]] uri [forward] [backword]", + .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n," + "uri:s,precopy_count:i?,forward:i?,backward:i?", + .params = "[-d] [-b] [-i] [-p [-n] [-m]] uri " + "[precopy_count] [forward] [backword]", .help = "migrate to URI (using -d to not wait for completion)" "\n\t\t\t -b for migration without shared storage with" " full copy of disk\n\t\t\t -i for migration without " @@ -837,6 +838,7 @@ ETEXI "\n\t\t\t-p for migration with postcopy mode enabled" "\n\t\t\t-m for move background transfer of postcopy mode" "\n\t\t\t-n for no background transfer of postcopy mode" + "\n\t\t\tprecopy_count: loop of precopy when postcopy" "\n\t\t\tforward: the number of pages to " "forward-prefault when postcopy (default 0)" "\n\t\t\tbackward: the number of pages to " @@ -846,7 +848,7 @@ ETEXI STEXI -@item migrate [-d] [-b] [-i] [-p [-n] [-m]] @var{uri} @var{forward} @var{backward} +@item migrate [-d] [-b] [-i] [-p [-n] [-m]] @var{uri} @var{precopy_count} @var{forward} @var{backward} @findex migrate Migrate to @var{uri} (using -d to not wait for completion). -b for migration with full copy of disk diff --git a/hmp.c b/hmp.c index a0bd869..be88db9 100644 --- a/hmp.c +++ b/hmp.c @@ -1038,6 +1038,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) int postcopy = qdict_get_try_bool(qdict, "postcopy", 0); int movebg = qdict_get_try_bool(qdict, "movebg", 0); int nobg = qdict_get_try_bool(qdict, "nobg", 0); + int precopy_count = qdict_get_try_int(qdict, "precopy_count", 0); int forward = qdict_get_try_int(qdict, "forward", 0); int backward = qdict_get_try_int(qdict, "backward", 0); const char *uri = qdict_get_str(qdict, "uri"); @@ -1045,6 +1046,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, !!postcopy, postcopy, !!movebg, movebg, !!nobg, nobg, + !!precopy_count, precopy_count, !!forward, forward, !!backward, backward, &err); if (err) { diff --git a/migration-postcopy.c b/migration-postcopy.c index 9298cd4..8a43c42 100644 --- a/migration-postcopy.c +++ b/migration-postcopy.c @@ -319,7 +319,7 @@ int postcopy_outgoing_create_read_socket(MigrationState *s) return 0; } -void postcopy_outgoing_state_begin(QEMUFile *f) +void postcopy_outgoing_state_begin(QEMUFile *f, const MigrationParams *params) { uint64_t options = 0; qemu_put_ubyte(f, QEMU_VM_POSTCOPY_INIT); diff --git a/migration.c b/migration.c index 057ea31..84ca4b3 100644 --- a/migration.c +++ b/migration.c @@ -513,6 +513,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_postcopy, bool postcopy, bool has_movebg, bool movebg, bool has_nobg, bool nobg, + bool has_precopy_count, int64_t precopy_count, bool has_forward, int64_t forward, bool has_backward, int64_t backward, Error **errp) @@ -527,6 +528,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, params.postcopy = postcopy; params.nobg = nobg; params.movebg = movebg; + params.precopy_count = precopy_count, params.prefault_forward = 0; if (has_forward) { if (forward < 0) { diff --git a/migration.h b/migration.h index 2801e7e..c4d7b0a 100644 --- a/migration.h +++ b/migration.h @@ -27,6 +27,7 @@ struct MigrationParams { bool postcopy; bool nobg; bool movebg; + int precopy_count; int64_t prefault_forward; int64_t prefault_backward; }; @@ -150,7 +151,7 @@ int64_t xbzrle_cache_resize(int64_t new_size); /* For outgoing postcopy */ int postcopy_outgoing_create_read_socket(MigrationState *s); -void postcopy_outgoing_state_begin(QEMUFile *f); +void postcopy_outgoing_state_begin(QEMUFile *f, const MigrationParams *params); void postcopy_outgoing_state_complete( QEMUFile *f, const uint8_t *buffer, size_t buffer_size); int postcopy_outgoing_ram_save_iterate(QEMUFile *f, void *opaque); diff --git a/qapi-schema.json b/qapi-schema.json index cf5d988..5c4d2f2 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -2089,6 +2089,8 @@ # @detach: this argument exists only for compatibility reasons and # is ignored by QEMU # +# @precopy_count: #optional the number of loops of precopy when postcopy +# # Returns: nothing on success # # Since: 0.14.0 @@ -2096,7 +2098,7 @@ { 'command': 'migrate', 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' , '*postcopy': 'bool', '*movebg': 'bool', '*nobg': 'bool', - '*forward': 'int', '*backward': 'int'} } + '*precopy_count': 'int', '*forward': 'int', '*backward': 'int'} } # @xen-save-devices-state: # diff --git a/qmp-commands.hx b/qmp-commands.hx index 7028ece..b8cf174 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -518,7 +518,7 @@ EQMP { .name = "migrate", - .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s", + .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s,precopy_cout:i?", .mhandler.cmd_new = qmp_marshal_input_migrate, }, diff --git a/savevm.c b/savevm.c index 8d26354..32781e1 100644 --- a/savevm.c +++ b/savevm.c @@ -1650,7 +1650,7 @@ int qemu_savevm_state_begin(QEMUFile *f, if (params->postcopy) { /* tell this is postcopy */ qemu_put_byte(f, QEMU_VM_POSTCOPY); - postcopy_outgoing_state_begin(f); + postcopy_outgoing_state_begin(f, params); } QTAILQ_FOREACH(se, &savevm_handlers, entry) { @@ -1839,6 +1839,7 @@ static int qemu_savevm_state(QEMUFile *f) .blk = 0, .shared = 0, .postcopy = 0, + .precopy_count = 0, .movebg = 0, .nobg = 0, };