All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v9 09/15] tools/libxc: x86 PV restore code
Date: Wed, 15 Apr 2015 12:22:24 +0100	[thread overview]
Message-ID: <1429096944.15516.210.camel@citrix.com> (raw)
In-Reply-To: <1428686167-8279-10-git-send-email-andrew.cooper3@citrix.com>

On Fri, 2015-04-10 at 18:16 +0100, Andrew Cooper wrote:
> Restore the x86 PV specific parts.  The X86_PV_INFO, the P2M_FRAMES,
> +/*
> + * Set a pfn as populated, expanding the tracking structures if needed. To
> + * avoid realloc()ing too excessivly, the size increased to the nearest power

excessively.

> +/*
> + * Update details in a guests start_info strucutre.

structure.

> +/*
> + * Processes X86_PV_VCPU_{BASIC,EXTENDED,XSAVE,MSRS} records from the stream.
> + * The blobs are all stashed to one side as they need to be defered until the

deferred.

> + * very end of the stream, rather than being send to Xen at the point they
> + * arive in the stream.  It performs all pre-hypercall size validation.

arrive.

> + */
> +static int handle_x86_pv_vcpu_blob(struct xc_sr_context *ctx,
> +                                   struct xc_sr_record *rec)
> +{
> +    xc_interface *xch = ctx->xch;
> +    struct xc_sr_rec_x86_pv_vcpu_hdr *vhdr = rec->data;
> +    struct xc_sr_x86_pv_restore_vcpu *vcpu;
> +    const char *rec_name;
> +    size_t blobsz;
> +    void *blob;
> +    int rc = -1;
> +
> +    switch ( rec->type )
> +    {
> +#define RECNAME(x, y) case (x): rec_name = (y) ; break
> +        RECNAME(REC_TYPE_X86_PV_VCPU_BASIC,    "X86_PV_VCPU_BASIC");
> +        RECNAME(REC_TYPE_X86_PV_VCPU_EXTENDED, "X86_PV_VCPU_EXTENDED");
> +        RECNAME(REC_TYPE_X86_PV_VCPU_XSAVE,    "X86_PV_VCPU_XSAVE");
> +        RECNAME(REC_TYPE_X86_PV_VCPU_MSRS,     "X86_PV_VCPU_MSRS");
> +#undef RECNAME

I can see the point of STOREREC below but not this one unless you were
to use cpp pasting to add the REC_TYPE_ prefix to a single argument.
Otherwise the macro invocation doesn't seem to actually be any terser
than the expansion.

> +    default:
> +        ERROR("Unrecogised vcpu blob record %s (%u)",

Unrecognised.

> +#define RECSTORE(x, y) case (x): free(y); (y) = blob; (y ## sz) = blobsz; break
> +        RECSTORE(REC_TYPE_X86_PV_VCPU_BASIC,    vcpu->basic);
> +        RECSTORE(REC_TYPE_X86_PV_VCPU_EXTENDED, vcpu->extd);
> +        RECSTORE(REC_TYPE_X86_PV_VCPU_XSAVE,    vcpu->xsave);
> +        RECSTORE(REC_TYPE_X86_PV_VCPU_MSRS,     vcpu->msr);

Could optionally move some of the prefix of the first argument into the
macro too.

Ian.

  reply	other threads:[~2015-04-15 11:22 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 17:15 [PATCH v9 00/15] Migration v2 (libxc) Andrew Cooper
2015-04-10 17:15 ` [PATCH v9 01/15] tools/libxc: Implement writev_exact() in the same style as write_exact() Andrew Cooper
2015-04-15 10:44   ` Ian Campbell
2015-04-10 17:15 ` [PATCH v9 02/15] libxc/progress: Extend the progress interface Andrew Cooper
2015-04-15 10:55   ` Ian Campbell
2015-04-20 13:15     ` Andrew Cooper
2015-04-22 15:38       ` Ian Campbell
2015-04-10 17:15 ` [PATCH v9 03/15] tools/libxc: Migration v2 framework Andrew Cooper
2015-04-15 10:57   ` Ian Campbell
2015-04-10 17:15 ` [PATCH v9 04/15] tools/libxc: C implementation of stream format Andrew Cooper
2015-04-15 10:59   ` Ian Campbell
2015-04-10 17:15 ` [PATCH v9 05/15] tools/libxc: noarch common code Andrew Cooper
2015-04-15 11:00   ` Ian Campbell
2015-04-10 17:15 ` [PATCH v9 06/15] tools/libxc: x86 " Andrew Cooper
2015-04-10 17:15 ` [PATCH v9 07/15] tools/libxc: x86 PV " Andrew Cooper
2015-04-15 11:07   ` Ian Campbell
2015-04-10 17:16 ` [PATCH v9 08/15] tools/libxc: x86 PV save code Andrew Cooper
2015-04-15 11:13   ` Ian Campbell
2015-04-15 11:41     ` Andrew Cooper
2015-04-15 11:52       ` Ian Campbell
2015-04-10 17:16 ` [PATCH v9 09/15] tools/libxc: x86 PV restore code Andrew Cooper
2015-04-15 11:22   ` Ian Campbell [this message]
2015-04-10 17:16 ` [PATCH v9 10/15] tools/libxc: x86 HVM save code Andrew Cooper
2015-04-13 12:28   ` Vitaly Kuznetsov
2015-04-13 13:21     ` Andrew Cooper
2015-04-15 11:29       ` Ian Campbell
2015-04-15 11:30   ` Ian Campbell
2015-04-10 17:16 ` [PATCH v9 11/15] tools/libxc: x86 HVM restore code Andrew Cooper
2015-04-15 11:31   ` Ian Campbell
2015-04-10 17:16 ` [PATCH v9 12/15] tools/libxc: noarch save code Andrew Cooper
2015-04-15 11:34   ` Ian Campbell
2015-04-10 17:16 ` [PATCH v9 13/15] tools/libxc: noarch restore code Andrew Cooper
2015-04-15 11:42   ` Ian Campbell
2015-04-15 11:50     ` Andrew Cooper
2015-04-15 11:53       ` Ian Campbell
2015-04-10 17:16 ` [PATCH v9 14/15] docs: libxc migration stream specification Andrew Cooper
2015-04-15 11:46   ` Ian Campbell
2015-04-15 12:05     ` Andrew Cooper
2015-04-15 12:11       ` Ian Campbell
2015-04-15 12:02   ` David Vrabel
2015-04-15 12:09     ` Andrew Cooper
2015-04-10 17:16 ` [PATCH v9 15/15] tools/libxc: Migration v2 compatibility for unmodified libxl Andrew Cooper
2015-04-15 11:51   ` Ian Campbell
2015-04-15 12:14     ` Andrew Cooper
2015-04-15 12:52       ` Ian Campbell

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=1429096944.15516.210.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=wei.liu2@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.