All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.10 0/3] PVHv2 toolstack leftovers
@ 2017-10-06 13:51 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
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Roger Pau Monne @ 2017-10-06 13:51 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monne

Hello,

The following series contains a bugfix for libxc when creating PVH
guests, and two patches to fix and expand the example configuration
files.

My opinion is that all three should be accepted for 4.10. The first one
because it's a bugfix, and the rest are just documentation fixes.

Thanks, Roger.

Roger Pau Monne (3):
  libxc: panic when trying to create a PVH guest without kernel support
  examples: fix HVM config file example
  examples: add a PVH guest config file template

 tools/examples/xlexample.hvm      |  2 +-
 tools/examples/xlexample.pvhlinux | 42 +++++++++++++++++++++++++++++++++++++++
 tools/libxc/xc_dom_elfloader.c    |  7 +++++++
 3 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 tools/examples/xlexample.pvhlinux

-- 
2.13.5 (Apple Git-94)


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
  2017-10-06 13:51 [PATCH for-4.10 0/3] PVHv2 toolstack leftovers Roger Pau Monne
@ 2017-10-06 13:51 ` Roger Pau Monne
  2017-10-06 14:38   ` Ian Jackson
  2018-01-19  6:11   ` HW42
  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
  2 siblings, 2 replies; 7+ messages in thread
From: Roger Pau Monne @ 2017-10-06 13:51 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, 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 )
     {
-- 
2.13.5 (Apple Git-94)


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH for-4.10 2/3] examples: fix HVM config file example
  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 13:52 ` 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
  2 siblings, 0 replies; 7+ messages in thread
From: Roger Pau Monne @ 2017-10-06 13:52 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

To use the new 'type' option.

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/examples/xlexample.hvm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/examples/xlexample.hvm b/tools/examples/xlexample.hvm
index 4b1ea629fb..df9fe07653 100644
--- a/tools/examples/xlexample.hvm
+++ b/tools/examples/xlexample.hvm
@@ -6,7 +6,7 @@
 # HVM guest. For a more complete guide see xl.cfg(5)
 
 # This configures an HVM rather than PV guest
-builder = "hvm"
+type = "hvm"
 
 # Guest name
 name = "example.hvm"
-- 
2.13.5 (Apple Git-94)


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH for-4.10 3/3] examples: add a PVH guest config file template
  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 13:52 ` [PATCH for-4.10 2/3] examples: fix HVM config file example Roger Pau Monne
@ 2017-10-06 13:52 ` Roger Pau Monne
  2 siblings, 0 replies; 7+ messages in thread
From: Roger Pau Monne @ 2017-10-06 13:52 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

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/examples/xlexample.pvhlinux | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 tools/examples/xlexample.pvhlinux

diff --git a/tools/examples/xlexample.pvhlinux b/tools/examples/xlexample.pvhlinux
new file mode 100644
index 0000000000..18305b80af
--- /dev/null
+++ b/tools/examples/xlexample.pvhlinux
@@ -0,0 +1,42 @@
+# =====================================================================
+# Example PVH Linux guest configuration
+# =====================================================================
+#
+# This is a fairly minimal example of what is required for a
+# PVH Linux guest. For a more complete guide see xl.cfg(5)
+
+# This configures a PVH rather than PV guest
+type = "pvh"
+
+# Guest name
+name = "example.pvhlinux"
+
+# 128-bit UUID for the domain as a hexadecimal number.
+# Use "uuidgen" to generate one if required.
+# The default behavior is to generate a new UUID each time the guest is started.
+#uuid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
+
+# Kernel image to boot
+kernel = "/boot/vmlinuz"
+
+# Ramdisk (optional)
+#ramdisk = "/boot/initrd.gz"
+
+# Kernel command line options
+extra = "root=/dev/xvda1"
+
+# Initial memory allocation (MB)
+memory = 512
+
+# Number of VCPUS
+vcpus = 4
+
+# Network devices
+# A list of 'vifspec' entries as described in
+# docs/misc/xl-network-configuration.markdown
+vif = [ '' ]
+
+# Disk Devices
+# A list of `diskspec' entries as described in
+# docs/misc/xl-disk-configuration.txt
+disk = [ '/dev/zvol/tank/guest-volume,raw,xvda,rw' ]
-- 
2.13.5 (Apple Git-94)


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Ian Jackson @ 2017-10-06 14:38 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Wei Liu

Roger Pau Monne writes ("[PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support"):
> 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.

All three:

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
  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é
  1 sibling, 1 reply; 7+ messages in thread
From: HW42 @ 2018-01-19  6:11 UTC (permalink / raw)
  To: Roger Pau Monne, xen-devel; +Cc: Ian Jackson, Wei Liu


[-- Attachment #1.1.1: Type: text/plain, Size: 2860 bytes --]

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?

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.

The following seems to work fine for me:

diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
index 568d7f370c..b67b95eb19 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xc_dom_elfloader.c
@@ -64,7 +64,8 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,
         xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
                      "%s: image not capable of booting inside a HVM container",
                      __FUNCTION__);
-        return "xen-3.0-unknown";
+        errno = EINVAL;
+        return NULL;
     }
 
     switch ( machine )
@@ -195,6 +196,8 @@ static elf_errorstatus xc_dom_parse_elf_kernel(struct xc_dom_image *dom)
     dom->kernel_seg.vend   = dom->parms.virt_kend;
 
     dom->guest_type = xc_dom_guest_type(dom, elf);
+    if (dom->guest_type == NULL)
+        return -EINVAL;
     DOMPRINTF("%s: %s: 0x%" PRIx64 " -> 0x%" PRIx64 "",
               __FUNCTION__, dom->guest_type,
               dom->kernel_seg.vstart, dom->kernel_seg.vend);


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
  2018-01-19  6:11   ` HW42
@ 2018-01-19 10:07     ` Roger Pau Monné
  0 siblings, 0 replies; 7+ messages in thread
From: Roger Pau Monné @ 2018-01-19 10:07 UTC (permalink / raw)
  To: HW42; +Cc: xen-devel, Wei Liu, Ian Jackson

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-19 10:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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é
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

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.