----- Original Message -----
> From: "Richard Henderson" <r...@twiddle.net>
> To: "Paolo Bonzini" <pbonz...@redhat.com>, qemu-devel@nongnu.org
> Cc: "serge fdrv" <serge.f...@gmail.com>, c...@braap.org, "alex bennee" 
> <alex.ben...@linaro.org>, "sergey fedorov"
> <sergey.fedo...@linaro.org>
> Sent: Friday, September 23, 2016 8:06:09 PM
> Subject: Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe
> 
> On 09/23/2016 12:31 AM, Paolo Bonzini wrote:
> > +    unsigned tb_flush_req = (unsigned) (uintptr_t) data;
> 
> Extra cast?
> 
> > -    tcg_ctx.tb_ctx.tb_flush_count++;
> > +    atomic_inc(&tcg_ctx.tb_ctx.tb_flush_count);
> 
> Since this is the only place this value is incremented, and we're under a
> lock,
> it should be cheaper to use
> 
>    atomic_mb_set(&tcg_ctx.tb_ctx.tb_flush_count, tb_flush_req + 1);

atomic_set will do even.  Though it's not really a fast path, which is
why I went for atomic_inc.

> > +        uintptr_t tb_flush_req = (uintptr_t)
> > +            atomic_read(&tcg_ctx.tb_ctx.tb_flush_count);
> 
> Extra cast?

Yeah.

Paolo

> That said, it's correct as-is so,
> 
> Reviewed-by: Richard Henderson <r...@twiddle.net>
> 
> 
> r~
> 

Reply via email to