[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/33] accel/tcg: Unlock mmap_lock after longjmp
From: |
Richard Henderson |
Subject: |
[PATCH v2 13/33] accel/tcg: Unlock mmap_lock after longjmp |
Date: |
Tue, 16 Aug 2022 15:33:40 -0500 |
The mmap_lock is held around tb_gen_code. While the comment
is correct that the lock is dropped when tb_gen_code runs out
of memory, the lock is *not* dropped when an exception is
raised reading code for translation.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/tcg/cpu-exec.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 711859d4d4..7887af6f45 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -523,13 +523,11 @@ void cpu_exec_step_atomic(CPUState *cpu)
cpu_tb_exec(cpu, tb, &tb_exit);
cpu_exec_exit(cpu);
} else {
- /*
- * The mmap_lock is dropped by tb_gen_code if it runs out of
- * memory.
- */
#ifndef CONFIG_SOFTMMU
clear_helper_retaddr();
- tcg_debug_assert(!have_mmap_lock());
+ if (have_mmap_lock()) {
+ mmap_unlock();
+ }
#endif
if (qemu_mutex_iothread_locked()) {
qemu_mutex_unlock_iothread();
@@ -936,7 +934,9 @@ int cpu_exec(CPUState *cpu)
#ifndef CONFIG_SOFTMMU
clear_helper_retaddr();
- tcg_debug_assert(!have_mmap_lock());
+ if (have_mmap_lock()) {
+ mmap_unlock();
+ }
#endif
if (qemu_mutex_iothread_locked()) {
qemu_mutex_unlock_iothread();
--
2.34.1
- [PATCH v2 02/33] linux-user/hppa: Allocate page zero as a commpage, (continued)
- [PATCH v2 02/33] linux-user/hppa: Allocate page zero as a commpage, Richard Henderson, 2022/08/16
- [PATCH v2 03/33] linux-user/x86_64: Allocate vsyscall page as a commpage, Richard Henderson, 2022/08/16
- [PATCH v2 05/33] tests/tcg/i386: Move smc_code2 to an executable section, Richard Henderson, 2022/08/16
- [PATCH v2 06/33] accel/tcg: Remove PageDesc code_bitmap, Richard Henderson, 2022/08/16
- [PATCH v2 11/33] accel/tcg: Use probe_access_internal for softmmu get_page_addr_code_hostp, Richard Henderson, 2022/08/16
- [PATCH v2 09/33] accel/tcg: Move qemu_ram_addr_from_host_nofail to physmem.c, Richard Henderson, 2022/08/16
- [PATCH v2 08/33] accel/tcg: Make tb_htable_lookup static, Richard Henderson, 2022/08/16
- [PATCH v2 04/33] linux-user: Honor PT_GNU_STACK, Richard Henderson, 2022/08/16
- [PATCH v2 14/33] accel/tcg: Raise PROT_EXEC exception early, Richard Henderson, 2022/08/16
- [PATCH v2 13/33] accel/tcg: Unlock mmap_lock after longjmp,
Richard Henderson <=
- [PATCH v2 19/33] accel/tcg: Use DisasContextBase in plugin_gen_tb_start, Richard Henderson, 2022/08/16
- [PATCH v2 21/33] include/hw/core: Create struct CPUJumpCache, Richard Henderson, 2022/08/16
- [PATCH v2 15/33] accel/tcg: Introduce is_same_page(), Richard Henderson, 2022/08/16
- [PATCH v2 17/33] accel/tcg: Add pc and host_pc params to gen_intermediate_code, Richard Henderson, 2022/08/16
- [PATCH v2 07/33] accel/tcg: Use bool for page_find_alloc, Richard Henderson, 2022/08/16
- [PATCH v2 20/33] accel/tcg: Do not align tb->page_addr[0], Richard Henderson, 2022/08/16
- [PATCH v2 12/33] accel/tcg: Add nofault parameter to get_page_addr_code_hostp, Richard Henderson, 2022/08/16
- [PATCH v2 18/33] accel/tcg: Add fast path for translator_ld*, Richard Henderson, 2022/08/16
- [PATCH v2 10/33] accel/tcg: Properly implement get_page_addr_code for user-only, Richard Henderson, 2022/08/16
- [PATCH v2 24/33] accel/tcg: Split log_cpu_exec into inline and slow path, Richard Henderson, 2022/08/16