Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-26 Thread Paolo Bonzini
: "serge fdrv" , c...@braap.org, "alex >>> bennee" , "sergey fedorov" >>> >>> 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

Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-24 Thread Richard Henderson
, 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_flus

Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-24 Thread Paolo Bonzini
- Original Message - > From: "Richard Henderson" > To: "Paolo Bonzini" , qemu-devel@nongnu.org > Cc: "serge fdrv" , c...@braap.org, "alex bennee" > , "sergey fedorov" > > Sent: Friday, September 23, 2016 8:06:09 PM &

Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-23 Thread Richard Henderson
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 shoul

[Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-23 Thread Paolo Bonzini
From: Sergey Fedorov Use async_safe_run_on_cpu() to make tb_flush() thread safe. This is possible now that code generation does not happen in the middle of execution. It can happen that multiple threads schedule a safe work to flush the translation buffer. To keep statistics and debugging outpu

Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-21 Thread Paolo Bonzini
On 21/09/2016 19:37, Emilio G. Cota wrote: > On Wed, Sep 21, 2016 at 18:19:26 +0200, Paolo Bonzini wrote: >> >> >> On 21/09/2016 18:05, Emilio G. Cota wrote: > +tb_lock(); > + > +/* If it's already been done on request of another CPU, > + * just retry. > + */ >

Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-21 Thread Emilio G. Cota
On Wed, Sep 21, 2016 at 18:19:26 +0200, Paolo Bonzini wrote: > > > On 21/09/2016 18:05, Emilio G. Cota wrote: > >> > +tb_lock(); > >> > + > >> > +/* If it's already been done on request of another CPU, > >> > + * just retry. > >> > + */ > >> > +if (atomic_read(&tcg_ctx.tb_ctx.

Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-21 Thread Paolo Bonzini
On 21/09/2016 18:05, Emilio G. Cota wrote: >> > +tb_lock(); >> > + >> > +/* If it's already been done on request of another CPU, >> > + * just retry. >> > + */ >> > +if (atomic_read(&tcg_ctx.tb_ctx.tb_flush_count) != tb_flush_req) { >> > +goto done; > tb_flush_count is

Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-21 Thread Emilio G. Cota
On Mon, Sep 19, 2016 at 14:50:58 +0200, Paolo Bonzini wrote: > From: Sergey Fedorov > > Use async_safe_run_on_cpu() to make tb_flush() thread safe. This is > possible now that code generation does not happen in the middle of > execution. > > It can happen that multiple threads schedule a safe w

[Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-19 Thread Paolo Bonzini
From: Sergey Fedorov Use async_safe_run_on_cpu() to make tb_flush() thread safe. This is possible now that code generation does not happen in the middle of execution. It can happen that multiple threads schedule a safe work to flush the translation buffer. To keep statistics and debugging outpu

[Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe

2016-09-12 Thread Paolo Bonzini
From: Sergey Fedorov Use async_safe_run_on_cpu() to make tb_flush() thread safe. This is possible now that code generation does not happen in the middle of execution. It can happen that multiple threads schedule a safe work to flush the translation buffer. To keep statistics and debugging outpu