On Thu, Mar 29, 2018 at 11:06:07 +0100, Alex Bennée wrote: > Emilio G. Cota <c...@braap.org> writes: (snip) > > diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c > > index 3a51d49..20ad3fc 100644 > > --- a/accel/tcg/translate-all.c > > +++ b/accel/tcg/translate-all.c > > @@ -1072,7 +1072,8 @@ void tb_phys_invalidate(TranslationBlock *tb, > > tb_page_addr_t page_addr) > > /* suppress any remaining jumps to this TB */ > > tb_jmp_unlink(tb); > > > > - tb_ctx.tb_phys_invalidate_count++; > > + atomic_set(&tcg_ctx->tb_phys_invalidate_count, > > + tcg_ctx->tb_phys_invalidate_count + 1); > > We do have an atomic_inc helper for this or we need comment that we only > have atomic_reads() to worry about hence no races. > > Otherwise: > > Reviewed-by: Alex Bennée <alex.ben...@linaro.org>
tcg_ctx is per-thread (or otherwise tb_lock is held here), so yes we only worry here about concurrent atomic_reads. This is common enough not to need a comment, me thinks. [we have quite a few more instances of atomic_set(foo, foo + 1), for instance when incrementing TCGProfile counts.] Thanks, Emilio