fred.kon...@greensocs.com writes: > From: KONRAD Frederic <fred.kon...@greensocs.com> > > tb_flush is not thread safe we definitely need to exit VCPUs to do that. > This introduces tb_flush_safe which just creates an async safe work which will > do a tb_flush later. > > Signed-off-by: KONRAD Frederic <fred.kon...@greensocs.com> > --- > include/exec/exec-all.h | 1 + > translate-all.c | 15 +++++++++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h > index 484c351..b5e4fb3 100644 > --- a/include/exec/exec-all.h > +++ b/include/exec/exec-all.h > @@ -219,6 +219,7 @@ static inline unsigned int > tb_phys_hash_func(tb_page_addr_t pc) > > void tb_free(TranslationBlock *tb); > void tb_flush(CPUArchState *env); > +void tb_flush_safe(CPUArchState *env); > void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); > > #if defined(USE_DIRECT_JUMP) > diff --git a/translate-all.c b/translate-all.c > index 468648d..8bd8fe8 100644 > --- a/translate-all.c > +++ b/translate-all.c > @@ -815,6 +815,21 @@ static void page_flush_tb(void) > } > } > > +static void tb_flush_work(void *opaque) > +{ > + CPUArchState *env = opaque; > + tb_flush(env); > +} > + > +void tb_flush_safe(CPUArchState *env) > +{ > +#if 0 /* !MTTCG */ > + tb_flush(env); > +#else > + async_run_safe_work_on_cpu(ENV_GET_CPU(env), tb_flush_work, env); > +#endif /* MTTCG */ > +}
Same comments about build system fixups. > + > /* flush all the translation blocks */ > /* XXX: tb_flush is currently not thread safe */ > void tb_flush(CPUArchState *env1) -- Alex Bennée