From: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, zhangchen.fnst@cn.fujitsu.com,
lizhijian@cn.fujitsu.com, xiecl.fnst@cn.fujitsu.com,
Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 12/15] savevm: split the process of different stages for loadvm/savevm
Date: Mon, 10 Apr 2017 16:26:40 +0800 [thread overview]
Message-ID: <58EB41C0.5060203@huawei.com> (raw)
In-Reply-To: <20170407171840.GE2623@work-vm>
On 2017/4/8 1:18, Dr. David Alan Gilbert wrote:
> * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote:
>> There are several stages during loadvm/savevm process. In different stage,
>> migration incoming processes different types of sections.
>> We want to control these stages more accuracy, it will benefit COLO
>> performance, we don't have to save type of QEMU_VM_SECTION_START
>> sections everytime while do checkpoint, besides, we want to separate
>> the process of saving/loading memory and devices state.
>>
>> So we add three new helper functions: qemu_loadvm_state_begin(),
>> qemu_load_device_state() and qemu_savevm_live_state() to achieve
>> different process during migration.
>>
>> Besides, we make qemu_loadvm_state_main() and qemu_save_device_state()
>> public.
>>
>> Cc: Juan Quintela <quintela@redhat.com>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> ---
>> include/sysemu/sysemu.h | 6 ++++++
>> migration/savevm.c | 55 ++++++++++++++++++++++++++++++++++++++++++-------
>> 2 files changed, 54 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index 7ed665a..95cae41 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -132,7 +132,13 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
>> uint64_t *start_list,
>> uint64_t *length_list);
>>
>> +void qemu_savevm_live_state(QEMUFile *f);
>> +int qemu_save_device_state(QEMUFile *f);
>> +
>> 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);
>>
>> extern int autostart;
>>
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index 9c2d239..dac478b 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -54,6 +54,7 @@
>> #include "qemu/cutils.h"
>> #include "io/channel-buffer.h"
>> #include "io/channel-file.h"
>> +#include "migration/colo.h"
>>
>> #ifndef ETH_P_RARP
>> #define ETH_P_RARP 0x8035
>> @@ -1279,13 +1280,21 @@ done:
>> return ret;
>> }
>>
>> -static int qemu_save_device_state(QEMUFile *f)
>> +void qemu_savevm_live_state(QEMUFile *f)
>> {
>> - SaveStateEntry *se;
>> + /* save QEMU_VM_SECTION_END section */
>> + qemu_savevm_state_complete_precopy(f, true);
>> + qemu_put_byte(f, QEMU_VM_EOF);
>> +}
>>
>> - qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
>> - qemu_put_be32(f, QEMU_VM_FILE_VERSION);
>> +int qemu_save_device_state(QEMUFile *f)
>> +{
>> + SaveStateEntry *se;
>>
>> + if (!migration_in_colo_state()) {
>> + qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
>> + qemu_put_be32(f, QEMU_VM_FILE_VERSION);
>> + }
> Note that got split out into qemu_savevm_state_header() at some point.
Do you mean i should use the wrapper qemu_savevm_state_heade() here ?
> Dave
>
>> cpu_synchronize_all_states();
>>
>> QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
>> @@ -1336,8 +1345,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
>> @@ -1942,7 +1949,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 = 0;
>> @@ -2080,6 +2087,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;
>> +}
>> +
>> int save_vmstate(Monitor *mon, const char *name)
>> {
>> BlockDriverState *bs, *bs1;
>> --
>> 1.8.3.1
>>
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
> .
>
next prev parent reply other threads:[~2017-04-10 8:27 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-22 3:42 [Qemu-devel] [PATCH 00/15] COLO: integrate colo frame with block replication and net compare zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 01/15] net/colo: Add notifier/callback related helpers for filter zhanghailiang
2017-04-07 15:46 ` Dr. David Alan Gilbert
2017-04-10 7:26 ` Hailiang Zhang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 02/15] colo-compare: implement the process of checkpoint zhanghailiang
2017-02-22 9:31 ` Zhang Chen
2017-02-23 1:02 ` Hailiang Zhang
2017-02-23 5:49 ` Zhang Chen
2017-04-14 5:57 ` Jason Wang
2017-04-14 6:22 ` Hailiang Zhang
2017-04-14 6:38 ` Jason Wang
2017-04-17 11:04 ` Hailiang Zhang
2017-04-18 1:32 ` Zhang Chen
2017-04-18 3:55 ` Jason Wang
2017-04-18 6:58 ` Hailiang Zhang
2017-04-20 5:15 ` Jason Wang
2017-04-21 8:10 ` Hailiang Zhang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 03/15] colo-compare: use notifier to notify packets comparing result zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 04/15] COLO: integrate colo compare with colo frame zhanghailiang
2017-04-07 15:59 ` Dr. David Alan Gilbert
2017-02-22 3:42 ` [Qemu-devel] [PATCH 05/15] COLO: Handle shutdown command for VM in COLO state zhanghailiang
2017-02-22 15:35 ` Eric Blake
2017-02-23 1:15 ` Hailiang Zhang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 06/15] COLO: Add block replication into colo process zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 07/15] COLO: Load PVM's dirty pages into SVM's RAM cache temporarily zhanghailiang
2017-04-07 17:06 ` Dr. David Alan Gilbert
2017-04-10 7:31 ` Hailiang Zhang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 08/15] ram/COLO: Record the dirty pages that SVM received zhanghailiang
2017-02-23 18:44 ` Dr. David Alan Gilbert
2017-02-22 3:42 ` [Qemu-devel] [PATCH 09/15] COLO: Flush PVM's cached RAM into SVM's memory zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 10/15] qmp event: Add COLO_EXIT event to notify users while exited from COLO zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 11/15] savevm: split save/find loadvm_handlers entry into two helper functions zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 12/15] savevm: split the process of different stages for loadvm/savevm zhanghailiang
2017-04-07 17:18 ` Dr. David Alan Gilbert
2017-04-10 8:26 ` Hailiang Zhang [this message]
2017-04-20 9:09 ` Dr. David Alan Gilbert
2017-04-21 6:50 ` Hailiang Zhang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 13/15] COLO: Separate the process of saving/loading ram and device state zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 14/15] COLO: Split qemu_savevm_state_begin out of checkpoint process zhanghailiang
2017-02-22 3:42 ` [Qemu-devel] [PATCH 15/15] COLO: flush host dirty ram from cache zhanghailiang
2017-04-07 17:39 ` Dr. David Alan Gilbert
2017-04-10 7:13 ` Hailiang Zhang
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=58EB41C0.5060203@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=dgilbert@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=xiecl.fnst@cn.fujitsu.com \
--cc=zhangchen.fnst@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).