From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO9hr-0005Jr-S1 for qemu-devel@nongnu.org; Tue, 26 Jan 2016 14:55:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aO9ho-0003Io-MJ for qemu-devel@nongnu.org; Tue, 26 Jan 2016 14:55:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO9ho-0003I6-Gp for qemu-devel@nongnu.org; Tue, 26 Jan 2016 14:55:12 -0500 Date: Tue, 26 Jan 2016 19:55:04 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20160126195503.GH2426@work-vm> References: <1451372975-5048-1-git-send-email-zhang.zhanghailiang@huawei.com> <1451372975-5048-29-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1451372975-5048-29-git-send-email-zhang.zhanghailiang@huawei.com> Subject: Re: [Qemu-devel] [PATCH COLO-Frame v13 28/39] COLO: Process shutdown command for VM in COLO state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang Cc: xiecl.fnst@cn.fujitsu.com, lizhijian@cn.fujitsu.com, quintela@redhat.com, yunhong.jiang@intel.com, eddie.dong@intel.com, peter.huangpeng@huawei.com, qemu-devel@nongnu.org, arei.gonglei@huawei.com, stefanha@redhat.com, Paolo Bonzini , amit.shah@redhat.com, zhangchen.fnst@cn.fujitsu.com, hongyang.yang@easystack.cn * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote: > If VM is in COLO FT state, we should do some extra work before normal shutdown > process. SVM will ignore the shutdown command if this command is issued directly > to it, PVM will send the shutdown command to SVM if it gets this command. > > Cc: Paolo Bonzini > Signed-off-by: zhanghailiang > Signed-off-by: Li Zhijian > --- > v13: > - Move COLO shutdown related codes to colo.c file (Dave's suggestion) > diff --git a/migration/colo.c b/migration/colo.c > index de01ade..2bea519 100644 > --- a/migration/colo.c > +++ b/migration/colo.c > @@ -248,6 +248,7 @@ static uint64_t colo_get_cmd_value(QEMUFile *f, uint32_t expect_cmd, > static int colo_do_checkpoint_transaction(MigrationState *s, > QEMUSizedBuffer *buffer) > { > + int colo_shutdown; > QEMUFile *trans = NULL; > size_t size; > Error *local_err = NULL; > @@ -277,6 +278,7 @@ static int colo_do_checkpoint_transaction(MigrationState *s, > qemu_mutex_unlock_iothread(); > goto out; > } > + colo_shutdown = colo_shutdown_requested; > vm_stop_force_state(RUN_STATE_COLO); > qemu_mutex_unlock_iothread(); > trace_colo_vm_state_change("run", "stop"); > @@ -330,6 +332,18 @@ static int colo_do_checkpoint_transaction(MigrationState *s, > goto out; > } > > + if (colo_shutdown) { Why do you take a copy of colo_shutdown_requested rather than just use it directly? Dave -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK