From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNRkA-0001pt-DA for qemu-devel@nongnu.org; Fri, 20 May 2011 11:36:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNRk6-0007eI-3u for qemu-devel@nongnu.org; Fri, 20 May 2011 11:36:02 -0400 Received: from cantor.suse.de ([195.135.220.2]:54007 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNRk5-0007dl-VJ for qemu-devel@nongnu.org; Fri, 20 May 2011 11:35:58 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 27AF390847 for ; Fri, 20 May 2011 17:35:56 +0200 (CEST) From: Alexander Graf Date: Fri, 20 May 2011 17:35:55 +0200 Message-Id: <1305905755-31905-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH] s390x: complain when allocating ram fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org Developers" While trying out the > 64GB guest RAM patch, I hit some virtual address limitations of my host system, which resulted in mmap failing. Unfortunately, qemu didn't tell me about this failure, but just used the NULL pointer happily, resulting in either segmentation faults or other fun errors. To spare other users from tracing this down, let's print a nice message instead so the user can figure out what's wrong from there. Signed-off-by: Alexander Graf --- exec.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index 3f96d44..a4785b2 100644 --- a/exec.c +++ b/exec.c @@ -2918,6 +2918,10 @@ ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, const char *name, new_block->host = mmap((void*)0x800000000, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + if (new_block->host == MAP_FAILED) { + fprintf(stderr, "Allocating RAM failed\n"); + abort(); + } #else if (xen_mapcache_enabled()) { xen_ram_alloc(new_block->offset, size); -- 1.6.0.2