From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: mttcg@greensocs.com, fred.konrad@greensocs.com
Subject: [Qemu-devel] [PATCH 09/10] exec: make mmap_lock/mmap_unlock globally available
Date: Wed, 12 Aug 2015 18:41:01 +0200 [thread overview]
Message-ID: <1439397664-70734-10-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1439397664-70734-1-git-send-email-pbonzini@redhat.com>
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 <pbonzini@redhat.com>
---
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. */
--
1.8.3.1
next prev parent reply other threads:[~2015-08-12 16:41 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 16:40 [Qemu-devel] [PATCH 00/10] translate-all.c thread-safety Paolo Bonzini
2015-08-12 16:40 ` [Qemu-devel] [PATCH 01/10] cpus: protect work list with work_mutex Paolo Bonzini
2015-08-28 14:33 ` Peter Maydell
2015-08-12 16:40 ` [Qemu-devel] [PATCH 02/10] cpus: remove tcg_halt_cond global variable Paolo Bonzini
2015-08-13 13:05 ` Frederic Konrad
2015-08-13 13:08 ` Paolo Bonzini
2015-08-13 13:19 ` Frederic Konrad
2015-08-28 14:36 ` Peter Maydell
2015-08-29 6:52 ` Paolo Bonzini
2015-08-12 16:40 ` [Qemu-devel] [PATCH 03/10] replace spinlock by QemuMutex Paolo Bonzini
2015-08-13 12:17 ` Frederic Konrad
2015-08-13 13:12 ` Paolo Bonzini
2015-08-13 13:21 ` Frederic Konrad
2015-08-28 14:49 ` Peter Maydell
2015-08-28 14:53 ` Frederic Konrad
2015-08-29 6:51 ` Paolo Bonzini
2015-08-12 16:40 ` [Qemu-devel] [PATCH 04/10] exec-all: remove non-TCG stuff from exec-all.h header Paolo Bonzini
2015-08-28 14:53 ` Peter Maydell
2015-08-29 6:55 ` Paolo Bonzini
2015-08-12 16:40 ` [Qemu-devel] [PATCH 05/10] cpu-exec: elide more icount code if CONFIG_USER_ONLY Paolo Bonzini
2015-08-13 13:14 ` Frederic Konrad
2015-08-13 14:06 ` Paolo Bonzini
2015-08-28 14:56 ` Peter Maydell
2015-08-29 7:07 ` Paolo Bonzini
2015-08-12 16:40 ` [Qemu-devel] [PATCH 06/10] tcg: code_bitmap is not used by user-mode emulation Paolo Bonzini
2015-08-28 14:57 ` Peter Maydell
2015-08-29 7:13 ` Paolo Bonzini
2015-08-12 16:40 ` [Qemu-devel] [PATCH 07/10] tcg: comment on which functions have to be called with mmap_lock held Paolo Bonzini
2015-08-28 15:33 ` Peter Maydell
2015-08-29 6:57 ` Paolo Bonzini
2015-08-12 16:41 ` [Qemu-devel] [PATCH 08/10] tcg: add memory barriers in page_find_alloc accesses Paolo Bonzini
2015-08-12 20:37 ` Emilio G. Cota
2015-08-13 8:13 ` Paolo Bonzini
2015-08-13 19:50 ` Emilio G. Cota
2015-08-28 15:40 ` Peter Maydell
2015-08-29 6:58 ` Paolo Bonzini
2015-08-12 16:41 ` Paolo Bonzini [this message]
2015-08-28 15:42 ` [Qemu-devel] [PATCH 09/10] exec: make mmap_lock/mmap_unlock globally available Peter Maydell
2015-08-12 16:41 ` [Qemu-devel] [PATCH 10/10] cpu-exec: fix lock hierarchy for user-mode emulation Paolo Bonzini
2015-08-28 15:59 ` Peter Maydell
2015-08-12 16:41 ` [Qemu-devel] [PATCH 11/10] tcg: comment on which functions have to be called with tb_lock held Paolo Bonzini
2015-08-13 12:51 ` Frederic Konrad
2015-08-13 12:59 ` Paolo Bonzini
2015-08-13 13:32 ` Frederic Konrad
2015-08-13 14:39 ` Paolo Bonzini
2015-08-13 15:32 ` Peter Maydell
2015-08-13 16:20 ` Paolo Bonzini
2015-08-12 16:41 ` [Qemu-devel] [PATCH 12/10] tcg: protect TBContext with tb_lock Paolo Bonzini
2015-08-13 12:57 ` Frederic Konrad
2015-08-13 13:01 ` Paolo Bonzini
2015-08-13 13:04 ` Frederic Konrad
2015-08-14 9:26 ` [Qemu-devel] [PATCH 00/10] translate-all.c thread-safety Frederic Konrad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439397664-70734-10-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=fred.konrad@greensocs.com \
--cc=mttcg@greensocs.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).