Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-18 Thread Mike Frysinger
On Thu, Jun 18, 2009 at 20:47, Paul Mackerras wrote: > Mike Frysinger writes: >> On Sat, Jun 13, 2009 at 03:10, Paul Mackerras wrote: >> > +typedef struct { >> > +       long long counter; >> > +} atomic64_t; >> >> lack of volatile seems odd compared to: >> include/linux/types.h: >> typedef struct

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-18 Thread Paul Mackerras
Mike Frysinger writes: > On Sat, Jun 13, 2009 at 03:10, Paul Mackerras wrote: > > +typedef struct { > > +       long long counter; > > +} atomic64_t; > > lack of volatile seems odd compared to: > include/linux/types.h: > typedef struct { > volatile int counter; > } atomic_t; > -mike It's onl

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-18 Thread Benjamin Herrenschmidt
On Thu, 2009-06-18 at 19:55 -0400, Mike Frysinger wrote: > On Sat, Jun 13, 2009 at 03:10, Paul Mackerras wrote: > > +typedef struct { > > + long long counter; > > +} atomic64_t; > > lack of volatile seems odd compared to: > include/linux/types.h: > typedef struct { > volatile int counter

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-18 Thread Mike Frysinger
On Sat, Jun 13, 2009 at 03:10, Paul Mackerras wrote: > +typedef struct { > +       long long counter; > +} atomic64_t; lack of volatile seems odd compared to: include/linux/types.h: typedef struct { volatile int counter; } atomic_t; -mike ___ Linuxpp

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-16 Thread Gabriel Paubert
On Sun, Jun 14, 2009 at 04:04:36PM +0300, Avi Kivity wrote: > Paul Mackerras wrote: >> Avi Kivity writes: >> >> >>> An alternative implementation using 64-bit cmpxchg will recover most >>> of the costs of hashed spinlocks. I assume most serious 32-bit >>> architectures have them? >>> >>

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-14 Thread Paul Mackerras
Roland Dreier writes: > FWIW, Nehalem EX actually goes to 8 cores/16 threads per socket. But > worrying about 32-bit performance on Nehalem is a little silly -- this > simplest solution is simply to run a 64-bit kernel. I'm not worried about ANY x86 processor, 32-bit or 64-bit, in fact, since x8

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-14 Thread Roland Dreier
> The new Nehalems provide 8 logical threads in a single socket. All > those threads share a cache, and they have cmpxchg8b anyway, so this > won't matter. FWIW, Nehalem EX actually goes to 8 cores/16 threads per socket. But worrying about 32-bit performance on Nehalem is a little silly -- t

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-14 Thread Avi Kivity
Paul Mackerras wrote: Avi Kivity writes: An alternative implementation using 64-bit cmpxchg will recover most of the costs of hashed spinlocks. I assume most serious 32-bit architectures have them? Have a 64-bit cmpxchg, you mean? x86 is the only one I know of, and it already has a

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-14 Thread Paul Mackerras
Avi Kivity writes: > An alternative implementation using 64-bit cmpxchg will recover most of > the costs of hashed spinlocks. I assume most serious 32-bit > architectures have them? Have a 64-bit cmpxchg, you mean? x86 is the only one I know of, and it already has an atomic64_t implementation

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-14 Thread Avi Kivity
Linus Torvalds wrote: On Sat, 13 Jun 2009, Linus Torvalds wrote: On Sat, 13 Jun 2009, Paul Mackerras wrote: Linus, Andrew: OK if this goes in via the powerpc tree? Ok by me. Btw, do 32-bit architectures really necessarily want 64-bit performance counters? I realize tha

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-13 Thread Arnd Bergmann
On Saturday 13 June 2009, Paul Mackerras wrote: > +extern long long atomic64_read(const atomic64_t *v); > +extern void atomic64_set(atomic64_t *v, long long i); > +extern void atomic64_add(long long a, atomic64_t *v); > +extern long long atomic64_add_return(long long a, atomic64_t *v); > +e

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-13 Thread Ingo Molnar
* Linus Torvalds wrote: > On Sat, 13 Jun 2009, Linus Torvalds wrote: > > > > On Sat, 13 Jun 2009, Paul Mackerras wrote: > > > > > > Linus, Andrew: OK if this goes in via the powerpc tree? > > > > Ok by me. > > Btw, do 32-bit architectures really necessarily want 64-bit > performance counters

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-13 Thread Linus Torvalds
On Sat, 13 Jun 2009, Linus Torvalds wrote: > > On Sat, 13 Jun 2009, Paul Mackerras wrote: > > > > Linus, Andrew: OK if this goes in via the powerpc tree? > > Ok by me. Btw, do 32-bit architectures really necessarily want 64-bit performance counters? I realize that 32-bit counters will overf

Re: [PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-13 Thread Linus Torvalds
On Sat, 13 Jun 2009, Paul Mackerras wrote: > > Linus, Andrew: OK if this goes in via the powerpc tree? Ok by me. Linus ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 1/2] lib: Provide generic atomic64_t implementation

2009-06-13 Thread Paul Mackerras
Many processor architectures have no 64-bit atomic instructions, but we need atomic64_t in order to support the perf_counter subsystem. This adds an implementation of 64-bit atomic operations using hashed spinlocks to provide atomicity. For each atomic operation, the address of the atomic64_t var