* [PATCH] atomic: fix atomic_long_cmpxchg/xchg for 64 bit architectures
@ 2009-04-29 12:36 Heiko Carstens
2009-04-29 12:48 ` Mathieu Desnoyers
2009-04-30 8:31 ` Ingo Molnar
0 siblings, 2 replies; 3+ messages in thread
From: Heiko Carstens @ 2009-04-29 12:36 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton
Cc: Mathieu Desnoyers, linux-kernel, Steven Rostedt, Ingo Molnar
From: Heiko Carstens <heiko.carstens@de.ibm.com>
On a linux-next allyesconfig build:
kernel/trace/ring_buffer.c:1726:
warning: passing argument 1 of 'atomic_cmpxchg' from incompatible pointer type
linux-next/arch/s390/include/asm/atomic.h:112:
note: expected 'struct atomic_t *' but argument is of type 'struct atomic64_t *'
atomic_long_cmpxchg and atomic_long_xchg are incorrectly defined for
64 bit architectures. They should be mapped to the atomic64_* variants.
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
include/asm-generic/atomic.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-next/include/asm-generic/atomic.h
===================================================================
--- linux-next.orig/include/asm-generic/atomic.h
+++ linux-next/include/asm-generic/atomic.h
@@ -132,9 +132,9 @@ static inline long atomic_long_add_unles
#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
#define atomic_long_cmpxchg(l, old, new) \
- (atomic_cmpxchg((atomic64_t *)(l), (old), (new)))
+ (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
#define atomic_long_xchg(v, new) \
- (atomic_xchg((atomic64_t *)(l), (new)))
+ (atomic64_xchg((atomic64_t *)(l), (new)))
#else /* BITS_PER_LONG == 64 */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] atomic: fix atomic_long_cmpxchg/xchg for 64 bit architectures
2009-04-29 12:36 [PATCH] atomic: fix atomic_long_cmpxchg/xchg for 64 bit architectures Heiko Carstens
@ 2009-04-29 12:48 ` Mathieu Desnoyers
2009-04-30 8:31 ` Ingo Molnar
1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2009-04-29 12:48 UTC (permalink / raw)
To: Heiko Carstens
Cc: Linus Torvalds, Andrew Morton, linux-kernel, Steven Rostedt, Ingo Molnar
* Heiko Carstens (heiko.carstens@de.ibm.com) wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> On a linux-next allyesconfig build:
>
> kernel/trace/ring_buffer.c:1726:
> warning: passing argument 1 of 'atomic_cmpxchg' from incompatible pointer type
> linux-next/arch/s390/include/asm/atomic.h:112:
> note: expected 'struct atomic_t *' but argument is of type 'struct atomic64_t *'
>
> atomic_long_cmpxchg and atomic_long_xchg are incorrectly defined for
> 64 bit architectures. They should be mapped to the atomic64_* variants.
>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
> include/asm-generic/atomic.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-next/include/asm-generic/atomic.h
> ===================================================================
> --- linux-next.orig/include/asm-generic/atomic.h
> +++ linux-next/include/asm-generic/atomic.h
> @@ -132,9 +132,9 @@ static inline long atomic_long_add_unles
> #define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
>
> #define atomic_long_cmpxchg(l, old, new) \
> - (atomic_cmpxchg((atomic64_t *)(l), (old), (new)))
> + (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
> #define atomic_long_xchg(v, new) \
> - (atomic_xchg((atomic64_t *)(l), (new)))
> + (atomic64_xchg((atomic64_t *)(l), (new)))
Other architectures usually define something along the lines of :
include/asm/atomic.h:#define atomic64_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
This is why they did not care about calling atomic_cmpxchg or
atomic64_cmpxchg.
This fix looks good. Thanks !
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
>
> #else /* BITS_PER_LONG == 64 */
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] atomic: fix atomic_long_cmpxchg/xchg for 64 bit architectures
2009-04-29 12:36 [PATCH] atomic: fix atomic_long_cmpxchg/xchg for 64 bit architectures Heiko Carstens
2009-04-29 12:48 ` Mathieu Desnoyers
@ 2009-04-30 8:31 ` Ingo Molnar
1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2009-04-30 8:31 UTC (permalink / raw)
To: Heiko Carstens
Cc: Linus Torvalds, Andrew Morton, Mathieu Desnoyers, linux-kernel,
Steven Rostedt
* Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> On a linux-next allyesconfig build:
>
> kernel/trace/ring_buffer.c:1726:
> warning: passing argument 1 of 'atomic_cmpxchg' from incompatible pointer type
> linux-next/arch/s390/include/asm/atomic.h:112:
> note: expected 'struct atomic_t *' but argument is of type 'struct atomic64_t *'
>
> atomic_long_cmpxchg and atomic_long_xchg are incorrectly defined for
> 64 bit architectures. They should be mapped to the atomic64_* variants.
>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
> include/asm-generic/atomic.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-next/include/asm-generic/atomic.h
> ===================================================================
> --- linux-next.orig/include/asm-generic/atomic.h
> +++ linux-next/include/asm-generic/atomic.h
> @@ -132,9 +132,9 @@ static inline long atomic_long_add_unles
> #define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
>
> #define atomic_long_cmpxchg(l, old, new) \
> - (atomic_cmpxchg((atomic64_t *)(l), (old), (new)))
> + (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
> #define atomic_long_xchg(v, new) \
> - (atomic_xchg((atomic64_t *)(l), (new)))
> + (atomic64_xchg((atomic64_t *)(l), (new)))
Acked-by: Ingo Molnar <mingo@elte.hu>
That's due to the local_cmpchg() use the tracing tree grew recently,
right? It appears it was never used in generic code before.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-30 8:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-29 12:36 [PATCH] atomic: fix atomic_long_cmpxchg/xchg for 64 bit architectures Heiko Carstens
2009-04-29 12:48 ` Mathieu Desnoyers
2009-04-30 8:31 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®