From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apocC-0004YY-Jj for qemu-devel@nongnu.org; Mon, 11 Apr 2016 23:03:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apoc9-00023U-Dm for qemu-devel@nongnu.org; Mon, 11 Apr 2016 23:03:44 -0400 Received: from [59.151.112.132] (port=63704 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apoc8-00021A-UZ for qemu-devel@nongnu.org; Mon, 11 Apr 2016 23:03:41 -0400 References: <1460096797-14916-1-git-send-email-zhang.zhanghailiang@huawei.com> <1460096797-14916-17-git-send-email-zhang.zhanghailiang@huawei.com> From: Li Zhijian Message-ID: <570C6561.201@cn.fujitsu.com> Date: Tue, 12 Apr 2016 11:02:57 +0800 MIME-Version: 1.0 In-Reply-To: <1460096797-14916-17-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH COLO-Frame v16 16/35] COLO: synchronize PVM's state to SVM periodically List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: amit.shah@redhat.com, quintela@redhat.com, dgilbert@redhat.com, eblake@redhat.com, peter.huangpeng@huawei.com, eddie.dong@intel.com, yunhong.jiang@intel.com, wency@cn.fujitsu.com, arei.gonglei@huawei.com, stefanha@redhat.com, hongyang.yang@easystack.cn, zhangchen.fnst@cn.fujitsu.com, xiecl.fnst@cn.fujitsu.com, armbru@redhat.com On 04/08/2016 02:26 PM, zhanghailiang wrote: > Do checkpoint periodically, the default interval is 200ms. > > Signed-off-by: zhanghailiang > Signed-off-by: Li Zhijian > Reviewed-by: Dr. David Alan Gilbert > --- > v12: > - Add Reviewed-by tag > v11: > - Fix wrong sleep time for checkpoint period. (Dave's comment) > --- > migration/colo.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/migration/colo.c b/migration/colo.c > index 4dae069..4e3b39f 100644 > --- a/migration/colo.c > +++ b/migration/colo.c > @@ -11,6 +11,7 @@ > */ > > #include "qemu/osdep.h" > +#include "qemu/timer.h" > #include "sysemu/sysemu.h" > #include "migration/colo.h" > #include "trace.h" > @@ -231,6 +232,7 @@ out: > static void colo_process_checkpoint(MigrationState *s) > { > QEMUSizedBuffer *buffer = NULL; > + int64_t current_time, checkpoint_time = qemu_clock_get_ms(QEMU_CLOCK_HOST); > Error *local_err = NULL; > int ret; > > @@ -262,11 +264,21 @@ static void colo_process_checkpoint(MigrationState *s) > trace_colo_vm_state_change("stop", "run"); > > while (s->state == MIGRATION_STATUS_COLO) { > + current_time = qemu_clock_get_ms(QEMU_CLOCK_HOST); > + if (current_time - checkpoint_time < > + s->parameters[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY]) { > + int64_t delay_ms; > + > + delay_ms = s->parameters[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY] - > + (current_time - checkpoint_time); > + g_usleep(delay_ms * 1000); Once a large value(e.g. 1000000) is set to s->parameters[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY], that means here will sleep 1000 seconds and people can't revert this operation. Can we let this sleep operation more flexible ? Thanks Li Zhijian > + } > /* start a colo checkpoint */ > ret = colo_do_checkpoint_transaction(s, buffer); > if (ret < 0) { > goto out; > } > + checkpoint_time = qemu_clock_get_ms(QEMU_CLOCK_HOST); > } > > out: > -- Best regards. Li Zhijian (8555)