From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KeF3d-0002b5-9I for qemu-devel@nongnu.org; Fri, 12 Sep 2008 16:15:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KeF3c-0002Ze-9Q for qemu-devel@nongnu.org; Fri, 12 Sep 2008 16:15:56 -0400 Received: from [199.232.76.173] (port=39037 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KeF3c-0002ZK-3u for qemu-devel@nongnu.org; Fri, 12 Sep 2008 16:15:56 -0400 Received: from mx2.redhat.com ([66.187.237.31]:38334) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KeF3b-0003PE-Ph for qemu-devel@nongnu.org; Fri, 12 Sep 2008 16:15:56 -0400 Date: Fri, 12 Sep 2008 17:14:06 -0300 From: Eduardo Habkost Message-ID: <20080912201406.GA10147@blackpad> References: <20080912185856.GM3982@blackpad> <48CAC809.5000901@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48CAC809.5000901@codemonkey.ws> Subject: [Qemu-devel] Re: [PATCH] Make page_find() return 0 for too-large addresses Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, gcosta@redhat.com On Fri, Sep 12, 2008 at 02:50:33PM -0500, Anthony Liguori wrote: > Eduardo Habkost wrote: >> On some cases, such as under KVM, tb_invalidate_phys_page_range() >> may be called for large addresses, when qemu is configured to more than >> 4GB of RAM. >> >> On these cases, qemu was crashing because it was using an index too >> large for l1_map[], that supports only 32-bit addresses when compiling >> without CONFIG_USER_ONLY. >> > > Did you have kqemu enabled in the build? l1_map should be sufficiently > large when you have kqemu disabled. KVM uses './configure --disable-kqemu', but exec.c has this: #if defined(CONFIG_USER_ONLY) && defined(TARGET_VIRT_ADDR_SPACE_BITS) /* XXX: this is a temporary hack for alpha target. * In the future, this is to be replaced by a multi-level table * to actually be able to handle the complete 64 bits address space. */ #define L1_BITS (TARGET_VIRT_ADDR_SPACE_BITS - L2_BITS - TARGET_PAGE_BITS) #else #define L1_BITS (32 - L2_BITS - TARGET_PAGE_BITS) #endif And CONFIG_USER_ONLY is not defined, making l1_map work only for 32-bit addresses. BTW, I've just noticed page_find_alloc() has this: #if TARGET_LONG_BITS > 32 /* Host memory outside guest VM. For 32-bit targets we have already excluded high addresses. */ if (index > ((target_ulong)L2_SIZE * L1_SIZE)) return NULL; #endif So, we can just use a similar check on page_find(). Side note: the check on the kvm git tree looks broken: it is checking for (L2_SIZE * L1_SIZE * TARGET_PAGE_SIZE) instead. -- Eduardo