diff mbox

[09/10] exec: make mmap_lock/mmap_unlock globally available

Message ID 1439397664-70734-10-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Aug. 12, 2015, 4:41 p.m. UTC
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(-)

Comments

Peter Maydell Aug. 28, 2015, 3:42 p.m. UTC | #1
On 12 August 2015 at 17:41, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 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);
>

Stray whitespace change.

Otherwise

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox

Patch

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.  */