Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kslx6-0005vH-IL for qemu-devel@nongnu.org; Wed, 22 Oct 2008 18:13:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kslx5-0005uz-BY for qemu-devel@nongnu.org; Wed, 22 Oct 2008 18:13:16 -0400 Received: from [199.232.76.173] (port=42275 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kslx5-0005uw-8S for qemu-devel@nongnu.org; Wed, 22 Oct 2008 18:13:15 -0400 Received: from gwyn.kn-bremen.de ([212.63.36.242]:38739) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kslx5-0006es-6C for qemu-devel@nongnu.org; Wed, 22 Oct 2008 18:13:15 -0400 Received: from saturn.kn-bremen.de (noident@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.14.2/8.13.8) with ESMTP id m9MMAplA014694 for ; Thu, 23 Oct 2008 00:10:51 +0200 (CEST) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.14.2/8.13.6/Submit) id m9MMApk8014693 for qemu-devel@nongnu.org; Thu, 23 Oct 2008 00:10:51 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Thu, 23 Oct 2008 00:10:51 +0200 Message-ID: <20081022221051.GA14534@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] [resubmit] Allocate translation buffer before guest RAM, in case guest RAM is too large on 64 bit hosts Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi! Further explanation as requested: cpu_exec_init_all() below allocates code_gen_buffer which needs to be in the lower 4G (actually 2G I guess) because it uses 32 bit branch offsets. Allocate this first so that the guest RAM allocation can't get in the way i.e. block the lower vm when doing something like -m 4096 on systems that allocate from low addresses by default. I hope this is more clear now? :) Thanx, Juergen ----- Forwarded message from Juergen Lock ----- From: Juergen Lock Date: Sat, 18 Oct 2008 23:05:08 +0200 To: qemu-devel@nongnu.org Subject: [PATCH] Allocate translation buffer before guest RAM, in case guest RAM is too large on 64 bit hosts User-Agent: Mutt/1.5.17 (2007-11-01) Hi! The following patch appears to fix -m >= 1024 on recent FreeBSD/amd64 hosts (RELENG_7/HEAD) that no longer return high addresses for allocations by default (which was the original reason for r5331.) As this makes sense in any case when you pass something like -m 4096 on hosts that allocate from low addresses by default (there would be no room left for the translation buffer in the low vm where it needs to be), I patched it like this instead of conditionalizing the mmap hack from r5331 on the FreeBSD version. Index: qemu/vl.c @@ -9850,15 +9850,15 @@ phys_ram_size += ram_size; } + /* init the dynamic translator */ + cpu_exec_init_all(tb_size * 1024 * 1024); + phys_ram_base = qemu_vmalloc(phys_ram_size); if (!phys_ram_base) { fprintf(stderr, "Could not allocate physical memory\n"); exit(1); } - /* init the dynamic translator */ - cpu_exec_init_all(tb_size * 1024 * 1024); - bdrv_init(emulate_aio); /* we always create the cdrom drive, even if no disk is there */ Signed-off-by: Juergen Lock ----- End forwarded message -----