Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-18 Thread Richard Henderson
On 9/18/18 12:04 PM, Peter Maydell wrote: > Does libatomic give us a firm guarantee that for 32-bit > types it will definitely produce an inline atomic access > insn that will interwork with what we're using? At the > moment our guard against this going wrong is that we don't > link against libatom

Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-18 Thread Peter Maydell
On 18 September 2018 at 19:42, Emilio G. Cota wrote: > We already have these. For instance: > > - sTLB lookups can happen concurrently with invalidations > to the same sTLB from another core (via tlb_reset_dirty) > > - icount_decr is written to by cpu_exit, and is read > at the beginning of ea

Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-18 Thread Emilio G. Cota
On Tue, Sep 18, 2018 at 10:23:32 -0300, Murilo Opsfelder Araujo wrote: > On Tue, Sep 11, 2018 at 04:43:04PM -0400, Emilio G. Cota wrote: > > On Tue, Sep 11, 2018 at 05:43:38 -0700, Richard Henderson wrote: > > > On 09/10/2018 04:27 PM, Emilio G. Cota wrote: > > > > +#define GEN_READ(name, type)

Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-18 Thread Emilio G. Cota
On Tue, Sep 18, 2018 at 16:55:56 +0100, Peter Maydell wrote: > On 11 September 2018 at 21:43, Emilio G. Cota wrote: > > On Tue, Sep 11, 2018 at 05:43:38 -0700, Richard Henderson wrote: > >> Is this any better than using libatomic? > > > > I didn't think of using libatomic. I just checked the sourc

Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-18 Thread Peter Maydell
On 11 September 2018 at 21:43, Emilio G. Cota wrote: > On Tue, Sep 11, 2018 at 05:43:38 -0700, Richard Henderson wrote: >> Is this any better than using libatomic? > > I didn't think of using libatomic. I just checked the source > code and it's quite similar: > - It uses 64 locks instead of 16 ($p

Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-18 Thread Murilo Opsfelder Araujo
On Tue, Sep 11, 2018 at 04:43:04PM -0400, Emilio G. Cota wrote: > On Tue, Sep 11, 2018 at 05:43:38 -0700, Richard Henderson wrote: > > On 09/10/2018 04:27 PM, Emilio G. Cota wrote: > > > +#define GEN_READ(name, type)\ > > > +type name(const type *ptr) \ > >

Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-11 Thread Emilio G. Cota
On Tue, Sep 11, 2018 at 05:43:38 -0700, Richard Henderson wrote: > On 09/10/2018 04:27 PM, Emilio G. Cota wrote: > > +#define GEN_READ(name, type)\ > > +type name(const type *ptr) \ > > +{ \ > > +QemuSpin

Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-11 Thread Richard Henderson
On 09/10/2018 04:27 PM, Emilio G. Cota wrote: > +#define GEN_READ(name, type)\ > +type name(const type *ptr) \ > +{ \ > +QemuSpin *lock = addr_to_lock(ptr); \ > +type ret;

[Qemu-devel] [PATCH v2 02/12] util: add atomic64

2018-09-10 Thread Emilio G. Cota
This introduces read/set accessors for int64_t and uint64_t. Signed-off-by: Emilio G. Cota --- include/qemu/atomic.h | 34 ++ util/atomic64.c | 83 +++ util/cacheinfo.c | 3 ++ util/Makefile.objs| 1 + 4 files changed, 121