From patchwork Wed Jun 19 11:44:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 252558 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 17DFE2C029D for ; Wed, 19 Jun 2013 21:45:17 +1000 (EST) Received: from localhost ([::1]:45182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpGp7-0000Bl-Tf for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2013 07:45:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpGoS-0008Rh-Ed for qemu-devel@nongnu.org; Wed, 19 Jun 2013 07:44:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpGoP-0001N1-5R for qemu-devel@nongnu.org; Wed, 19 Jun 2013 07:44:32 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:121:10e4::3]:35646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpGoO-0001MH-Uh for qemu-devel@nongnu.org; Wed, 19 Jun 2013 07:44:29 -0400 Received: from blackfin.pond.sub.org (p5B32A610.dip0.t-ipconnect.de [91.50.166.16]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 1D7C7A5C63; Wed, 19 Jun 2013 13:44:24 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6508D200B5; Wed, 19 Jun 2013 13:44:24 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2013 13:44:18 +0200 Message-Id: <1371642264-17704-3-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1371642264-17704-1-git-send-email-armbru@redhat.com> References: <1371642264-17704-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:4f8:121:10e4::3 Cc: peter.maydell@linaro.org, stefano.stabellini@eu.citrix.com, mtosatti@redhat.com, agraf@suse.de, borntraeger@de.ibm.com, pbonzini@redhat.com, afaerber@suse.de, rth@twiddle.net Subject: [Qemu-devel] [PATCH 2/8] exec: Clean up fall back when -mem-path allocation 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 With -mem-path, qemu_ram_alloc_from_ptr() first tries to allocate accordingly, but when it fails, it falls back to normal allocation. The fall back allocation code used to be effectively identical to the "-mem-path not given" code, until it started to diverge in commit 432d268. I believe the code still works, but clean it up anyway: drop the special fall back allocation code, and fall back to the ordinary "-mem-path not given" code instead. Reviewed-by: Paolo Bonzini Signed-off-by: Markus Armbruster --- exec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index b424e12..56c31a9 100644 --- a/exec.c +++ b/exec.c @@ -1091,15 +1091,12 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, if (mem_path) { #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(new_block, size, mem_path); - if (!new_block->host) { - new_block->host = qemu_anon_ram_alloc(size); - memory_try_enable_merging(new_block->host, size); - } #else fprintf(stderr, "-mem-path option unsupported\n"); exit(1); #endif - } else { + } + if (!new_block->host) { if (kvm_enabled()) { /* some s390/kvm configurations have special constraints */ new_block->host = kvm_ram_alloc(size);