From patchwork Thu Aug 7 09:10:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 377797 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 148AD140095 for ; Thu, 7 Aug 2014 19:17:15 +1000 (EST) Received: from localhost ([::1]:44860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFJov-0007Sa-7C for incoming@patchwork.ozlabs.org; Thu, 07 Aug 2014 05:17:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFJkq-0000nb-Ul for qemu-devel@nongnu.org; Thu, 07 Aug 2014 05:13:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFJkl-0001wJ-S9 for qemu-devel@nongnu.org; Thu, 07 Aug 2014 05:13:00 -0400 Received: from [59.151.112.132] (port=50024 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFJkl-0001vP-HS for qemu-devel@nongnu.org; Thu, 07 Aug 2014 05:12:55 -0400 X-IronPort-AV: E=Sophos;i="5.04,280,1406563200"; d="scan'208";a="34304666" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 07 Aug 2014 17:10:04 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s779Cq46027603; Thu, 7 Aug 2014 17:12:52 +0800 Received: from G08FNSTD100614.fnst.cn.fujitsu.com (10.167.226.102) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 7 Aug 2014 17:12:59 +0800 From: Hu Tao To: Date: Thu, 7 Aug 2014 17:10:22 +0800 Message-ID: <17ef218602639e1dd964b8706eb1d92da583a464.1407402040.git.hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.226.102] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: Peter Crosthwaite , "Michael S. Tsirkin" , Yasuaki Isimatu , Paolo Bonzini , Yasunori Goto Subject: [Qemu-devel] [PATCH v6 5/7] hostmem-ram: don't exit qemu if size of memory-backend-ram is way too big 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 When using monitor command object_add to add a memory backend whose size is way too big to allocate memory for it, qemu just exits. In the case we'd better give an error message and keep guest running. The problem can be reproduced as follows: 1. run qemu 2. (monitor)object_add memory-backend-ram,size=100000G,id=ram0 Reviewed-by: Peter Crosthwaite Signed-off-by: Hu Tao --- backends/hostmem-ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index e55d066..a67a134 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -27,7 +27,7 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) path = object_get_canonical_path_component(OBJECT(backend)); memory_region_init_ram(&backend->mr, OBJECT(backend), path, - backend->size, &error_abort); + backend->size, errp); g_free(path); }