From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZHsU-00054J-SA for qemu-devel@nongnu.org; Fri, 26 Feb 2016 07:52:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZHsR-0005iG-KC for qemu-devel@nongnu.org; Fri, 26 Feb 2016 07:52:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZHsR-0005iA-DA for qemu-devel@nongnu.org; Fri, 26 Feb 2016 07:52:11 -0500 Date: Fri, 26 Feb 2016 12:52:02 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20160226125202.GD2161@work-vm> References: <1456108832-24212-1-git-send-email-zhang.zhanghailiang@huawei.com> <1456108832-24212-28-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456108832-24212-28-git-send-email-zhang.zhanghailiang@huawei.com> Subject: Re: [Qemu-devel] [PATCH COLO-Frame v15 27/38] migration/savevm: Add new helpers to process the different stages of loadvm 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, armbru@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, zhangchen.fnst@cn.fujitsu.com, hongyang.yang@easystack.cn * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote: > There are several stages during loadvm process. In different stage, > migration incoming processes different section. > We want to control these stages more accuracy, to optimize the COLO > capability. > > Here we add two new helper functions: qemu_loadvm_state_begin() > and qemu_load_device_state(). > Besides, we make qemu_loadvm_state_main() API public. > > Signed-off-by: zhanghailiang > Signed-off-by: Li Zhijian Reviewed-by: Dr. David Alan Gilbert It's interesting; there's not that much difference between the two routines, and they only wrap a little around the loadvm_state_main, but I can see it makes it clearer at the place they're called. Dave > --- > v14: > - Split from patch 'COLO: Separate the process of saving/loading > ram and device state > --- > include/sysemu/sysemu.h | 3 +++ > migration/savevm.c | 38 +++++++++++++++++++++++++++++++++++--- > 2 files changed, 38 insertions(+), 3 deletions(-) > > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index 91eeda3..c0694a1 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -134,6 +134,9 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name, > uint64_t *length_list); > > int qemu_loadvm_state(QEMUFile *f); > +int qemu_loadvm_state_begin(QEMUFile *f); > +int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis); > +int qemu_load_device_state(QEMUFile *f); > > typedef enum DisplayType > { > diff --git a/migration/savevm.c b/migration/savevm.c > index 9e3c18a..954e0a7 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -1249,8 +1249,6 @@ enum LoadVMExitCodes { > LOADVM_QUIT = 1, > }; > > -static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis); > - > /* ------ incoming postcopy messages ------ */ > /* 'advise' arrives before any transfers just to tell us that a postcopy > * *might* happen - it might be skipped if precopy transferred everything > @@ -1832,7 +1830,7 @@ qemu_loadvm_section_part_end(QEMUFile *f, MigrationIncomingState *mis) > return 0; > } > > -static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis) > +int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis) > { > uint8_t section_type; > int ret; > @@ -1965,6 +1963,40 @@ int qemu_loadvm_state(QEMUFile *f) > return ret; > } > > +int qemu_loadvm_state_begin(QEMUFile *f) > +{ > + MigrationIncomingState *mis = migration_incoming_get_current(); > + Error *local_err = NULL; > + int ret; > + > + if (qemu_savevm_state_blocked(&local_err)) { > + error_report_err(local_err); > + return -EINVAL; > + } > + /* Load QEMU_VM_SECTION_START section */ > + ret = qemu_loadvm_state_main(f, mis); > + if (ret < 0) { > + error_report("Failed to loadvm begin work: %d", ret); > + } > + return ret; > +} > + > +int qemu_load_device_state(QEMUFile *f) > +{ > + MigrationIncomingState *mis = migration_incoming_get_current(); > + int ret; > + > + /* Load QEMU_VM_SECTION_FULL section */ > + ret = qemu_loadvm_state_main(f, mis); > + if (ret < 0) { > + error_report("Failed to load device state: %d", ret); > + return ret; > + } > + > + cpu_synchronize_all_post_init(); > + return 0; > +} > + > void hmp_savevm(Monitor *mon, const QDict *qdict) > { > BlockDriverState *bs, *bs1; > -- > 1.8.3.1 > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK