From patchwork Wed Aug 12 16:41:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 506705 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 8277814016A for ; Thu, 13 Aug 2015 02:47:41 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=whiezuRK; dkim-atps=neutral Received: from localhost ([::1]:39516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPZBj-000570-OP for incoming@patchwork.ozlabs.org; Wed, 12 Aug 2015 12:47:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPZ5a-0001mw-VK for qemu-devel@nongnu.org; Wed, 12 Aug 2015 12:41:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPZ5Z-0008Bp-TJ for qemu-devel@nongnu.org; Wed, 12 Aug 2015 12:41:18 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:36573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPZ5Z-0008BW-N5 for qemu-devel@nongnu.org; Wed, 12 Aug 2015 12:41:17 -0400 Received: by wicja10 with SMTP id ja10so120031602wic.1 for ; Wed, 12 Aug 2015 09:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=6auDqZLXeSAhbUvmyDfWZFzVxi9DbJZjuLgyOCCM2NQ=; b=whiezuRK54AnsDYQVtFOySK1ogYipRpUsDdgujtb5U22mk2sC3wGSjO4ALVs1FHysr OOye/cZMzg/BDVNzG//djueJASOrhR6BiSk+whodAj3m1APk8F2GdxuoeB1/wLVwRTM8 9gyuZwsC+97+y44+Ndku2yhwNa4d0Qo2M9hfF6/3jJVvzJDK65hWIooi+NzuDOozsaCR CCbIxzpAaK3u2YIdAcfn35ZPWSk1YRnnW17SsFPWD2B4n4FltXjh0/HYr/WRuAwq5RCd 8YTGLlyK3lyjaEKk5DR4Q2wy4fW6ArtfwY3Q04zqfyzkLQUlEOOVODjyCB1Nc3ElGB2w lYGg== X-Received: by 10.194.206.65 with SMTP id lm1mr69235815wjc.117.1439397677035; Wed, 12 Aug 2015 09:41:17 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-94-39-138-45.clienti.tiscali.it. [94.39.138.45]) by smtp.gmail.com with ESMTPSA id fa8sm9125466wib.14.2015.08.12.09.41.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Aug 2015 09:41:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Aug 2015 18:41:01 +0200 Message-Id: <1439397664-70734-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1439397664-70734-1-git-send-email-pbonzini@redhat.com> References: <1439397664-70734-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::229 Cc: mttcg@greensocs.com, fred.konrad@greensocs.com Subject: [Qemu-devel] [PATCH 09/10] exec: make mmap_lock/mmap_unlock globally available 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 There is some iffy lock hierarchy going on in translate-all.c. To fix it, we need to take the mmap_lock in cpu-exec.c. Make the functions globally available. Signed-off-by: Paolo Bonzini Reviewed-by: Peter Maydell --- bsd-user/qemu.h | 2 -- include/exec/exec-all.h | 7 ++++++- linux-user/qemu.h | 2 -- translate-all.c | 5 ----- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 5362297..5902614 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -213,8 +213,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_addr); int target_msync(abi_ulong start, abi_ulong len, int flags); extern unsigned long last_brk; -void mmap_lock(void); -void mmap_unlock(void); void cpu_list_lock(void); void cpu_list_unlock(void); #if defined(CONFIG_USE_NPTL) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index eb77373..b3f900a 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -318,7 +318,6 @@ extern uintptr_t tci_tb_ptr; #define GETPC() (GETRA() - GETPC_ADJ) #if !defined(CONFIG_USER_ONLY) - struct MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr index); @@ -328,11 +327,17 @@ void tlb_fill(CPUState *cpu, target_ulong addr, int is_write, int mmu_idx, #endif #if defined(CONFIG_USER_ONLY) +void mmap_lock(void); +void mmap_unlock(void); + static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) { return addr; } #else +static inline void mmap_lock(void) {} +static inline void mmap_unlock(void) {} + /* cputlb.c */ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr); #endif diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 8012cc2..e8606b2 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -261,8 +261,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, int target_msync(abi_ulong start, abi_ulong len, int flags); extern unsigned long last_brk; extern abi_ulong mmap_next_start; -void mmap_lock(void); -void mmap_unlock(void); abi_ulong mmap_find_vma(abi_ulong, abi_ulong); void cpu_list_lock(void); void cpu_list_unlock(void); diff --git a/translate-all.c b/translate-all.c index 78a787d..61fa03d 100644 --- a/translate-all.c +++ b/translate-all.c @@ -467,11 +467,6 @@ static inline PageDesc *page_find(tb_page_addr_t index) return page_find_alloc(index, 0); } -#if !defined(CONFIG_USER_ONLY) -#define mmap_lock() do { } while (0) -#define mmap_unlock() do { } while (0) -#endif - #if defined(CONFIG_USER_ONLY) /* Currently it is not recommended to allocate big chunks of data in user mode. It will change when a dedicated libc will be used. */