[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 42/43] exec: make mmap_lock/mmap_unlock globally avai
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 42/43] exec: make mmap_lock/mmap_unlock globally available |
Date: |
Wed, 9 Sep 2015 15:50:12 +0200 |
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.
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
bsd-user/qemu.h | 2 --
include/exec/exec-all.h | 6 ++++++
linux-user/qemu.h | 2 --
translate-all.c | 5 -----
4 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 21cc602..735cb40 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -211,8 +211,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 59544d4..05a5d5c 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -374,11 +374,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 a12139b..e3c5c5e 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -466,11 +466,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. */
--
2.4.3
- [Qemu-devel] [PULL 31/43] vhost-scsi: fix wrong vhost-scsi firmware path, (continued)
- [Qemu-devel] [PULL 31/43] vhost-scsi: fix wrong vhost-scsi firmware path, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 32/43] configure: factor out adding disas configure, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 34/43] configure: Add support for jemalloc, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 35/43] scripts/dump-guest-memory.py: fix after RAMBlock change, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 33/43] add macro file for coccinelle, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 37/43] cpus: remove tcg_halt_cond and tcg_cpu_thread globals, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 36/43] cpus: protect work list with work_mutex, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 41/43] tcg: comment on which functions have to be called with mmap_lock held, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 39/43] remove unused spinlock., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 40/43] tcg: add memory barriers in page_find_alloc accesses, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 42/43] exec: make mmap_lock/mmap_unlock globally available,
Paolo Bonzini <=
- [Qemu-devel] [PULL 38/43] replace spinlock by QemuMutex., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 43/43] cpu-exec: fix lock hierarchy for user-mode emulation, Paolo Bonzini, 2015/09/09
- Re: [Qemu-devel] [PULL 00/43] First batch of misc changes for 2.5 (2015-09-09), Peter Maydell, 2015/09/09