All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/5] xc/tmem: Unchecked return value.
Date: Mon, 25 Nov 2013 14:53:27 -0500	[thread overview]
Message-ID: <20131125195327.GD3339@phenom.dumpdata.com> (raw)
In-Reply-To: <529384C3.3070101@citrix.com>

On Mon, Nov 25, 2013 at 05:11:31PM +0000, Andrew Cooper wrote:
> On 25/11/13 17:00, Konrad Rzeszutek Wilk wrote:
> > CID 1055045 complains that the return value needs checking.
> >
> > The tmem op is a flush call and there is no expectation
> > right now of any return besides zero. But just in case
> > this changes lets blow up.
> >
> > CC: Bob Liu <bob.liu@oracle.com>
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> >  tools/libxc/xc_domain_save.c | 6 ++++--
> >  tools/libxc/xc_tmem.c        | 4 ++--
> >  tools/libxc/xenctrl.h        | 2 +-
> >  3 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
> > index 42c4752..c3f0f19 100644
> > --- a/tools/libxc/xc_domain_save.c
> > +++ b/tools/libxc/xc_domain_save.c
> > @@ -2095,8 +2095,10 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
> >          goto copypages;
> >      }
> >  
> > -    if ( tmem_saved != 0 && live )
> > -        xc_tmem_save_done(xch, dom);
> > +    if ( tmem_saved != 0 && live ) {
> > +        if ( xc_tmem_save_done(xch, dom) )
> 
> These could be combined into a single if statement.
> 
> > +            DPRINTF("Warning - failed to flush tmem on originating server.");
> 
> Does this need to bail at this point then?

No. This failing means that the host hypervisor has some pages it couldn't free.
It should never happen (ha!) - but in case it does it is OK to forget about them
and just leave the 'zombie' guest behind.

> 
> > +    }
> >  
> >      if ( live )
> >      {
> > diff --git a/tools/libxc/xc_tmem.c b/tools/libxc/xc_tmem.c
> > index 0918615..df50ef5 100644
> > --- a/tools/libxc/xc_tmem.c
> > +++ b/tools/libxc/xc_tmem.c
> > @@ -366,9 +366,9 @@ int xc_tmem_save_extra(xc_interface *xch, int dom, int io_fd, int field_marker)
> >  }
> >  
> >  /* only called for live migration */
> > -void xc_tmem_save_done(xc_interface *xch, int dom)
> > +int xc_tmem_save_done(xc_interface *xch, int dom)
> >  {
> > -    xc_tmem_control(xch,0,TMEMC_SAVE_END,dom,0,0,0,NULL);
> > +    return xc_tmem_control(xch,0,TMEMC_SAVE_END,dom,0,0,0,NULL);
> 
> As you are tweaking this, could you apply some coding style with spaces
> following commas?

Of course. I thought it was frowend to mix coding style changes with
bug-fixes? Or was it more of an follow-up patch that would clean this
mess up?

> 
> ~Andrew
> 
> >  }
> >  
> >  /* restore routines */
> > diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
> > index 4ac6b8a..18d4f78 100644
> > --- a/tools/libxc/xenctrl.h
> > +++ b/tools/libxc/xenctrl.h
> > @@ -1996,7 +1996,7 @@ int xc_tmem_control(xc_interface *xch,
> >  int xc_tmem_auth(xc_interface *xch, int cli_id, char *uuid_str, int arg1);
> >  int xc_tmem_save(xc_interface *xch, int dom, int live, int fd, int field_marker);
> >  int xc_tmem_save_extra(xc_interface *xch, int dom, int fd, int field_marker);
> > -void xc_tmem_save_done(xc_interface *xch, int dom);
> > +int xc_tmem_save_done(xc_interface *xch, int dom);
> >  int xc_tmem_restore(xc_interface *xch, int dom, int fd);
> >  int xc_tmem_restore_extra(xc_interface *xch, int dom, int fd);
> >  
> 

  reply	other threads:[~2013-11-25 19:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 17:00 [PATCH] Coverity patches (tmem/xenstat) v1 Konrad Rzeszutek Wilk
2013-11-25 17:00 ` [PATCH 1/5] xc/tmem: Free temporary buffer used during migration Konrad Rzeszutek Wilk
2013-11-25 17:09   ` Andrew Cooper
2013-11-25 17:00 ` [PATCH 2/5] xc/tmem: Unchecked return value Konrad Rzeszutek Wilk
2013-11-25 17:11   ` Andrew Cooper
2013-11-25 19:53     ` Konrad Rzeszutek Wilk [this message]
2013-11-25 17:00 ` [PATCH 3/5] tmem: Check copy_to_user_* " Konrad Rzeszutek Wilk
2013-11-25 17:16   ` Andrew Cooper
2013-11-26  8:21   ` Jan Beulich
2013-11-26 18:16     ` Konrad Rzeszutek Wilk
2013-11-25 17:00 ` [PATCH 4/5] tmem: Pointless check of NULL against an array Konrad Rzeszutek Wilk
2013-11-25 17:19   ` Andrew Cooper
2013-11-25 19:54     ` Konrad Rzeszutek Wilk
2013-11-26  8:27       ` Jan Beulich
2013-11-25 17:00 ` [PATCH 5/5] xenstat: Fix buffer over-run with new_domains being negative (again) Konrad Rzeszutek Wilk
2013-11-25 17:06   ` Ian Campbell
2013-11-25 17:36     ` Andrew Cooper
2013-11-25 19:51       ` Konrad Rzeszutek Wilk
2013-11-26  8:40       ` 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=20131125195327.GD3339@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.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.