All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
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
Subject: Re: [Qemu-devel] [PATCH COLO-Frame v10 14/38] COLO: Load VMState into qsb before restore it
Date: Mon, 16 Nov 2015 16:46:03 +0800	[thread overview]
Message-ID: <564997CB.9050107@huawei.com> (raw)
In-Reply-To: <20151113160231.GK2456@work-vm>

On 2015/11/14 0:02, Dr. David Alan Gilbert wrote:
> * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote:
>> We should not destroy the state of SVM (Secondary VM) until we receive the whole
>> state from the PVM (Primary VM), in case the primary fails in the middle of sending
>> the state, so, here we cache the device state in Secondary before restore it.
>>
>> Besides, we should call qemu_system_reset() before load VM state,
>> which can ensure the data is intact.
>>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> ---
>>   migration/colo.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 46 insertions(+), 1 deletion(-)
>>
>> diff --git a/migration/colo.c b/migration/colo.c
>> index 25f85b2..1339774 100644
>> --- a/migration/colo.c
>> +++ b/migration/colo.c
>> @@ -287,6 +287,9 @@ static int colo_wait_handle_cmd(QEMUFile *f, int *checkpoint_request)
>>   void *colo_process_incoming_thread(void *opaque)
>>   {
>>       MigrationIncomingState *mis = opaque;
>> +    QEMUFile *fb = NULL;
>> +    QEMUSizedBuffer *buffer = NULL; /* Cache incoming device state */
>> +    int  total_size;
>>       int fd, ret = 0;
>>
>>       migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
>> @@ -310,6 +313,12 @@ void *colo_process_incoming_thread(void *opaque)
>>           goto out;
>>       }
>>
>> +    buffer = qsb_create(NULL, COLO_BUFFER_BASE_SIZE);
>> +    if (buffer == NULL) {
>> +        error_report("Failed to allocate colo buffer!");
>> +        goto out;
>> +    }
>> +
>>       ret = colo_ctl_put(mis->to_src_file, COLO_COMMAND_CHECKPOINT_READY, 0);
>>       if (ret < 0) {
>>           goto out;
>> @@ -337,19 +346,50 @@ void *colo_process_incoming_thread(void *opaque)
>>               goto out;
>>           }
>>
>> -        /* TODO Load VM state */
>> +        /* read the VM state total size first */
>> +        total_size = colo_ctl_get(mis->from_src_file,
>> +                                  COLO_COMMAND_VMSTATE_SIZE);
>> +        if (total_size <= 0) {
>
> Error message?
>

OK, we need one.

>> +            goto out;
>> +        }
>
> OK, and when you fix up the colo_ctl_get in the previous patch to
> take a separate pointer for value, you can make total_size a size_t.
>

Yes, i have updated it after addressing your review comment on patch 11.

>
> Other than those, it looks good.
>

Thanks.

> Dave
>
>> +        /* read vm device state into colo buffer */
>> +        ret = qsb_fill_buffer(buffer, mis->from_src_file, total_size);
>> +        if (ret != total_size) {
>> +            error_report("can't get all migration data");
>> +            goto out;
>> +        }
>>
>>           ret = colo_ctl_put(mis->to_src_file, COLO_COMMAND_VMSTATE_RECEIVED, 0);
>>           if (ret < 0) {
>>               goto out;
>>           }
>>
>> +        /* open colo buffer for read */
>> +        fb = qemu_bufopen("r", buffer);
>> +        if (!fb) {
>> +            error_report("can't open colo buffer for read");
>> +            goto out;
>> +        }
>> +
>> +        qemu_mutex_lock_iothread();
>> +        qemu_system_reset(VMRESET_SILENT);
>> +        if (qemu_loadvm_state(fb) < 0) {
>> +            error_report("COLO: loadvm failed");
>> +            qemu_mutex_unlock_iothread();
>> +            goto out;
>> +        }
>> +        qemu_mutex_unlock_iothread();
>> +
>>           /* TODO: flush vm state */
>>
>>           ret = colo_ctl_put(mis->to_src_file, COLO_COMMAND_VMSTATE_LOADED, 0);
>>           if (ret < 0) {
>>               goto out;
>>           }
>> +
>> +        qemu_fclose(fb);
>> +        fb = NULL;
>>       }
>>
>>   out:
>> @@ -358,6 +398,11 @@ out:
>>                        strerror(-ret));
>>       }
>>
>> +    if (fb) {
>> +        qemu_fclose(fb);
>> +    }
>> +    qsb_free(buffer);
>> +
>>       qemu_mutex_lock_iothread();
>>       colo_release_ram_cache();
>>       qemu_mutex_unlock_iothread();
>> --
>> 1.8.3.1
>>
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
> .
>

  reply	other threads:[~2015-11-16  9:09 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 11:56 [Qemu-devel] [PATCH COLO-Frame v10 00/38] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 01/38] configure: Add parameter for configure to enable/disable COLO support zhanghailiang
2015-11-05 14:52   ` Eric Blake
2015-11-06  7:36     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 02/38] migration: Introduce capability 'x-colo' to migration zhanghailiang
2015-11-13 16:01   ` Eric Blake
2015-11-16  8:35     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 03/38] COLO: migrate colo related info to secondary node zhanghailiang
2015-11-06 16:36   ` Dr. David Alan Gilbert
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 04/38] migration: Add state records for migration incoming zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 05/38] migration: Integrate COLO checkpoint process into migration zhanghailiang
2015-11-06 16:48   ` Dr. David Alan Gilbert
2015-11-13 16:42   ` Eric Blake
2015-11-16 13:00     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 06/38] migration: Integrate COLO checkpoint process into loadvm zhanghailiang
2015-11-06 17:29   ` Dr. David Alan Gilbert
2015-11-09  6:09     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 07/38] migration: Rename the'file' member of MigrationState and MigrationIncomingState zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 08/38] COLO/migration: establish a new communication path from destination to source zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 09/38] COLO: Implement colo checkpoint protocol zhanghailiang
2015-11-06 18:26   ` Dr. David Alan Gilbert
2015-11-09  6:51     ` zhanghailiang
2015-11-09  7:33       ` zhanghailiang
2015-11-13 16:46   ` Eric Blake
2015-11-17  7:04     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 10/38] COLO: Add a new RunState RUN_STATE_COLO zhanghailiang
2015-11-06 18:28   ` Dr. David Alan Gilbert
2015-11-13 16:47   ` Eric Blake
2015-11-17  7:15     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 11/38] QEMUSizedBuffer: Introduce two help functions for qsb zhanghailiang
2015-11-06 18:30   ` Dr. David Alan Gilbert
2015-11-09  8:14     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 12/38] COLO: Save PVM state to secondary side when do checkpoint zhanghailiang
2015-11-06 18:59   ` Dr. David Alan Gilbert
2015-11-09  9:17     ` zhanghailiang
2015-11-13 18:53       ` Dr. David Alan Gilbert
2015-11-17 10:20         ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 13/38] COLO: Load PVM's dirty pages into SVM's RAM cache temporarily zhanghailiang
2015-11-13 15:39   ` Dr. David Alan Gilbert
2015-11-16  7:57     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 14/38] COLO: Load VMState into qsb before restore it zhanghailiang
2015-11-13 16:02   ` Dr. David Alan Gilbert
2015-11-16  8:46     ` zhanghailiang [this message]
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 15/38] ram/COLO: Record pages received from PVM by re-using migration dirty bitmap zhanghailiang
2015-11-13 16:19   ` Dr. David Alan Gilbert
2015-11-16  9:07     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 16/38] COLO: Flush PVM's cached RAM into SVM's memory zhanghailiang
2015-11-13 16:38   ` Dr. David Alan Gilbert
2015-11-16 12:46     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 17/38] COLO: synchronize PVM's state to SVM periodically zhanghailiang
2015-11-13 18:34   ` Dr. David Alan Gilbert
2015-11-17  9:11     ` zhanghailiang
2015-11-17 10:08       ` Dr. David Alan Gilbert
2015-11-17 10:29         ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 18/38] COLO failover: Introduce a new command to trigger a failover zhanghailiang
2015-11-13 16:59   ` Eric Blake
2015-11-17  8:03     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 19/38] COLO failover: Introduce state to record failover process zhanghailiang
2015-11-20 15:51   ` Dr. David Alan Gilbert
2015-11-23  5:56     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 20/38] COLO: Implement failover work for Primary VM zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 21/38] COLO: Implement failover work for Secondary VM zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 22/38] COLO: implement default failover treatment zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 23/38] qmp event: Add event notification for COLO error zhanghailiang
2015-11-20 21:50   ` Eric Blake
2015-11-23  6:01     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 24/38] COLO failover: Shutdown related socket fd when do failover zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 25/38] COLO failover: Don't do failover during loading VM's state zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 26/38] COLO: Control the checkpoint delay time by migrate-set-parameters command zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 27/38] COLO: Process shutdown command for VM in COLO state zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 28/38] COLO: Update the global runstate after going into colo state zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 29/38] savevm: Split load vm state function qemu_loadvm_state zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 30/38] COLO: Separate the process of saving/loading ram and device state zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 31/38] COLO: Split qemu_savevm_state_begin out of checkpoint process zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 32/38] netfilter: Add a public API to release all the buffered packets zhanghailiang
2015-11-03 12:39   ` Yang Hongyang
2015-11-03 13:19     ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 33/38] netfilter: Introduce an API to delete the timer of all buffer-filters zhanghailiang
2015-11-03 12:41   ` Yang Hongyang
2015-11-03 13:07     ` zhanghailiang
2015-11-04  2:51       ` Jason Wang
2015-11-04  3:08         ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 34/38] filter-buffer: Accept zero interval zhanghailiang
2015-11-03 12:43   ` Yang Hongyang
2015-11-04  2:52     ` Jason Wang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 35/38] netfilter: Introduce a API to automatically add filter-buffer for each netdev zhanghailiang
2015-11-03 12:57   ` Yang Hongyang
2015-11-03 13:16     ` zhanghailiang
2015-11-04  2:56   ` Jason Wang
2015-11-04  3:07     ` zhanghailiang
2015-11-05  7:43     ` zhanghailiang
2015-11-05  8:52       ` Wen Congyang
2015-11-05  9:21         ` Jason Wang
2015-11-05  9:33           ` Wen Congyang
2015-11-05  9:19       ` Jason Wang
2015-11-05 10:58         ` zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 36/38] netfilter: Introduce an API to delete all the automatically added netfilters zhanghailiang
2015-11-03 12:58   ` Yang Hongyang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 37/38] colo: Use the netfilter to buffer and release packets zhanghailiang
2015-11-03 11:56 ` [Qemu-devel] [PATCH COLO-Frame v10 38/38] COLO: Add block replication into colo process zhanghailiang

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=564997CB.9050107@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=dgilbert@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=yunhong.jiang@intel.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 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.