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>,
	Yang Hongyang <yanghy@cn.fujitsu.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 3/6] libxc/migration: Be rather stricter with illformed callers
Date: Mon, 11 May 2015 12:57:06 +0100	[thread overview]
Message-ID: <1431345426.8263.39.camel@citrix.com> (raw)
In-Reply-To: <555096E8.3050800@citrix.com>

On Mon, 2015-05-11 at 12:47 +0100, Andrew Cooper wrote:
> On 11/05/15 12:33, Ian Campbell wrote:
> > On Fri, 2015-05-08 at 22:14 +0100, Andrew Cooper wrote:
> >> The migration code itself should be able to validly assume all mandatory
> >> callbacks are set up.
> >>
> >> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> >> CC: Ian Campbell <Ian.Campbell@citrix.com>
> >> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> >> CC: Wei Liu <wei.liu2@citrix.com>
> >> CC: Yang Hongyang <yanghy@cn.fujitsu.com>
> >> ---
> >>  tools/libxc/xc_sr_save.c         |    4 ++++
> >>  tools/libxc/xc_sr_save_x86_hvm.c |    7 -------
> >>  2 files changed, 4 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
> >> index 5d9c267..83f0591 100644
> >> --- a/tools/libxc/xc_sr_save.c
> >> +++ b/tools/libxc/xc_sr_save.c
> >> @@ -738,6 +738,10 @@ int xc_domain_save2(xc_interface *xch, int io_fd, uint32_t dom,
> >>      ctx.save.max_iterations = 5;
> >>      ctx.save.dirty_threshold = 50;
> >>  
> >> +    /* Sanity checks for callbacks. */
> >> +    if ( hvm )
> >> +        assert(callbacks->switch_qemu_logdirty);
> > assert(!hvm || callbacks->switch_qemu_logdirty)
> >
> > ?
> 
> I would argue that the former is far easier to read.

I read this as "assert that either the guest is not an  hvm guest or the
callback is provided", but fair enough.

> The intention for this, and a subsequent patch, is "if (some option)
> assert(mandatory callbacks for option)"
> 
> ~Andrew
> 
> >
> >> +
> >>      IPRINTF("In experimental %s", __func__);
> >>      DPRINTF("fd %d, dom %u, max_iters %u, max_factor %u, flags %u, hvm %d",
> >>              io_fd, dom, max_iters, max_factor, flags, hvm);
> >> diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c
> >> index 8baa104..58efdb9 100644
> >> --- a/tools/libxc/xc_sr_save_x86_hvm.c
> >> +++ b/tools/libxc/xc_sr_save_x86_hvm.c
> >> @@ -166,13 +166,6 @@ static int x86_hvm_setup(struct xc_sr_context *ctx)
> >>  {
> >>      xc_interface *xch = ctx->xch;
> >>  
> >> -    if ( !ctx->save.callbacks->switch_qemu_logdirty )
> >> -    {
> >> -        ERROR("No switch_qemu_logdirty callback provided");
> >> -        errno = EINVAL;
> >> -        return -1;
> >> -    }
> >> -
> >>      if ( ctx->save.callbacks->switch_qemu_logdirty(
> >>               ctx->domid, 1, ctx->save.callbacks->data) )
> >>      {
> >
> 

  reply	other threads:[~2015-05-11 11:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 21:14 [PATCH v2 0/6] Misc patches to aid migration v2 Remus support Andrew Cooper
2015-05-08 21:14 ` [PATCH v2 1/6] xen/hvm: Permit HVM_PARAM_IDENT_PT to be set more than once Andrew Cooper
2015-05-11  7:51   ` Hongyang Yang
2015-05-11  8:00     ` Andrew Cooper
2015-05-11  8:06       ` Hongyang Yang
2015-05-08 21:14 ` [PATCH v2 2/6] libxc/restore: Bail if unknown options are found Andrew Cooper
2015-05-11  9:23   ` David Vrabel
2015-05-11 10:44     ` David Vrabel
2015-05-11 10:43   ` David Vrabel
2015-05-08 21:14 ` [PATCH v2 3/6] libxc/migration: Be rather stricter with illformed callers Andrew Cooper
2015-05-11 11:33   ` Ian Campbell
2015-05-11 11:47     ` Andrew Cooper
2015-05-11 11:57       ` Ian Campbell [this message]
2015-05-08 21:14 ` [PATCH v2 4/6] libxc/save: Adjust stream-position callbacks for checkpointed streams Andrew Cooper
2015-05-11 11:36   ` Ian Campbell
2015-05-11 11:56     ` Andrew Cooper
2015-05-11 12:05       ` Ian Campbell
2015-05-11 12:06         ` Andrew Cooper
2015-05-08 21:14 ` [PATCH v2 5/6] tools/migration: Specification update for 'checkpointed' flag Andrew Cooper
2015-05-08 21:14 ` [PATCH v2 6/6] libxc/migration: Specification update for CHECKPOINT records 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=1431345426.8263.39.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 \
    --cc=yanghy@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 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.