From patchwork Thu Apr 9 20:03:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 459815 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 948B71401AD for ; Fri, 10 Apr 2015 06:03:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=braap.org header.i=@braap.org header.b=st7C4fUQ; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost ([::1]:36395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgIg3-00089N-K8 for incoming@patchwork.ozlabs.org; Thu, 09 Apr 2015 16:03:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgIfl-0007ss-JM for qemu-devel@nongnu.org; Thu, 09 Apr 2015 16:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgIff-0002tn-H8 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 16:03:33 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:53983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgIff-0002ti-Cf for qemu-devel@nongnu.org; Thu, 09 Apr 2015 16:03:27 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3E99C2031D for ; Thu, 9 Apr 2015 16:03:21 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Thu, 09 Apr 2015 16:03:25 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=qn7VHWyUsNRYjl/xuw/wLETQZWc =; b=st7C4fUQ4ju31+Lh7A0jS8hxZ3RQYFRTQv+EwTv0fKu5Shhb0gGctS/mXtW HOUFt8h1IDSS00GkvjwT56B82KSbFFZAe7hrpfZFEMAdTZxrl8196efFZfKmFJA3 Vow/MBWW1PuWUuU+GTNSQMrNX0Zqs161LjokMPxyIl7zY6hY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=qn7V HWyUsNRYjl/xuw/wLETQZWc=; b=lbvwHk22tiSPwboC0edqIycGosO2SS9gCMNv jN7TzhXrjY1I65wAkGBk0oImoHnK0KC7ejuRiafM8wJ9Q115FlrUJJIcbhI+X/AM MLeyx7owPkijsuh4mE5sifS5exFn5NHl/rUo3R5jIvi5zoEQ30fq5OUi0Ks7/lb9 mAM7htc= X-Sasl-enc: PjVFOkwbKU7I3L2umiHfemSfSC4BDWwiCvVgmbfLVnzy 1428609805 Received: from localhost (unknown [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0AF74C0001C; Thu, 9 Apr 2015 16:03:25 -0400 (EDT) From: "Emilio G. Cota" To: Paolo Bonzini Date: Thu, 9 Apr 2015 16:03:44 -0400 Message-Id: <1428609824-25613-1-git-send-email-cota@braap.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <5526CDE9.5060209@redhat.com> References: <5526CDE9.5060209@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.111.4.28 Cc: Peter Maydell , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v2] translate-all: use glib for all page descriptor allocations 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 Since commit b7b5233a "bsd-user/mmap.c: Don't try to override g_malloc/g_free" the exception we make here for usermode has been unnecessary. Get rid of it. Signed-off-by: Emilio G. Cota --- translate-all.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/translate-all.c b/translate-all.c index 4d05898..c8f0e8c 100644 --- a/translate-all.c +++ b/translate-all.c @@ -389,18 +389,6 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc) void **lp; int i; -#if defined(CONFIG_USER_ONLY) - /* We can't use g_malloc because it may recurse into a locked mutex. */ -# define ALLOC(P, SIZE) \ - do { \ - P = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, \ - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \ - } while (0) -#else -# define ALLOC(P, SIZE) \ - do { P = g_malloc0(SIZE); } while (0) -#endif - /* Level 1. Always allocated. */ lp = l1_map + ((index >> V_L1_SHIFT) & (V_L1_SIZE - 1)); @@ -412,7 +400,7 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc) if (!alloc) { return NULL; } - ALLOC(p, sizeof(void *) * V_L2_SIZE); + p = g_malloc0(sizeof(void *) * V_L2_SIZE); *lp = p; } @@ -424,12 +412,10 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc) if (!alloc) { return NULL; } - ALLOC(pd, sizeof(PageDesc) * V_L2_SIZE); + pd = g_malloc0(sizeof(PageDesc) * V_L2_SIZE); *lp = pd; } -#undef ALLOC - return pd + (index & (V_L2_SIZE - 1)); }