Richard W.M. Jones bb19cc0cdd lib: Disable 5-level page tables when using -cpu max
In https://bugzilla.redhat.com/show_bug.cgi?id=2082806 we've been
tracking an insidious qemu bug which intermittently prevents the
libguestfs appliance from starting.  The symptoms are that SeaBIOS
starts and displays its messages, but the kernel isn't reached.  We
found that the kernel does in fact start, but when it tries to set up
page tables and jump to protected mode it gets a triple fault which
causes the emulated CPU in qemu to reset (qemu exits).

This seems to only affect TCG (not KVM).

Yesterday I found that this is caused by using -cpu max which enables
the "la57" feature (5-level page tables[0]), and that we can make the
problem go away using -cpu max,la57=off.  Note that I still don't
fully understand the qemu bug, so this is only a workaround.

I chose to disable 5-level page tables for both TCG and KVM, partly to
make the patch simpler, and partly because I guess it's not a feature
(ie. 57 bit linear addresses) that is useful for the libguestfs
appliance case, where we have limited physical memory and no need to
run any programs with huge address spaces.

I tested this by running both the direct & libvirt paths overnight.  I
expect that this patch will fail with old qemu/libvirt which doesn't
understand the "la57" feature, but this is only intended as a
temporary workaround.

[0] Article about 5-level page tables as background:
https://lwn.net/Articles/717293/

Thanks: Laszlo Ersek
Fixes: https://answers.launchpad.net/ubuntu/+source/libguestfs/+question/701625

[RHEL 8.7: Patch is not upstream.  This is the initial patch as posted
to the mailing list here:
https://listman.redhat.com/archives/libguestfs/2022-May/028853.html]
2022-05-12 16:12:21 +01:00
2021-01-05 15:53:51 +00:00
2020-03-06 19:32:32 +00:00
2020-03-06 19:32:32 +00:00
2020-11-02 10:13:22 +00:00
2021-01-05 10:32:20 +00:00
2020-03-06 19:32:32 +00:00
2021-10-14 12:01:33 +01:00
2020-03-06 19:32:32 +00:00
2020-03-06 19:32:32 +00:00
2021-01-06 10:18:34 +00:00
2018-02-22 15:06:13 +00:00
2020-03-06 19:32:32 +00:00
2021-01-06 10:18:34 +00:00
2019-11-28 13:09:21 +01:00
2021-01-06 10:18:34 +00:00
2020-01-14 16:21:22 +01:00
2021-01-06 10:18:34 +00:00
2019-11-13 12:49:55 +00:00
2020-03-06 19:32:32 +00:00
2021-01-06 10:18:34 +00:00
2020-10-06 15:26:14 +01:00
2020-03-06 19:32:32 +00:00

Libguestfs is tools and a library for accessing and modifying guest
disk images.  For more information see the home page:

  http://libguestfs.org/

For discussion, development, patches, etc. please use the mailing
list:

  http://www.redhat.com/mailman/listinfo/libguestfs

To find out how to build libguestfs from source, read:

  docs/guestfs-building.pod
  http://libguestfs.org/guestfs-building.1.html
  man docs/guestfs-building.1

Copyright (C) 2009-2020 Red Hat Inc.

The library is distributed under the LGPLv2+.  The programs are
distributed under the GPLv2+.  Please see the files COPYING and
COPYING.LIB for full license information.  The examples are under a
very liberal license.
Languages
C 42.7%
OCaml 35.5%
Shell 7.1%
Makefile 4%
Perl 2.6%
Other 8%