Received: from eggs.gnu.org ([2001:4830:134:3::10]:45107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81m6-00030N-Lq for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:45:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b81m2-0005J1-G8 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:45:13 -0400 Received: from prv-mh.provo.novell.com ([137.65.248.74]:50316) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81m2-0005I3-7Z for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:45:10 -0400 Message-Id: <574F110902000066000DEF7C@prv-mh.provo.novell.com> Date: Wed, 01 Jun 2016 02:44:57 -0600 From: "Chun Yan Liu" References: <1461901436-6881-1-git-send-email-cyliu@suse.com> In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Re: [Qemu-devel] [PATCH] fix xen hvm direct kernel boot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: sstabellini@kernel.org Cc: anthony.perard@citrix.com, george.dunlap@eu.citrix.com, qemu-devel@nongnu.org >>> On 5/31/2016 at 12:10 AM, in message , Stefano Stabellini wrote:=20 > On Fri, 29 Apr 2016, Chunyan Liu wrote:=20 > > Since commit a1666142: acpi-build: make ROMs RAM blocks resizeable,=20 > > xen HVM direct kernel boot failed. Xen HVM direct kernel boot will=20 > > insert a linuxboot.bin or multiboot.bin to /genroms, before this=20 > > commit, in acpi_setup, for rom linuxboot.bin/multiboot.bin, it=20 > > only needs 0x20000 size; after the commit, it will reserve x16=20 > > size for resize, that is 0x200000 size. It causes xen_ram_alloc=20 > > failed due to running out of memory.=20 > > =20 > > To resolve it, either:=20 > > 1. keep using original rom size instead of max size, don't reserve x16 = =20 > size.=20 > > 2. guest maxmem needs to be increased. (commit c1d322e6 "xen-hvm: = increase=20 > > maxmem before calling xc_domain_populate_physmap" solved the = problem for=20 > > a time, by accident. But then it is reverted in commit ffffbb369 = due to=20 > > other problem.)=20 > > =20 > > For 2, more discussion is needed about howto. So this patch tries 1, = to=20 > > use unresizable rom size in xen case in rom_set_mr.=20 > > =20 > > Signed-off-by: Chunyan Liu =20 > =20 > Thank you for the patch!=20 > =20 > =20 > > hw/core/loader.c | 6 +++++-=20 > > 1 file changed, 5 insertions(+), 1 deletion(-)=20 > > =20 > > diff --git a/hw/core/loader.c b/hw/core/loader.c=20 > > index c049957..5150101 100644=20 > > --- a/hw/core/loader.c=20 > > +++ b/hw/core/loader.c=20 > > @@ -55,6 +55,7 @@=20 > > #include "exec/address-spaces.h"=20 > > #include "hw/boards.h"=20 > > #include "qemu/cutils.h"=20 > > +#include "hw/xen/xen.h"=20 > > =20 > > #include =20 > > =20 > > @@ -818,7 +819,10 @@ static void *rom_set_mr(Rom *rom, Object *owner, = const =20 > char *name)=20 > > void *data;=20 > > =20 > > rom->mr =3D g_malloc(sizeof(*rom->mr));=20 > > - memory_region_init_resizeable_ram(rom->mr, owner, name,=20 > > + if (xen_enabled())=20 > > + memory_region_init_ram(rom->mr, owner, name, rom->datasize, = =20 > &error_fatal);=20 > > + else=20 > > + memory_region_init_resizeable_ram(rom->mr, owner, name,=20 > > rom->datasize, rom->romsize,=20 > > fw_cfg_resized,=20 > > &error_fatal);=20 > =20 > Wouldn't it be better to change ram_block_add so that it calls=20 > xen_ram_alloc with used_length rather than max_length?=20 Seems that's right. But after that changes, when doing direct kernel boot, it reports: qemu-system-x86_64: /home/cyliu/git/qemu/include/exec/ram_addr.h:48: ramblock_ptr: Assertion `offset_in_ramblock(block, offset)' failed. Looking at it. Chunyan > =20 > I think that on Xen we want to only allocate used_length bytes, but=20 > reserve max_length of address space.=20 > =20 > =20 > =20