mirror of https://github.com/xemu-project/xemu.git
accel/tcg: Unlock mmap_lock after longjmp
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. Acked-by: Alistair Francis <alistair.francis@wdc.com> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
cdf7130851
commit
297368c74d
|
@ -462,13 +462,11 @@ void cpu_exec_step_atomic(CPUState *cpu)
|
||||||
cpu_tb_exec(cpu, tb, &tb_exit);
|
cpu_tb_exec(cpu, tb, &tb_exit);
|
||||||
cpu_exec_exit(cpu);
|
cpu_exec_exit(cpu);
|
||||||
} else {
|
} else {
|
||||||
/*
|
|
||||||
* The mmap_lock is dropped by tb_gen_code if it runs out of
|
|
||||||
* memory.
|
|
||||||
*/
|
|
||||||
#ifndef CONFIG_SOFTMMU
|
#ifndef CONFIG_SOFTMMU
|
||||||
clear_helper_retaddr();
|
clear_helper_retaddr();
|
||||||
tcg_debug_assert(!have_mmap_lock());
|
if (have_mmap_lock()) {
|
||||||
|
mmap_unlock();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (qemu_mutex_iothread_locked()) {
|
if (qemu_mutex_iothread_locked()) {
|
||||||
qemu_mutex_unlock_iothread();
|
qemu_mutex_unlock_iothread();
|
||||||
|
@ -936,7 +934,9 @@ int cpu_exec(CPUState *cpu)
|
||||||
|
|
||||||
#ifndef CONFIG_SOFTMMU
|
#ifndef CONFIG_SOFTMMU
|
||||||
clear_helper_retaddr();
|
clear_helper_retaddr();
|
||||||
tcg_debug_assert(!have_mmap_lock());
|
if (have_mmap_lock()) {
|
||||||
|
mmap_unlock();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (qemu_mutex_iothread_locked()) {
|
if (qemu_mutex_iothread_locked()) {
|
||||||
qemu_mutex_unlock_iothread();
|
qemu_mutex_unlock_iothread();
|
||||||
|
|
|
@ -80,10 +80,7 @@ MMUAccessType adjust_signal_pc(uintptr_t *pc, bool is_write)
|
||||||
* (and if the translator doesn't handle page boundaries correctly
|
* (and if the translator doesn't handle page boundaries correctly
|
||||||
* there's little we can do about that here). Therefore, do not
|
* there's little we can do about that here). Therefore, do not
|
||||||
* trigger the unwinder.
|
* trigger the unwinder.
|
||||||
*
|
|
||||||
* Like tb_gen_code, release the memory lock before cpu_loop_exit.
|
|
||||||
*/
|
*/
|
||||||
mmap_unlock();
|
|
||||||
*pc = 0;
|
*pc = 0;
|
||||||
return MMU_INST_FETCH;
|
return MMU_INST_FETCH;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue