From: Emilio G. Cota Date: Sat, 2 Dec 2017 00:47:08 +0000 (-0500) Subject: translate-all: use cpu_in_exclusive_work_context() in tb_flush X-Git-Tag: v4.2.0-rc0~20^2~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=136094d0b22a3278029485648e4d83a4bf3cb4d6;p=thirdparty%2Fqemu.git translate-all: use cpu_in_exclusive_work_context() in tb_flush tb_flush will be called by the plugin module from a safe work environment. Prepare for that. Suggested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 66d4bc4341a..0a08fcda3e8 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1268,8 +1268,13 @@ void tb_flush(CPUState *cpu) { if (tcg_enabled()) { unsigned tb_flush_count = atomic_mb_read(&tb_ctx.tb_flush_count); - async_safe_run_on_cpu(cpu, do_tb_flush, - RUN_ON_CPU_HOST_INT(tb_flush_count)); + + if (cpu_in_exclusive_context(cpu)) { + do_tb_flush(cpu, RUN_ON_CPU_HOST_INT(tb_flush_count)); + } else { + async_safe_run_on_cpu(cpu, do_tb_flush, + RUN_ON_CPU_HOST_INT(tb_flush_count)); + } } }