From patchwork Fri Sep 12 20:26:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 388788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BE94514011B for ; Sat, 13 Sep 2014 06:28:23 +1000 (EST) Received: from localhost ([::1]:47267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSXS9-00029k-9W for incoming@patchwork.ozlabs.org; Fri, 12 Sep 2014 16:28:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSXQc-0008Vv-20 for qemu-devel@nongnu.org; Fri, 12 Sep 2014 16:26:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSXQV-0005jB-Ua for qemu-devel@nongnu.org; Fri, 12 Sep 2014 16:26:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSXQV-0005j6-N0 for qemu-devel@nongnu.org; Fri, 12 Sep 2014 16:26:39 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8CKQX8Q013226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 12 Sep 2014 16:26:33 -0400 Received: from localhost (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8CKQW4i016210; Fri, 12 Sep 2014 16:26:32 -0400 From: Luiz Capitulino To: peter.maydell@linaro.org Date: Fri, 12 Sep 2014 16:26:24 -0400 Message-Id: <1410553584-25048-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1410553584-25048-1-git-send-email-lcapitulino@redhat.com> References: <1410553584-25048-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws Subject: [Qemu-devel] [PULL 2/2] exec: file_ram_alloc(): print error when prealloc fails X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If memory allocation fails when using the -mem-prealloc command-line option, QEMU exits without printing any error information to the user: # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages # echo $? 1 This commit adds an error message, so that we print instead: # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages qemu: unable to map backing store for hugepages: Cannot allocate memory Signed-off-by: Luiz Capitulino Reviewed-by: Eric Blake --- exec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/exec.c b/exec.c index 7dddcc8..cb73d16 100644 --- a/exec.c +++ b/exec.c @@ -1130,6 +1130,7 @@ static void *file_ram_alloc(RAMBlock *block, error: if (mem_prealloc) { + error_report("%s\n", error_get_pretty(*errp)); exit(1); } return NULL;