[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/10] tcg: update the cpu running flag in cpu_exec_step_atomic
From: |
Richard Henderson |
Subject: |
[PULL 01/10] tcg: update the cpu running flag in cpu_exec_step_atomic |
Date: |
Sat, 23 Jan 2021 08:50:11 -1000 |
From: Douglas Crosher <dtc-ubuntu@scieneer.com>
The cpu_exec_step_atomic() function is called with the cpu->running
clear and proceeds to run target code without setting this flag. If
this target code generates an exception then handle_cpu_signal() will
unnecessarily abort. For example if atomic code generates a memory
protection fault.
This patch at least sets and clears this running flag, and adds some
assertions to help detect other cases.
Signed-off-by: Douglas Crosher <dtc-ubuntu@scieneer.com>
Message-Id: <a272c656-f7c5-019d-1cc0-499b8f80f2fc@scieneer.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/tcg/cpu-exec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index e0df9b6a1d..8053aa3f11 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -285,6 +285,9 @@ void cpu_exec_step_atomic(CPUState *cpu)
if (sigsetjmp(cpu->jmp_env, 0) == 0) {
start_exclusive();
+ g_assert(cpu == current_cpu);
+ g_assert(!cpu->running);
+ cpu->running = true;
tb = tb_lookup__cpu_state(cpu, &pc, &cs_base, &flags, cf_mask);
if (tb == NULL) {
@@ -323,6 +326,7 @@ void cpu_exec_step_atomic(CPUState *cpu)
*/
g_assert(cpu_in_exclusive_context(cpu));
parallel_cpus = true;
+ cpu->running = false;
end_exclusive();
}
--
2.25.1
- [PULL 00/10] tcg patch queue, Richard Henderson, 2021/01/23
- [PULL 01/10] tcg: update the cpu running flag in cpu_exec_step_atomic,
Richard Henderson <=
- [PULL 03/10] tcg: Optimize inline dup_const for MO_64, Richard Henderson, 2021/01/23
- [PULL 05/10] accel/tcg: Make cpu_gen_init() static, Richard Henderson, 2021/01/23
- [PULL 04/10] tcg: Increase the static number of temporaries, Richard Henderson, 2021/01/23
- [PULL 02/10] qemu/compiler: Split out qemu_build_not_reached_always, Richard Henderson, 2021/01/23
- [PULL 07/10] accel/tcg: Restrict tb_gen_code() from other accelerators, Richard Henderson, 2021/01/23
- [PULL 06/10] accel/tcg: Move tb_flush_jmp_cache() to cputlb.c, Richard Henderson, 2021/01/23
- [PULL 08/10] accel/tcg: Declare missing cpu_loop_exit*() stubs, Richard Henderson, 2021/01/23
- [PULL 09/10] accel/tcg: Restrict cpu_io_recompile() from other accelerators, Richard Henderson, 2021/01/23
- [PULL 10/10] tcg: Toggle page execution for Apple Silicon, Richard Henderson, 2021/01/23
- Re: [PULL 00/10] tcg patch queue, Richard Henderson, 2021/01/23