All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: HW42 <hw42@ipsumj.de>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
Date: Fri, 19 Jan 2018 10:07:06 +0000	[thread overview]
Message-ID: <20180119100706.voxf3bbcbcbyxyuu@MacBook-Pro-de-Roger.local> (raw)
In-Reply-To: <6abbd413-11e7-5d49-a711-d44fa8fd939d@ipsumj.de>

On Fri, Jan 19, 2018 at 06:11:00AM +0000, HW42 wrote:
> Roger Pau Monne:
> > Previously when trying to boot a PV capable but not PVH capable kernel
> > inside of a PVH container xc_dom_guest_type would succeed and return a
> > PV guest type, which would lead to failures later on in the build
> > process.
> > 
> > Instead provide a clear error message when trying to create a PVH
> > guest using a kernel that doesn't support PVH.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > Cc: Wei Liu <wei.liu2@citrix.com>
> > ---
> >  tools/libxc/xc_dom_elfloader.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
> > index 62d421a5e3..568d7f370c 100644
> > --- a/tools/libxc/xc_dom_elfloader.c
> > +++ b/tools/libxc/xc_dom_elfloader.c
> > @@ -59,6 +59,13 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,
> >      if ( dom->container_type == XC_DOM_HVM_CONTAINER &&
> >           dom->parms.phys_entry != UNSET_ADDR32 )
> >          return "hvm-3.0-x86_32";
> > +    if ( dom->container_type == XC_DOM_HVM_CONTAINER )
> > +    {
> > +        xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
> > +                     "%s: image not capable of booting inside a HVM container",
> > +                     __FUNCTION__);
> > +        return "xen-3.0-unknown";
> > +    }
> >  
> >      switch ( machine )
> >      {
> 
> With this xc_dom_parse_elf_kernel() still returns success and the domain
> build fails only later because of the "xen-3.0-unknown" type. Why not
> fail directly in xc_dom_parse_elf_kernel() like for elf files which miss
> the DomU feature?

This doesn't seem to be how xc_dom_guest_type works ATM. There's also
a case below that also returns "xen-3.0-unknown", so iff you really
want to change the first return of "xen-3.0-unknown" you should also
change the one below AFAICT.

> And while we are at it: libxl__build_dom() expects that
> xc_dom_parse_elf_kernel() sets an errno. Currently this can contain an
> unrelated error since it does not get set when returning -EINVAL.

Error handling in libxc is all fuzzy, as noted at the top of
xc_dom_parse_elf_kernel:

/*
 * This function sometimes returns -1 for error and sometimes
 * an errno value.  ?!?!
 */

The general consensus is that either you set errno = -EFOO and return
-1, or simnply return -EFOO.

I can review the patches, but you will have to formally post them.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-01-19 10:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 13:51 [PATCH for-4.10 0/3] PVHv2 toolstack leftovers Roger Pau Monne
2017-10-06 13:51 ` [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support Roger Pau Monne
2017-10-06 14:38   ` Ian Jackson
2018-01-19  6:11   ` HW42
2018-01-19 10:07     ` Roger Pau Monné [this message]
2017-10-06 13:52 ` [PATCH for-4.10 2/3] examples: fix HVM config file example Roger Pau Monne
2017-10-06 13:52 ` [PATCH for-4.10 3/3] examples: add a PVH guest config file template Roger Pau Monne

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=20180119100706.voxf3bbcbcbyxyuu@MacBook-Pro-de-Roger.local \
    --to=roger.pau@citrix.com \
    --cc=hw42@ipsumj.de \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@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.