qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 04/16] tcg: move tb_ctx.tb_phys_invalidate_count


From: Emilio G. Cota
Subject: Re: [Qemu-devel] [PATCH 04/16] tcg: move tb_ctx.tb_phys_invalidate_count to tcg_ctx
Date: Thu, 5 Apr 2018 13:18:41 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

On Thu, Mar 29, 2018 at 11:06:07 +0100, Alex Bennée wrote:
> Emilio G. Cota <address@hidden> 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 <address@hidden>

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]