All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()
@ 2021-08-17 15:19 Jane Malalane
  2021-08-18  9:29 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jane Malalane @ 2021-08-17 15:19 UTC (permalink / raw)
  To: Xen-devel; +Cc: Jane Malalane, Ian Jackson, Wei Liu, Juergen Gross

Xen may not support 32-bit PV guest for a number of reasons (lack of
CONFIG_PV32, explicit pv=no-32 command line argument, or implicitly
due to CET being enabled) and advertises this to the toolstack via the
absence of xen-3.0-x86_32p ABI.

Currently, when trying to boot a 32-bit PV guest, the ABI check is too
late and the build explodes in the following manner yielding an
unhelpful error message:

  xc: error: panic: xg_dom_boot.c:121: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
  libxl: error: libxl_dom.c:586:libxl__build_dom: xc_dom_boot_mem_init failed: Operation not supported
  libxl: error: libxl_create.c:1573:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3
  libxl: error: libxl_domain.c:1182:libxl__destroy_domid: Domain 1:Non-existant domain
  libxl: error: libxl_domain.c:1136:domain_destroy_callback: Domain 1:Unable to destroy guest
  libxl: error: libxl_domain.c:1063:domain_destroy_cb: Domain 1:Destruction of domain failed

Move the ABI check earlier into xc_dom_parse_image() along with other
ELF-note feature checks.  With this adjustment, it now looks like
this:

  xc: error: panic: xg_dom_boot.c:88: xc_dom_compat_check: guest type xen-3.0-x86_32p not supported by xen kernel, sorry: Invalid kernel
  libxl: error: libxl_dom.c:571:libxl__build_dom: xc_dom_parse_image failed
  domainbuilder: detail: xc_dom_release: called
  libxl: error: libxl_create.c:1573:domcreate_rebuild_done: Domain 11:cannot (re-)build domain: -3
  libxl: error: libxl_domain.c:1182:libxl__destroy_domid: Domain 11:Non-existant domain
  libxl: error: libxl_domain.c:1136:domain_destroy_callback: Domain 11:Unable to destroy guest
  libxl: error: libxl_domain.c:1063:domain_destroy_cb: Domain 11:Destruction of domain failed

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Juergen Gross <jgross@suse.com>
---
 tools/libs/guest/xg_dom_boot.c | 4 ----
 tools/libs/guest/xg_dom_core.c | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libs/guest/xg_dom_boot.c b/tools/libs/guest/xg_dom_boot.c
index dac96b17a5..f809dcbe97 100644
--- a/tools/libs/guest/xg_dom_boot.c
+++ b/tools/libs/guest/xg_dom_boot.c
@@ -191,10 +191,6 @@ int xc_dom_boot_image(struct xc_dom_image *dom)
     }
     dom->shared_info_mfn = info.shared_info_frame;
 
-    /* sanity checks */
-    if ( !xc_dom_compat_check(dom) )
-        return -1;
-
     /* initial mm setup */
     if ( dom->arch_hooks->setup_pgtables &&
          (rc = dom->arch_hooks->setup_pgtables(dom)) != 0 )
diff --git a/tools/libs/guest/xg_dom_core.c b/tools/libs/guest/xg_dom_core.c
index 4918ee517b..2e4c1330ea 100644
--- a/tools/libs/guest/xg_dom_core.c
+++ b/tools/libs/guest/xg_dom_core.c
@@ -922,6 +922,10 @@ int xc_dom_parse_image(struct xc_dom_image *dom)
         goto err;
     }
 
+    /* Check guest ABI */
+    if ( !xc_dom_compat_check(dom) )
+        return -1;
+
     /* check features */
     for ( i = 0; i < XENFEAT_NR_SUBMAPS; i++ )
     {
-- 
2.11.0



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

* Re: [PATCH] libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()
  2021-08-17 15:19 [PATCH] libs/guest: Move the guest ABI check earlier into xc_dom_parse_image() Jane Malalane
@ 2021-08-18  9:29 ` Andrew Cooper
  2021-08-19 17:26   ` Ian Jackson
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2021-08-18  9:29 UTC (permalink / raw)
  To: Jane Malalane, Xen-devel; +Cc: Ian Jackson, Wei Liu, Juergen Gross

On 17/08/2021 16:19, Jane Malalane wrote:
> Xen may not support 32-bit PV guest for a number of reasons (lack of
> CONFIG_PV32, explicit pv=no-32 command line argument, or implicitly
> due to CET being enabled) and advertises this to the toolstack via the
> absence of xen-3.0-x86_32p ABI.
>
> Currently, when trying to boot a 32-bit PV guest, the ABI check is too
> late and the build explodes in the following manner yielding an
> unhelpful error message:
>
>   xc: error: panic: xg_dom_boot.c:121: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
>   libxl: error: libxl_dom.c:586:libxl__build_dom: xc_dom_boot_mem_init failed: Operation not supported
>   libxl: error: libxl_create.c:1573:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3
>   libxl: error: libxl_domain.c:1182:libxl__destroy_domid: Domain 1:Non-existant domain
>   libxl: error: libxl_domain.c:1136:domain_destroy_callback: Domain 1:Unable to destroy guest
>   libxl: error: libxl_domain.c:1063:domain_destroy_cb: Domain 1:Destruction of domain failed
>
> Move the ABI check earlier into xc_dom_parse_image() along with other
> ELF-note feature checks.  With this adjustment, it now looks like
> this:
>
>   xc: error: panic: xg_dom_boot.c:88: xc_dom_compat_check: guest type xen-3.0-x86_32p not supported by xen kernel, sorry: Invalid kernel
>   libxl: error: libxl_dom.c:571:libxl__build_dom: xc_dom_parse_image failed
>   domainbuilder: detail: xc_dom_release: called
>   libxl: error: libxl_create.c:1573:domcreate_rebuild_done: Domain 11:cannot (re-)build domain: -3
>   libxl: error: libxl_domain.c:1182:libxl__destroy_domid: Domain 11:Non-existant domain
>   libxl: error: libxl_domain.c:1136:domain_destroy_callback: Domain 11:Unable to destroy guest
>   libxl: error: libxl_domain.c:1063:domain_destroy_cb: Domain 11:Destruction of domain failed
>
> Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jane Malalane <jane.malalane@citrix.com>

FWIW, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

The net behaviour of `xl create` is still not great (the -3 in
particular is ESRCH looking for qemu which isn't remotely relevant), but
at least with this change, you get "guest type xen-3.0-x86_32p not
supported by xen" out of libxc which is the root cause of the failure.

~Andrew



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

* Re: [PATCH] libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()
  2021-08-18  9:29 ` Andrew Cooper
@ 2021-08-19 17:26   ` Ian Jackson
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2021-08-19 17:26 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Jane Malalane, Xen-devel, Wei Liu, Juergen Gross

Andrew Cooper writes ("Re: [PATCH] libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()"):
> On 17/08/2021 16:19, Jane Malalane wrote:
> > Xen may not support 32-bit PV guest for a number of reasons (lack of
> > CONFIG_PV32, explicit pv=no-32 command line argument, or implicitly
> > due to CET being enabled) and advertises this to the toolstack via the
> > absence of xen-3.0-x86_32p ABI.
> >
> > Currently, when trying to boot a 32-bit PV guest, the ABI check is too
> > late and the build explodes in the following manner yielding an
> > unhelpful error message:
> >
> >   xc: error: panic: xg_dom_boot.c:121: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
> >   libxl: error: libxl_dom.c:586:libxl__build_dom: xc_dom_boot_mem_init failed: Operation not supported
> >   libxl: error: libxl_create.c:1573:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3
> >   libxl: error: libxl_domain.c:1182:libxl__destroy_domid: Domain 1:Non-existant domain
> >   libxl: error: libxl_domain.c:1136:domain_destroy_callback: Domain 1:Unable to destroy guest
> >   libxl: error: libxl_domain.c:1063:domain_destroy_cb: Domain 1:Destruction of domain failed
> >
> > Move the ABI check earlier into xc_dom_parse_image() along with other
> > ELF-note feature checks.  With this adjustment, it now looks like
> > this:
> >
> >   xc: error: panic: xg_dom_boot.c:88: xc_dom_compat_check: guest type xen-3.0-x86_32p not supported by xen kernel, sorry: Invalid kernel
> >   libxl: error: libxl_dom.c:571:libxl__build_dom: xc_dom_parse_image failed
> >   domainbuilder: detail: xc_dom_release: called
> >   libxl: error: libxl_create.c:1573:domcreate_rebuild_done: Domain 11:cannot (re-)build domain: -3
> >   libxl: error: libxl_domain.c:1182:libxl__destroy_domid: Domain 11:Non-existant domain
> >   libxl: error: libxl_domain.c:1136:domain_destroy_callback: Domain 11:Unable to destroy guest
> >   libxl: error: libxl_domain.c:1063:domain_destroy_cb: Domain 11:Destruction of domain failed
> >
> > Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
> 
> FWIW, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> The net behaviour of `xl create` is still not great (the -3 in
> particular is ESRCH looking for qemu which isn't remotely relevant), but
> at least with this change, you get "guest type xen-3.0-x86_32p not
> supported by xen" out of libxc which is the root cause of the failure.

Acked-by: Ian Jackson <iwj@xenproject.org>


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

end of thread, other threads:[~2021-08-19 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 15:19 [PATCH] libs/guest: Move the guest ABI check earlier into xc_dom_parse_image() Jane Malalane
2021-08-18  9:29 ` Andrew Cooper
2021-08-19 17:26   ` Ian Jackson

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.