[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] tools/helpers: don't log errors when trying to load PVH xenstore-stubdom



On 27.01.23 11:28, Andrew Cooper wrote:
On 27/01/2023 5:54 am, Juergen Gross wrote:
When loading a Xenstore stubdom the loader doesn't know whether the
lo be loaded kernel is a PVH or a PV one. So it tries to load it as
a PVH one first, and if this fails it is loading it as a PV kernel.

Well, yes it does.

What might be missing is libxenguest's ability to parse the provided
kernel's ELF Notes ahead of trying to build the domain.

Correct.

This is the same kind of poor design which has left us with a
dom0=pv|pvh cmdline option which must match the kernel the bootloader
gave us, if we want to not panic() on boot.

Hmm, this is only partially true.

I agree that without any dom0 option given it would be nice if the
hypervisor could use the specified dom0 kernel as long as it is
supporting either PV or PVH mode.

OTOH nowadays it is easily possible to build a kernel being capable
to support both variants, in which case the hypervisor needs to
select which mode to use. This might need the help of the user in
case the non-default mode is wanted.

For xenstore-stubdom it is easier, as there is no reason to prefer
the PV mode over PVH (in fact I'm still working on Xenstore LU for
the PVH case, making the decision even easier).


So while this might be an acceptable gross bodge in the short term, this...


This results in errors being logged in case the stubdom is a PV kernel.

Suppress those errors by setting the minimum logging level to
"critical" while trying to load the kernel as PVH.

Fixes: f89955449c5a ("tools/init-xenstore-domain: support xenstore pvh stubdom")
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
V2:
- retry PVH loading with logging if PV fails, too (Jan Beulich)
---
  tools/helpers/init-xenstore-domain.c | 24 ++++++++++++++++--------
  1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c 
b/tools/helpers/init-xenstore-domain.c
index 04e351ca29..4e2f8d4da5 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -31,6 +31,8 @@ static int memory;
  static int maxmem;
  static xen_pfn_t console_gfn;
  static xc_evtchn_port_or_error_t console_evtchn;
+static xentoollog_level minmsglevel = XTL_PROGRESS;
+static void *logger;
static struct option options[] = {
      { "kernel", 1, NULL, 'k' },
@@ -141,19 +143,29 @@ static int build(xc_interface *xch)
          goto err;
      }
+ /* Try PVH first, suppress errors by setting min level high. */

... needs to make the position clear.

/*  This is a bodge.  We can't currently inspect the kernel's ELF notes
ahead of attempting to construct a domain, so try PVH first, suppressing
errors by setting min level to high, and fall back to PV. */

No problem with me.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.