All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
	wency@cn.fujitsu.com, ian.jackson@eu.citrix.com,
	yunhong.jiang@intel.com, eddie.dong@intel.com,
	guijianfeng@cn.fujitsu.com, rshriram@cs.ubc.ca
Subject: Re: [PATCH Remus v3 1/3] libxc/save: implement Remus checkpointed save
Date: Thu, 14 May 2015 09:08:47 +0800	[thread overview]
Message-ID: <5553F59F.7020304@cn.fujitsu.com> (raw)
In-Reply-To: <55536A3C.80808@citrix.com>



On 05/13/2015 11:14 PM, Andrew Cooper wrote:
> On 13/05/15 09:34, Yang Hongyang wrote:
>> With Remus, the save flow should be:
>> live migration->{ periodically save(checkpointed save) }
>>
>> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
>> CC: Ian Campbell <Ian.Campbell@citrix.com>
>> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
>> CC: Wei Liu <wei.liu2@citrix.com>
>> CC: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>>   tools/libxc/xc_sr_save.c | 73 +++++++++++++++++++++++++++++++++++-------------
>>   1 file changed, 54 insertions(+), 19 deletions(-)
>>
>> diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
>> index 1d0a46d..3890c4d 100644
>> --- a/tools/libxc/xc_sr_save.c
>> +++ b/tools/libxc/xc_sr_save.c
>> @@ -57,6 +57,16 @@ static int write_end_record(struct xc_sr_context *ctx)
>>   }
>>
>>   /*
>> + * Writes an CHECKPOINT record into the stream.
>> + */
>> +static int write_checkpoint_record(struct xc_sr_context *ctx)
>> +{
>> +    struct xc_sr_record checkpoint = { REC_TYPE_CHECKPOINT, 0, NULL };
>> +
>> +    return write_record(ctx, &checkpoint);
>> +}
>> +
>> +/*
>>    * Writes a batch of memory as a PAGE_DATA record into the stream.  The batch
>>    * is constructed in ctx->save.batch_pfns.
>>    *
>> @@ -467,6 +477,9 @@ static int send_domain_memory_live(struct xc_sr_context *ctx)
>>       DECLARE_HYPERCALL_BUFFER_SHADOW(unsigned long, dirty_bitmap,
>>                                       &ctx->save.dirty_bitmap_hbuf);
>>
>> +    if ( !ctx->save.live )
>> +        goto last_iter;
>> +
>
> I really want to avoid this code getting into the same spiders web as it
> used to be with goto, but I cannot suggest a better alternative.
>
> However, please leave a comment explaining that subsequent checkpointed
> loop skip the live part and pause straight away.

OK

>
>>       rc = enable_logdirty(ctx);
>>       if ( rc )
>>           goto out;
>> @@ -505,6 +518,7 @@ static int send_domain_memory_live(struct xc_sr_context *ctx)
>>               goto out;
>>       }
>>
>> + last_iter:
>>       rc = suspend_domain(ctx);
>>       if ( rc )
>>           goto out;
>> @@ -667,29 +681,50 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)
>>       if ( rc )
>>           goto err;
>>
>> -    rc = ctx->save.ops.start_of_checkpoint(ctx);
>> -    if ( rc )
>> -        goto err;
>> +    do {
>> +        rc = ctx->save.ops.start_of_checkpoint(ctx);
>> +        if ( rc )
>> +            goto err;
>>
>> -    if ( ctx->save.live )
>> -        rc = send_domain_memory_live(ctx);
>> -    else
>> -        rc = send_domain_memory_nonlive(ctx);
>> +        if ( ctx->save.live || ctx->save.checkpointed )
>> +            rc = send_domain_memory_live(ctx);
>> +        else
>> +            rc = send_domain_memory_nonlive(ctx);
>>
>> -    if ( rc )
>> -        goto err;
>> +        if ( rc )
>> +            goto err;
>>
>> -    if ( !ctx->dominfo.shutdown ||
>> -         (ctx->dominfo.shutdown_reason != SHUTDOWN_suspend) )
>> -    {
>> -        ERROR("Domain has not been suspended");
>> -        rc = -1;
>> -        goto err;
>> -    }
>> +        if ( !ctx->dominfo.shutdown ||
>> +            (ctx->dominfo.shutdown_reason != SHUTDOWN_suspend) )
>> +        {
>> +            ERROR("Domain has not been suspended");
>> +            rc = -1;
>> +            goto err;
>> +        }
>>
>> -    rc = ctx->save.ops.end_of_checkpoint(ctx);
>> -    if ( rc )
>> -        goto err;
>> +        rc = ctx->save.ops.end_of_checkpoint(ctx);
>> +        if ( rc )
>> +            goto err;
>> +
>> +        if ( ctx->save.checkpointed ) {
>> +            if ( ctx->save.live ) {
>
> Coding style.  libxc is admittedly inconsistent, but follows hypervisor
> style, so { on the next line.

OK

>
>> +                /* End of live migration, we are sending checkpointed stream */
>> +                ctx->save.live = false;
>> +            }
>> +
>> +            rc = write_checkpoint_record(ctx);
>> +            if ( rc )
>> +                goto err;
>> +
>> +            ctx->save.callbacks->postcopy(ctx->save.callbacks->data);
>> +
>> +            rc = ctx->save.callbacks->checkpoint(ctx->save.callbacks->data);
>> +            if ( rc > 0 )
>> +                IPRINTF("Checkpointed save");
>
> This should probably be progress information , so
> xc_report_progress_single()

Will fix.

>
> Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> (I think this code is a bit of an improvement over xc_domain_save.c)
>
>> +            else
>> +                ctx->save.checkpointed = false;
>> +        }
>> +    } while ( ctx->save.checkpointed );
>>
>>       xc_report_progress_single(xch, "End of stream");
>>
>
> .
>

-- 
Thanks,
Yang.

  reply	other threads:[~2015-05-14  1:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13  8:34 [PATCH Remus v3 0/3] Remus support for Migration-v2 Yang Hongyang
2015-05-13  8:34 ` [PATCH Remus v3 1/3] libxc/save: implement Remus checkpointed save Yang Hongyang
2015-05-13 15:14   ` Andrew Cooper
2015-05-14  1:08     ` Yang Hongyang [this message]
2015-05-13  8:35 ` [PATCH Remus v3 2/3] libxc/restore: add checkpointed flag to the restore context Yang Hongyang
2015-05-13 15:15   ` Andrew Cooper
2015-05-14  1:09     ` Yang Hongyang
2015-05-14  7:18       ` Andrew Cooper
2015-05-13  8:35 ` [PATCH Remus v3 3/3] libxc/restore: implement Remus checkpointed restore Yang Hongyang
2015-05-13 16:16   ` Andrew Cooper
2015-05-13 16:38     ` Andrew Cooper
2015-05-14  5:42     ` Yang Hongyang
2015-05-14  7:19       ` Andrew Cooper

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=5553F59F.7020304@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=eddie.dong@intel.com \
    --cc=guijianfeng@cn.fujitsu.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=rshriram@cs.ubc.ca \
    --cc=wei.liu2@citrix.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xen-devel@lists.xen.org \
    --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.