From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuDFC-0001u4-VU for qemu-devel@nongnu.org; Mon, 18 May 2015 01:05:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuDF8-0002RR-UA for qemu-devel@nongnu.org; Mon, 18 May 2015 01:05:38 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:53434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuDF7-0002Po-Mx for qemu-devel@nongnu.org; Mon, 18 May 2015 01:05:34 -0400 Message-ID: <555972E2.6040202@huawei.com> Date: Mon, 18 May 2015 13:04:34 +0800 From: zhanghailiang MIME-Version: 1.0 References: <1427347774-8960-1-git-send-email-zhang.zhanghailiang@huawei.com> <1427347774-8960-4-git-send-email-zhang.zhanghailiang@huawei.com> <20150515113820.GD2194@work-vm> In-Reply-To: <20150515113820.GD2194@work-vm> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v4 03/28] COLO: migrate colo related info to slave 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, amit.shah@redhat.com, Lai Jiangshan , Yang Hongyang , david@gibson.dropbear.id.au On 2015/5/15 19:38, Dr. David Alan Gilbert wrote: > * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote: >> We can know if VM in destination should go into COLO mode by refer to >> the info that has been migrated from PVM. >> >> Signed-off-by: zhanghailiang >> Signed-off-by: Yang Hongyang >> Signed-off-by: Lai Jiangshan >> Signed-off-by: Gonglei >> --- >> include/migration/migration-colo.h | 2 ++ >> migration/Makefile.objs | 1 + >> migration/colo-comm.c | 55 ++++++++++++++++++++++++++++++++++++++ >> vl.c | 5 +++- >> 4 files changed, 62 insertions(+), 1 deletion(-) >> create mode 100644 migration/colo-comm.c >> >> diff --git a/include/migration/migration-colo.h b/include/migration/migration-colo.h >> index 6fdbb94..de68c72 100644 >> --- a/include/migration/migration-colo.h >> +++ b/include/migration/migration-colo.h >> @@ -14,7 +14,9 @@ >> #define QEMU_MIGRATION_COLO_H >> >> #include "qemu-common.h" >> +#include "migration/migration.h" >> >> bool colo_supported(void); >> +void colo_info_mig_init(void); >> >> #endif >> diff --git a/migration/Makefile.objs b/migration/Makefile.objs >> index 5a25d39..cb7bd30 100644 >> --- a/migration/Makefile.objs >> +++ b/migration/Makefile.objs >> @@ -1,5 +1,6 @@ >> common-obj-y += migration.o tcp.o >> common-obj-$(CONFIG_COLO) += colo.o >> +common-obj-y += colo-comm.o >> common-obj-y += vmstate.o >> common-obj-y += qemu-file.o qemu-file-buf.o qemu-file-unix.o qemu-file-stdio.o >> common-obj-y += xbzrle.o >> diff --git a/migration/colo-comm.c b/migration/colo-comm.c >> new file mode 100644 >> index 0000000..cab97e9 >> --- /dev/null >> +++ b/migration/colo-comm.c >> @@ -0,0 +1,55 @@ >> +/* >> + * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO) >> + * (a.k.a. Fault Tolerance or Continuous Replication) >> + * >> + * Copyright (c) 2015 HUAWEI TECHNOLOGIES CO.,LTD. >> + * Copyright (c) 2015 FUJITSU LIMITED >> + * Copyright (c) 2015 Intel Corporation >> + * >> + * This work is licensed under the terms of the GNU GPL, version 2 or >> + * later. See the COPYING file in the top-level directory. >> + * >> + */ >> + >> +#include >> + >> +#define DEBUG_COLO_COMMON 0 >> + >> +#define DPRINTF(fmt, ...) \ >> + do { \ >> + if (DEBUG_COLO_COMMON) { \ >> + fprintf(stderr, "COLO: " fmt, ## __VA_ARGS__); \ >> + } \ >> + } while (0) > > > I'm trying to get rid of all the DPRINTF's in migration - I've turned > most of the existing DPRINTF into trace_ calls already; > using the stderr trace backend it's very easy (--enable-trace-backends=stderr) > and then you can switch them on individually, it also prints times with > each message that's useful for performance tuning. Yes, we should change all DPRINTF to trace_ calls. We will try to fix them in next version. ;) Thanks, zhanghailiang > >> +static bool colo_requested; >> + >> +/* save */ >> +static void colo_info_save(QEMUFile *f, void *opaque) >> +{ >> + qemu_put_byte(f, migrate_enable_colo()); >> +} >> + >> +/* restore */ >> +static int colo_info_load(QEMUFile *f, void *opaque, int version_id) >> +{ >> + int value = qemu_get_byte(f); >> + >> + if (value && !colo_requested) { >> + DPRINTF("COLO requested!\n"); >> + } >> + colo_requested = value; >> + >> + return 0; >> +} >> + >> +static SaveVMHandlers savevm_colo_info_handlers = { >> + .save_state = colo_info_save, >> + .load_state = colo_info_load, >> +}; >> + >> +void colo_info_mig_init(void) >> +{ >> + register_savevm_live(NULL, "colo", -1, 1, >> + &savevm_colo_info_handlers, NULL); >> +} >> diff --git a/vl.c b/vl.c >> index 75ec292..9724992 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -90,6 +90,7 @@ int main(int argc, char **argv) >> #include "sysemu/dma.h" >> #include "audio/audio.h" >> #include "migration/migration.h" >> +#include "migration/migration-colo.h" >> #include "sysemu/kvm.h" >> #include "qapi/qmp/qjson.h" >> #include "qemu/option.h" >> @@ -4149,7 +4150,9 @@ int main(int argc, char **argv, char **envp) >> >> blk_mig_init(); >> ram_mig_init(); >> - >> +#ifdef CONFIG_COLO >> + colo_info_mig_init(); >> +#endif >> /* If the currently selected machine wishes to override the units-per-bus >> * property of its default HBA interface type, do so now. */ >> if (machine_class->units_per_default_bus) { >> -- >> 1.7.12.4 >> >> > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK > > . >