From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zukp9-0000kB-Et for qemu-devel@nongnu.org; Fri, 06 Nov 2015 12:29:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zukp5-0002WF-7U for qemu-devel@nongnu.org; Fri, 06 Nov 2015 12:29:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zukp4-0002VU-Vo for qemu-devel@nongnu.org; Fri, 06 Nov 2015 12:29:11 -0500 Date: Fri, 6 Nov 2015 17:29:04 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20151106172904.GG4267@work-vm> References: <1446551816-15768-1-git-send-email-zhang.zhanghailiang@huawei.com> <1446551816-15768-7-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1446551816-15768-7-git-send-email-zhang.zhanghailiang@huawei.com> Subject: Re: [Qemu-devel] [PATCH COLO-Frame v10 06/38] migration: Integrate COLO checkpoint process into loadvm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang Cc: 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, amit.shah@redhat.com * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote: > Switch from normal migration loadvm process into COLO checkpoint process if > COLO mode is enabled. > We add three new members to struct MigrationIncomingState, 'have_colo_incoming_thread' > and 'colo_incoming_thread' record the colo related threads for secondary VM, > 'migration_incoming_co' records the original migration incoming coroutine. > > Signed-off-by: zhanghailiang > Signed-off-by: Li Zhijian > --- > v10: fix a bug about fd leak which is found by Dave. > diff --git a/migration/migration.c b/migration/migration.c > index cf83531..7d8cd38 100644 > --- a/migration/migration.c > +++ b/migration/migration.c > @@ -288,6 +288,27 @@ static void process_incoming_migration_co(void *opaque) > MIGRATION_STATUS_ACTIVE); > ret = qemu_loadvm_state(f); > > + if (!ret) { > + /* Make sure all file formats flush their mutable metadata */ > + bdrv_invalidate_cache_all(&local_err); > + if (local_err) { > + error_report_err(local_err); > + migrate_decompress_threads_join(); > + exit(EXIT_FAILURE); > + } > + } Are you moving this code? Because I think the bdrv_invalidate_cache_all is a few lines below here - just.... > + /* we get colo info, and know if we are in colo mode */ > + if (!ret && migration_incoming_enable_colo()) { > + mis->migration_incoming_co = qemu_coroutine_self(); > + qemu_thread_create(&mis->colo_incoming_thread, "colo incoming", > + colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); > + mis->have_colo_incoming_thread = true; > + qemu_coroutine_yield(); > + > + /* Wait checkpoint incoming thread exit before free resource */ > + qemu_thread_join(&mis->colo_incoming_thread); > + } > + > qemu_fclose(f); > free_xbzrle_decoded_buf(); > migration_incoming_state_destroy(); .... here in my current head world; so shouldn't you be deleting the bdrv_invalidate_cache_all here? (Otherwise OK) Dave > diff --git a/stubs/migration-colo.c b/stubs/migration-colo.c > index acddca6..c12516e 100644 > --- a/stubs/migration-colo.c > +++ b/stubs/migration-colo.c > @@ -22,6 +22,16 @@ bool migration_in_colo_state(void) > return false; > } > > +bool migration_incoming_in_colo_state(void) > +{ > + return false; > +} > + > void migrate_start_colo_process(MigrationState *s) > { > } > + > +void *colo_process_incoming_thread(void *opaque) > +{ > + return NULL; > +} > -- > 1.8.3.1 > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK