From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLCQ0-00040d-7z for qemu-devel@nongnu.org; Thu, 07 Jul 2016 12:44:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLCPx-0002wy-1o for qemu-devel@nongnu.org; Thu, 07 Jul 2016 12:44:51 -0400 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]:33112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLCPw-0002wl-Pl for qemu-devel@nongnu.org; Thu, 07 Jul 2016 12:44:48 -0400 Received: by mail-lf0-x230.google.com with SMTP id f6so15224249lfg.0 for ; Thu, 07 Jul 2016 09:44:48 -0700 (PDT) From: Sergey Fedorov Date: Thu, 7 Jul 2016 19:44:38 +0300 Message-Id: <1467909880-18834-2-git-send-email-sergey.fedorov@linaro.org> In-Reply-To: <1467909880-18834-1-git-send-email-sergey.fedorov@linaro.org> References: <1467735496-16256-7-git-send-email-alex.bennee@linaro.org> <1467909880-18834-1-git-send-email-sergey.fedorov@linaro.org> Subject: [Qemu-devel] [PATCH 1/3] tcg: Introduce mmap_lock_reset() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Cc: patches@linaro.org, Sergey Fedorov , mttcg@listserver.greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, rth@twiddle.net, mark.burton@greensocs.com, pbonzini@redhat.com, jan.kiszka@siemens.com, peter.maydell@linaro.org, claudio.fontana@huawei.com, Peter Crosthwaite , Sergey Fedorov , Riku Voipio From: Sergey Fedorov Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov --- bsd-user/mmap.c | 7 +++++++ include/exec/exec-all.h | 2 ++ linux-user/mmap.c | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 610f91b28584..b2e5909b03c4 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -42,6 +42,13 @@ void mmap_unlock(void) } } +void mmap_lock_reset(void) +{ + if (mmap_lock_count) { + pthread_mutex_unlock(&mmap_mutex); + } +} + /* Grab lock to make sure things are in a consistent state after fork(). */ void mmap_fork_start(void) { diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index c1f59fa59d2c..0375acb5ab40 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -369,6 +369,7 @@ void tlb_fill(CPUState *cpu, target_ulong addr, int is_write, int mmu_idx, #if defined(CONFIG_USER_ONLY) void mmap_lock(void); void mmap_unlock(void); +void mmap_lock_reset(void); static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) { @@ -377,6 +378,7 @@ static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong #else static inline void mmap_lock(void) {} static inline void mmap_unlock(void) {} +static inline void mmap_lock_reset(void) {} /* cputlb.c */ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr); diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c4371d943a85..4cd998f96766 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -43,6 +43,13 @@ void mmap_unlock(void) } } +void mmap_lock_reset(void) +{ + if (mmap_lock_count) { + pthread_mutex_unlock(&mmap_mutex); + } +} + /* Grab lock to make sure things are in a consistent state after fork(). */ void mmap_fork_start(void) { -- 1.9.1