From: Hongyang Yang <yanghy@cn.fujitsu.com> To: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: <qemu-devel@nongnu.org>, <kvm@vger.kernel.org>, <eddie.dong@intel.com>, <GuiJianfeng@cn.fujitsu.com>, <mrhines@linux.vnet.ibm.com>, <wency@cn.fujitsu.com> Subject: Re: [RFC PATCH 04/17] COLO info: use colo info to tell migration target colo is enabled Date: Fri, 12 Sep 2014 14:36:48 +0800 [thread overview] Message-ID: <54129480.4060705@cn.fujitsu.com> (raw) In-Reply-To: <20140801144321.GA2430@work-vm> 在 08/01/2014 10:43 PM, Dr. David Alan Gilbert 写道: > * Yang Hongyang (yanghy@cn.fujitsu.com) wrote: >> migrate colo info to migration target to tell the target colo is >> enabled. > > If I understand this correctly this means that you send a 'colo info' device > information for migrations that don't have COLO enabled; that's bad because > it breaks migration unless the destination has it; I guess it's OK if you > were to guard it with a thing so it didn't do it for old machine-types. > > You could use the QEMU_VM_COMMAND sections I've created for postcopy; > ( http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg00889.html ) and > add a QEMU_VM_CMD_COLO to indicate you want the destination to become an SVM, > then check the capability near the start of migration and send the command. Thank you for the reference, I've read part of your Postcopy patches, but haven't into detailed implementation. I will use QEMUSizedBuffer/QEMUFile in next version. For QEMU_VM_COMMAND sections, can you separate it out so that I can make use of it? Do you have a public git tree or something? > > Or perhaps there's a way to add the colo-info device on the command line so it's > not always there. > > Dave > >> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> >> --- >> Makefile.objs | 1 + >> include/migration/migration-colo.h | 3 ++ >> migration-colo-comm.c | 68 ++++++++++++++++++++++++++++++++++++++ >> vl.c | 4 +++ >> 4 files changed, 76 insertions(+) >> create mode 100644 migration-colo-comm.c >> >> diff --git a/Makefile.objs b/Makefile.objs >> index cab5824..1836a68 100644 >> --- a/Makefile.objs >> +++ b/Makefile.objs >> @@ -50,6 +50,7 @@ common-obj-$(CONFIG_POSIX) += os-posix.o >> common-obj-$(CONFIG_LINUX) += fsdev/ >> >> common-obj-y += migration.o migration-tcp.o >> +common-obj-y += migration-colo-comm.o >> common-obj-$(CONFIG_COLO) += migration-colo.o >> common-obj-y += vmstate.o >> common-obj-y += qemu-file.o >> diff --git a/include/migration/migration-colo.h b/include/migration/migration-colo.h >> index 35b384c..e3735d8 100644 >> --- a/include/migration/migration-colo.h >> +++ b/include/migration/migration-colo.h >> @@ -12,6 +12,9 @@ >> #define QEMU_MIGRATION_COLO_H >> >> #include "qemu-common.h" >> +#include "migration/migration.h" >> + >> +void colo_info_mig_init(void); >> >> bool colo_supported(void); >> >> diff --git a/migration-colo-comm.c b/migration-colo-comm.c >> new file mode 100644 >> index 0000000..ccbc246 >> --- /dev/null >> +++ b/migration-colo-comm.c >> @@ -0,0 +1,68 @@ >> +/* >> + * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO) >> + * (a.k.a. Fault Tolerance or Continuous Replication) >> + * >> + * Copyright (C) 2014 FUJITSU LIMITED >> + * >> + * 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 <migration/migration-colo.h> >> + >> +#define DEBUG_COLO >> + >> +#ifdef DEBUG_COLO >> +#define DPRINTF(fmt, ...) \ >> + do { fprintf(stdout, "COLO: " fmt, ## __VA_ARGS__); } while (0) >> +#else >> +#define DPRINTF(fmt, ...) \ >> + do { } while (0) >> +#endif >> + >> +static bool colo_requested; >> + >> +/* save */ >> + >> +static bool migrate_use_colo(void) >> +{ >> + MigrationState *s = migrate_get_current(); >> + return s->enabled_capabilities[MIGRATION_CAPABILITY_COLO]; >> +} >> + >> +static void colo_info_save(QEMUFile *f, void *opaque) >> +{ >> + qemu_put_byte(f, migrate_use_colo()); >> +} >> + >> +/* restore */ >> + >> +static int colo_info_load(QEMUFile *f, void *opaque, int version_id) >> +{ >> + int value = qemu_get_byte(f); >> + >> + if (value && !colo_supported()) { >> + fprintf(stderr, "COLO is not supported\n"); >> + return -EINVAL; >> + } >> + >> + 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 info", -1, 1, >> + &savevm_colo_info_handlers, NULL); >> +} >> diff --git a/vl.c b/vl.c >> index fe451aa..1a282d8 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -89,6 +89,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" >> @@ -4339,6 +4340,9 @@ int main(int argc, char **argv, char **envp) >> >> blk_mig_init(); >> ram_mig_init(); >> + if (colo_supported()) { >> + colo_info_mig_init(); >> + } >> >> /* open the virtual block devices */ >> if (snapshot) >> -- >> 1.9.1 >> > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK > . > -- Thanks, Yang.
WARNING: multiple messages have this Message-ID (diff)
From: Hongyang Yang <yanghy@cn.fujitsu.com> To: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: kvm@vger.kernel.org, GuiJianfeng@cn.fujitsu.com, eddie.dong@intel.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com Subject: Re: [Qemu-devel] [RFC PATCH 04/17] COLO info: use colo info to tell migration target colo is enabled Date: Fri, 12 Sep 2014 14:36:48 +0800 [thread overview] Message-ID: <54129480.4060705@cn.fujitsu.com> (raw) In-Reply-To: <20140801144321.GA2430@work-vm> 在 08/01/2014 10:43 PM, Dr. David Alan Gilbert 写道: > * Yang Hongyang (yanghy@cn.fujitsu.com) wrote: >> migrate colo info to migration target to tell the target colo is >> enabled. > > If I understand this correctly this means that you send a 'colo info' device > information for migrations that don't have COLO enabled; that's bad because > it breaks migration unless the destination has it; I guess it's OK if you > were to guard it with a thing so it didn't do it for old machine-types. > > You could use the QEMU_VM_COMMAND sections I've created for postcopy; > ( http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg00889.html ) and > add a QEMU_VM_CMD_COLO to indicate you want the destination to become an SVM, > then check the capability near the start of migration and send the command. Thank you for the reference, I've read part of your Postcopy patches, but haven't into detailed implementation. I will use QEMUSizedBuffer/QEMUFile in next version. For QEMU_VM_COMMAND sections, can you separate it out so that I can make use of it? Do you have a public git tree or something? > > Or perhaps there's a way to add the colo-info device on the command line so it's > not always there. > > Dave > >> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> >> --- >> Makefile.objs | 1 + >> include/migration/migration-colo.h | 3 ++ >> migration-colo-comm.c | 68 ++++++++++++++++++++++++++++++++++++++ >> vl.c | 4 +++ >> 4 files changed, 76 insertions(+) >> create mode 100644 migration-colo-comm.c >> >> diff --git a/Makefile.objs b/Makefile.objs >> index cab5824..1836a68 100644 >> --- a/Makefile.objs >> +++ b/Makefile.objs >> @@ -50,6 +50,7 @@ common-obj-$(CONFIG_POSIX) += os-posix.o >> common-obj-$(CONFIG_LINUX) += fsdev/ >> >> common-obj-y += migration.o migration-tcp.o >> +common-obj-y += migration-colo-comm.o >> common-obj-$(CONFIG_COLO) += migration-colo.o >> common-obj-y += vmstate.o >> common-obj-y += qemu-file.o >> diff --git a/include/migration/migration-colo.h b/include/migration/migration-colo.h >> index 35b384c..e3735d8 100644 >> --- a/include/migration/migration-colo.h >> +++ b/include/migration/migration-colo.h >> @@ -12,6 +12,9 @@ >> #define QEMU_MIGRATION_COLO_H >> >> #include "qemu-common.h" >> +#include "migration/migration.h" >> + >> +void colo_info_mig_init(void); >> >> bool colo_supported(void); >> >> diff --git a/migration-colo-comm.c b/migration-colo-comm.c >> new file mode 100644 >> index 0000000..ccbc246 >> --- /dev/null >> +++ b/migration-colo-comm.c >> @@ -0,0 +1,68 @@ >> +/* >> + * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO) >> + * (a.k.a. Fault Tolerance or Continuous Replication) >> + * >> + * Copyright (C) 2014 FUJITSU LIMITED >> + * >> + * 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 <migration/migration-colo.h> >> + >> +#define DEBUG_COLO >> + >> +#ifdef DEBUG_COLO >> +#define DPRINTF(fmt, ...) \ >> + do { fprintf(stdout, "COLO: " fmt, ## __VA_ARGS__); } while (0) >> +#else >> +#define DPRINTF(fmt, ...) \ >> + do { } while (0) >> +#endif >> + >> +static bool colo_requested; >> + >> +/* save */ >> + >> +static bool migrate_use_colo(void) >> +{ >> + MigrationState *s = migrate_get_current(); >> + return s->enabled_capabilities[MIGRATION_CAPABILITY_COLO]; >> +} >> + >> +static void colo_info_save(QEMUFile *f, void *opaque) >> +{ >> + qemu_put_byte(f, migrate_use_colo()); >> +} >> + >> +/* restore */ >> + >> +static int colo_info_load(QEMUFile *f, void *opaque, int version_id) >> +{ >> + int value = qemu_get_byte(f); >> + >> + if (value && !colo_supported()) { >> + fprintf(stderr, "COLO is not supported\n"); >> + return -EINVAL; >> + } >> + >> + 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 info", -1, 1, >> + &savevm_colo_info_handlers, NULL); >> +} >> diff --git a/vl.c b/vl.c >> index fe451aa..1a282d8 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -89,6 +89,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" >> @@ -4339,6 +4340,9 @@ int main(int argc, char **argv, char **envp) >> >> blk_mig_init(); >> ram_mig_init(); >> + if (colo_supported()) { >> + colo_info_mig_init(); >> + } >> >> /* open the virtual block devices */ >> if (snapshot) >> -- >> 1.9.1 >> > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK > . > -- Thanks, Yang.
next prev parent reply other threads:[~2014-09-12 6:36 UTC|newest] Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-23 14:25 [RFC PATCH 00/17] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 14:25 ` [RFC PATCH 01/17] configure: add CONFIG_COLO to switch COLO support Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 14:25 ` [RFC PATCH 02/17] COLO: introduce an api colo_supported() to indicate " Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 15:47 ` Eric Blake 2014-07-23 15:47 ` Eric Blake 2014-07-23 14:25 ` [RFC PATCH 03/17] COLO migration: add a migration capability 'colo' Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 14:41 ` Eric Blake 2014-07-23 14:41 ` Eric Blake 2014-07-23 14:25 ` [RFC PATCH 04/17] COLO info: use colo info to tell migration target colo is enabled Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-08-01 14:43 ` Dr. David Alan Gilbert 2014-08-01 14:43 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-09-12 6:36 ` Hongyang Yang [this message] 2014-09-12 6:36 ` Hongyang Yang 2014-07-23 14:25 ` [RFC PATCH 05/17] COLO save: integrate COLO checkpointed save into qemu migration Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-08-01 14:46 ` Dr. David Alan Gilbert 2014-08-01 14:46 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-07-23 14:25 ` [RFC PATCH 06/17] COLO restore: integrate COLO checkpointed restore into qemu restore Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 14:25 ` [RFC PATCH 07/17] COLO buffer: implement colo buffer as well as QEMUFileOps based on it Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 18:24 ` Eric Blake 2014-07-23 18:24 ` Eric Blake 2014-08-01 14:52 ` Dr. David Alan Gilbert 2014-08-01 14:52 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-09-17 1:43 ` Hongyang Yang 2014-09-17 1:43 ` [Qemu-devel] " Hongyang Yang 2014-07-23 14:25 ` [RFC PATCH 08/17] COLO: disable qdev hotplug Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 14:25 ` [RFC PATCH 09/17] COLO ctl: implement API's that communicate with colo agent Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 14:25 ` [RFC PATCH 10/17] COLO ctl: introduce is_slave() and is_master() Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-08-01 14:55 ` Dr. David Alan Gilbert 2014-08-01 14:55 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-07-23 14:25 ` [RFC PATCH 11/17] COLO ctl: implement colo checkpoint protocol Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-08-01 15:03 ` Dr. David Alan Gilbert 2014-08-01 15:03 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-09-12 6:20 ` Hongyang Yang 2014-09-12 6:20 ` [Qemu-devel] " Hongyang Yang 2014-09-12 11:17 ` Dr. David Alan Gilbert 2014-09-12 11:17 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-09-12 11:40 ` Hongyang Yang 2014-09-12 11:40 ` [Qemu-devel] " Hongyang Yang 2014-09-12 11:57 ` Dr. David Alan Gilbert 2014-09-12 11:57 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-07-23 14:25 ` [RFC PATCH 12/17] COLO ctl: add a RunState RUN_STATE_COLO Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 15:48 ` Eric Blake 2014-07-23 15:48 ` Eric Blake 2014-07-23 14:25 ` [RFC PATCH 13/17] COLO ctl: implement colo save Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-08-01 15:07 ` Dr. David Alan Gilbert 2014-08-01 15:07 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-07-23 14:25 ` [RFC PATCH 14/17] COLO ctl: implement colo restore Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 14:25 ` [RFC PATCH 15/17] COLO save: reuse migration bitmap under colo checkpoint Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-08-01 15:09 ` Dr. David Alan Gilbert 2014-08-01 15:09 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-07-23 14:25 ` [RFC PATCH 16/17] COLO ram cache: implement colo ram cache on slaver Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-08-01 15:10 ` Dr. David Alan Gilbert 2014-08-01 15:10 ` [Qemu-devel] " Dr. David Alan Gilbert 2014-09-12 6:30 ` Hongyang Yang 2014-09-12 6:30 ` [Qemu-devel] " Hongyang Yang 2014-07-23 14:25 ` [RFC PATCH 17/17] HACK: trigger checkpoint every 500ms Yang Hongyang 2014-07-23 14:25 ` [Qemu-devel] " Yang Hongyang 2014-07-23 15:44 ` [Qemu-devel] [RFC PATCH 00/17] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service Eric Blake 2014-07-23 15:44 ` Eric Blake 2014-07-24 2:24 ` Hongyang Yang 2014-07-24 2:24 ` [Qemu-devel] " Hongyang Yang 2014-08-01 16:02 ` Dr. David Alan Gilbert 2014-08-01 16:02 ` [Qemu-devel] " Dr. David Alan Gilbert
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=54129480.4060705@cn.fujitsu.com \ --to=yanghy@cn.fujitsu.com \ --cc=GuiJianfeng@cn.fujitsu.com \ --cc=dgilbert@redhat.com \ --cc=eddie.dong@intel.com \ --cc=kvm@vger.kernel.org \ --cc=mrhines@linux.vnet.ibm.com \ --cc=qemu-devel@nongnu.org \ --cc=wency@cn.fujitsu.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.