From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v3 6/6] [RFC] [INCOMPLETE] libxc/restore: Remus
Date: Tue, 12 May 2015 17:56:38 +0800 [thread overview]
Message-ID: <5551CE56.2020400@cn.fujitsu.com> (raw)
In-Reply-To: <1431423351-27424-7-git-send-email-andrew.cooper3@citrix.com>
I will try to implement the restore side as you proposed. The save side
was a single do{}while loop already. I use ctx.save.live to differentiate
the two phases.
On 05/12/2015 05:35 PM, Andrew Cooper wrote:
> Some basic infrastructure.
>
> CC: Yang Hongyang <yanghy@cn.fujitsu.com>
>
> ---
>
> I started attempting to explain this in text, but concluded that pseudocode
> would be easier.
>
> My design for the restore side handling was always based around a single "do {
> } while ( not end )" loop, and specifically not to split into two phases.
>
> If I have interpreted your restore patch correctly, then this should be
> plausible way to avoid splitting into two phases. Please feel free to modify
> to suit.
>
> If at all possible, I would like to see about simiarly not splitting the save
> side into multiple phases, but that is proving far harder, and it is probably
> worth waiting for another iteration with current improvements integrated.
> ---
> tools/libxc/xc_sr_common.h | 6 ++++++
> tools/libxc/xc_sr_restore.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 40 insertions(+)
>
> diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
> index c0f90d4..116c89b 100644
> --- a/tools/libxc/xc_sr_common.h
> +++ b/tools/libxc/xc_sr_common.h
> @@ -219,6 +219,12 @@ struct xc_sr_context
>
> /* Sender has invoked verify mode on the stream. */
> bool verify;
> +
> + /* Expecting a checkpointed stream? */
> + bool checkpointed;
> +
> + /* Currently buffering records between a checkpoints? */
> + bool buffer_all_records;
> } restore;
> };
>
> diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
> index 53bd674..7a124bd 100644
> --- a/tools/libxc/xc_sr_restore.c
> +++ b/tools/libxc/xc_sr_restore.c
> @@ -468,11 +468,40 @@ static int handle_page_data(struct xc_sr_context *ctx, struct xc_sr_record *rec)
> return rc;
> }
>
> +static int handle_checkpoint(struct xc_sr_context *ctx)
> +{
> + xc_interface *xch = ctx->xch;
> + int rc = 0;
> +
> + if ( !ctx->restore.checkpointed )
> + {
> + ERROR("Found checkpoint in non-checkpointed stream\n");
> + return -1;
> + }
> +
> + if ( ctx->restore.buffer_all_records )
> + {
> + /* TODO drain buffer */
> + }
> + else
> + ctx->restore.buffer_all_records = 1;
> +
> + return rc;
> +}
> +
> static int process_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
> {
> xc_interface *xch = ctx->xch;
> int rc = 0;
>
> + if ( ctx->restore.buffer_all_records &&
> + rec->type != REC_TYPE_END &&
> + rec->type != REC_TYPE_CHECKPOINT )
> + {
> + /* TODO: copy into buffer */
> + return 0;
> + }
> +
> switch ( rec->type )
> {
> case REC_TYPE_END:
> @@ -487,6 +516,10 @@ static int process_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
> ctx->restore.verify = true;
> break;
>
> + case REC_TYPE_CHECKPOINT:
> + rc = handle_checkpoint(ctx);
> + break;
> +
> default:
> rc = ctx->restore.ops.process_record(ctx, rec);
> break;
> @@ -592,6 +625,7 @@ int xc_domain_restore2(xc_interface *xch, int io_fd, uint32_t dom,
> ctx.restore.console_domid = console_domid;
> ctx.restore.xenstore_evtchn = store_evtchn;
> ctx.restore.xenstore_domid = store_domid;
> + ctx.restore.checkpointed = checkpointed_stream;
> ctx.restore.callbacks = callbacks;
>
> IPRINTF("In experimental %s", __func__);
>
--
Thanks,
Yang.
prev parent reply other threads:[~2015-05-12 9:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 9:35 [PATCH v3 0/6] Misc patches to aid migration v2 Remus support Andrew Cooper
2015-05-12 9:35 ` [PATCH v3 1/6] libxc/migration: Be rather stricter with illformed callers Andrew Cooper
2015-05-12 9:35 ` [PATCH v3 2/6] libxc/save: Adjust stream-position callbacks for checkpointed streams Andrew Cooper
2015-05-13 10:09 ` George Dunlap
2015-05-13 10:23 ` Andrew Cooper
2015-05-13 10:33 ` George Dunlap
2015-05-12 9:35 ` [PATCH v3 3/6] libxc/migration: Specification update for CHECKPOINT records Andrew Cooper
2015-05-12 9:44 ` Yang Hongyang
2015-05-12 9:54 ` David Vrabel
2015-05-12 10:49 ` Yang Hongyang
2015-05-12 10:53 ` Andrew Cooper
2015-05-12 9:35 ` [PATCH v3 4/6] tools/libxc: introduce process_record() Andrew Cooper
2015-05-12 9:35 ` [PATCH v3 5/6] libxc/migration: Pass checkpoint information into the save algorithm Andrew Cooper
2015-05-12 9:35 ` [PATCH v3 6/6] [RFC] [INCOMPLETE] libxc/restore: Remus Andrew Cooper
2015-05-12 9:56 ` Yang Hongyang [this message]
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=5551CE56.2020400@cn.fujitsu.com \
--to=yanghy@cn.fujitsu.com \
--cc=andrew.cooper3@citrix.com \
--cc=xen-devel@lists.xen.org \
/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.