Emilio G. Cota <[email protected]> writes:
> tb_flush will be called by the plugin module from a safe > work environment. Prepare for that. > > Suggested-by: Alex Bennée <[email protected]> > Signed-off-by: Emilio G. Cota <[email protected]> Reviewed-by: Alex Bennée <[email protected]> > --- > accel/tcg/translate-all.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c > index 038d82fdb5..62d5e13185 100644 > --- a/accel/tcg/translate-all.c > +++ b/accel/tcg/translate-all.c > @@ -1269,8 +1269,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_work_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)); > + } > } > } -- Alex Bennée
