From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvfec-0000KL-FM for qemu-devel@nongnu.org; Mon, 09 Nov 2015 01:10:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvfeY-0005l7-7Q for qemu-devel@nongnu.org; Mon, 09 Nov 2015 01:10:10 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:19739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvfeX-0005hh-Eo for qemu-devel@nongnu.org; Mon, 09 Nov 2015 01:10:06 -0500 References: <1446551816-15768-1-git-send-email-zhang.zhanghailiang@huawei.com> <1446551816-15768-7-git-send-email-zhang.zhanghailiang@huawei.com> <20151106172904.GG4267@work-vm> From: zhanghailiang Message-ID: <56403897.8060207@huawei.com> Date: Mon, 9 Nov 2015 14:09:27 +0800 MIME-Version: 1.0 In-Reply-To: <20151106172904.GG4267@work-vm> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit 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: "Dr. David Alan Gilbert" 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 On 2015/11/7 1:29, Dr. David Alan Gilbert wrote: > * 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? > Good catch! I deleted it in patch 38, which should be moved into this patch. I will fix it in next version. Thanks, zhanghailiang > (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 > > . >