From 378df4b23753a11be650af7664ca76bc75cb9f01 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 22 Feb 2013 18:10:03 +0000 Subject: Handle CPU interrupts by inline checking of a flag Fix some of the nasty TCG race conditions and crashes by implementing cpu_exit() as setting a flag which is checked at the start of each TB. This avoids crashes if a thread or signal handler calls cpu_exit() while the execution thread is itself modifying the TB graph (which may happen in system emulation mode as well as in linux-user mode with a multithreaded guest binary). This fixes the crashes seen in LP:668799; however there are another class of crashes described in LP:1098729 which stem from the fact that in linux-user with a multithreaded guest all threads will use and modify the same global TCG date structures (including the generated code buffer) without any kind of locking. This means that multithreaded guest binaries are still in the "unsupported" category. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Signed-off-by: Blue Swirl --- translate-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'translate-all.c') diff --git a/translate-all.c b/translate-all.c index b50fb89528..9741d96395 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1475,7 +1475,7 @@ static void tcg_handle_interrupt(CPUArchState *env, int mask) cpu_abort(env, "Raised interrupt while not in I/O function"); } } else { - cpu_unlink_tb(cpu); + cpu->tcg_exit_req = 1; } } @@ -1626,7 +1626,7 @@ void cpu_interrupt(CPUArchState *env, int mask) CPUState *cpu = ENV_GET_CPU(env); env->interrupt_request |= mask; - cpu_unlink_tb(cpu); + cpu->tcg_exit_req = 1; } /* -- cgit v1.2.1