Re: [PATCH] atomic: add *_dec_not_zero
Russell King - ARM Linux wrote: [...] Do we need atomic_dec_not_zero() et.al. in every arch header - is there no generic header which it could be added to? Mike Frysinger already tried to answer it in banlktimctgbto3dsnj3d3r7nggs0kf9...@mail.gmail.com: that's what asm-generic is for. if the arch isnt using it, it's either because the arch needs to convert to it, or they're using SMP and asm-generic doesnt yet support that for atomic.h. for example, the Blackfin port only needed updating for the SMP case. in the non-SMP case, we're getting the def from asm-generic/atomic.h. -mike Feel free to change that but I just followed the style used by all other macros and will not redesign the complete atomic*.h idea. thanks, Sven signature.asc Description: This is a digitally signed message part. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, May 03, 2011 at 11:30:35PM +0200, Sven Eckelmann wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. ... diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index 7e79503..a005265 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h @@ -218,6 +218,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) return c != u; } #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) #define atomic_inc(v)atomic_add(1, v) #define atomic_dec(v)atomic_sub(1, v) @@ -459,6 +460,7 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u) #define atomic64_dec_return(v) atomic64_sub_return(1LL, (v)) #define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL) +#define atomic64_dec_not_zero(v) atomic64_add_unless((v), -1LL, 0LL) #else /* !CONFIG_GENERIC_ATOMIC64 */ #include asm-generic/atomic64.h Do we need atomic_dec_not_zero() et.al. in every arch header - is there no generic header which it could be added to? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, 2011-05-03 at 23:30 +0200, Sven Eckelmann wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. For arch/powerpc: Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org (Sorry for catching up late) Cheers, Ben. diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h index b8f152e..906f49a 100644 --- a/arch/powerpc/include/asm/atomic.h +++ b/arch/powerpc/include/asm/atomic.h @@ -213,6 +213,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) } #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) #define atomic_sub_and_test(a, v)(atomic_sub_return((a), (v)) == 0) #define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0) @@ -469,6 +470,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) } #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) +#define atomic64_dec_not_zero(v) atomic64_add_unless((v), -1, 0) #else /* __powerpc64__ */ #include asm-generic/atomic64.h diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h index c2410af..3d4c58a 100644 --- a/arch/powerpc/include/asm/local.h +++ b/arch/powerpc/include/asm/local.h @@ -134,6 +134,7 @@ static __inline__ int local_add_unless(local_t *l, long a, long u) } #define local_inc_not_zero(l) local_add_unless((l), 1, 0) +#define local_dec_not_zero(l) local_add_unless((l), -1, 0) #define local_sub_and_test(a, l) (local_sub_return((a), (l)) == 0) #define local_dec_and_test(l)(local_dec_return((l)) == 0) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Sun, May 8, 2011 at 05:33, Sven Eckelmann wrote: Russell King - ARM Linux wrote: [...] Do we need atomic_dec_not_zero() et.al. in every arch header - is there no generic header which it could be added to? Mike Frysinger already tried to answer it in banlktimctgbto3dsnj3d3r7nggs0kf9...@mail.gmail.com: that's what asm-generic is for. if the arch isnt using it, it's either because the arch needs to convert to it, or they're using SMP and asm-generic doesnt yet support that for atomic.h. for example, the Blackfin port only needed updating for the SMP case. in the non-SMP case, we're getting the def from asm-generic/atomic.h. Feel free to change that but I just followed the style used by all other macros and will not redesign the complete atomic*.h idea. what you're doing is currently correct. i think merging SMP support into asm-generic for atomic* will take a bit of pondering first. -mike ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
From: Sven Eckelmann s...@narfation.org Date: Tue, 3 May 2011 23:30:35 +0200 Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Reported-by: David S. Miller da...@davemloft.net Signed-off-by: Sven Eckelmann s...@narfation.org Acked-by: David S. Miller da...@davemloft.net ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
* Sven Eckelmann s...@narfation.org wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. arch/x86/include/asm/atomic.h |1 + arch/x86/include/asm/atomic64_64.h |1 + Acked-by: Ingo Molnar mi...@elte.hu Thanks, Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] atomic: add *_dec_not_zero
Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Isn't there a place where a default definition of this can be defined? Instead of adding it separately to every architecture. David ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Wednesday 04 May 2011 10:05:53 David Laight wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Isn't there a place where a default definition of this can be defined? Instead of adding it separately to every architecture. Not that I would know about such a place - and all other atomic* macro definitions also suggest that there is no such place. Kind regards, Sven signature.asc Description: This is a digitally signed message part. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Wed, May 4, 2011 at 04:05, David Laight wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Isn't there a place where a default definition of this can be defined? Instead of adding it separately to every architecture. that's what asm-generic is for. if the arch isnt using it, it's either because the arch needs to convert to it, or they're using SMP and asm-generic doesnt yet support that for atomic.h. for example, the Blackfin port only needed updating for the SMP case. in the non-SMP case, we're getting the def from asm-generic/atomic.h. -mike ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, May 03, 2011 at 11:30:35PM +0200, Sven Eckelmann wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. For the CRIS-part: Acked-by: Jesper Nilsson jesper.nils...@axis.com /^JN - Jesper Nilsson -- Jesper Nilsson -- jesper.nils...@axis.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, May 03, 2011 at 11:30:35PM +0200, Sven Eckelmann wrote: arch/mips/include/asm/atomic.h |2 ++ arch/mips/include/asm/local.h |1 + Acked-by: Ralf Baechle r...@linux-mips.org Ralf ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On 5/3/2011 5:30 PM, Sven Eckelmann wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Reported-by: David S. Miller da...@davemloft.net Signed-off-by: Sven Eckelmann s...@narfation.org [...] arch/tile/include/asm/atomic.h |9 + arch/tile/include/asm/atomic_32.h |1 + Acked-by: Chris Metcalf cmetc...@tilera.com -- Chris Metcalf, Tilera Corp. http://www.tilera.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, May 3, 2011 at 23:30, Sven Eckelmann s...@narfation.org wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. arch/m68k/include/asm/atomic.h | 1 + Acked-by: Geert Uytterhoeven ge...@linux-m68k.org Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Wed, 2011-05-04 at 00:44 -0400, Mike Frysinger wrote: On Tue, May 3, 2011 at 17:30, Sven Eckelmann wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Cc: uclinux-dist-de...@blackfin.uclinux.org --- a/arch/blackfin/include/asm/atomic.h +++ b/arch/blackfin/include/asm/atomic.h @@ -103,6 +103,7 @@ static inline int atomic_test_mask(int mask, atomic_t *v) c != (u); \ }) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) /* * atomic_inc_and_test - increment and test no opinion on the actual idea, but for the Blackfin pieces: Acked-by: Mike Frysinger vap...@gentoo.org This goes for parisc as well. Acked-by: James Bottomley james.bottom...@hansenpartnership.com James ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
Sven Eckelmann s...@narfation.org wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Reported-by: David S. Miller da...@davemloft.net Signed-off-by: Sven Eckelmann s...@narfation.org Acked-by: David Howells dhowe...@redhat.com [MN10300 and FRV] ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, 2011-05-03 at 22:30 +0100, Sven Eckelmann wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. For the ARM changes: Acked-by: Will Deacon will.dea...@arm.com Cheers, Will ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, May 3, 2011 at 5:30 PM, Sven Eckelmann s...@narfation.org wrote: diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index e756d04..7e9434e 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h @@ -200,6 +200,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) } #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) /** * atomic64_add_unless - add unless the number is a given value @@ -226,6 +227,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) } #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) +#define atomic64_dec_not_zero(v) atomic64_add_unless((v), -1, 0) #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) 0) #define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) 0) diff --git a/arch/alpha/include/asm/local.h b/arch/alpha/include/asm/local.h index b9e3e33..09fb327 100644 --- a/arch/alpha/include/asm/local.h +++ b/arch/alpha/include/asm/local.h @@ -79,6 +79,7 @@ static __inline__ long local_sub_return(long i, local_t * l) c != (u); \ }) #define local_inc_not_zero(l) local_add_unless((l), 1, 0) +#define local_dec_not_zero(l) local_add_unless((l), -1, 0) #define local_add_negative(a, l) (local_add_return((a), (l)) 0) Acked-by: Matt Turner matts...@gmail.com [alpha] ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] atomic: add *_dec_not_zero
Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Reported-by: David S. Miller da...@davemloft.net Signed-off-by: Sven Eckelmann s...@narfation.org Cc: David Howells dhowe...@redhat.com Cc: Chris Metcalf cmetc...@tilera.com Cc: x...@kernel.org Cc: linux-al...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: uclinux-dist-de...@blackfin.uclinux.org Cc: linux-cris-ker...@axis.com Cc: linux-i...@vger.kernel.org Cc: linux-m...@ml.linux-m32r.org Cc: linux-m...@lists.linux-m68k.org Cc: linux-m...@linux-mips.org Cc: linux-am33-l...@redhat.com Cc: linux-par...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-s...@vger.kernel.org Cc: linux...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: linux-a...@vger.kernel.org --- David S. Miller recommended this change in https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2011-May/004560.html arch/alpha/include/asm/atomic.h|2 ++ arch/alpha/include/asm/local.h |1 + arch/arm/include/asm/atomic.h |2 ++ arch/avr32/include/asm/atomic.h|1 + arch/blackfin/include/asm/atomic.h |1 + arch/cris/include/asm/atomic.h |1 + arch/frv/include/asm/atomic.h |1 + arch/h8300/include/asm/atomic.h|1 + arch/ia64/include/asm/atomic.h |2 ++ arch/m32r/include/asm/atomic.h |1 + arch/m32r/include/asm/local.h |1 + arch/m68k/include/asm/atomic.h |1 + arch/mips/include/asm/atomic.h |2 ++ arch/mips/include/asm/local.h |1 + arch/mn10300/include/asm/atomic.h |1 + arch/parisc/include/asm/atomic.h |2 ++ arch/powerpc/include/asm/atomic.h |2 ++ arch/powerpc/include/asm/local.h |1 + arch/s390/include/asm/atomic.h |2 ++ arch/sh/include/asm/atomic.h |1 + arch/sparc/include/asm/atomic_32.h |1 + arch/sparc/include/asm/atomic_64.h |2 ++ arch/tile/include/asm/atomic.h |9 + arch/tile/include/asm/atomic_32.h |1 + arch/x86/include/asm/atomic.h |1 + arch/x86/include/asm/atomic64_64.h |1 + arch/xtensa/include/asm/atomic.h |1 + include/asm-generic/atomic-long.h |2 ++ include/asm-generic/atomic.h |1 + include/asm-generic/atomic64.h |1 + include/asm-generic/local.h|1 + include/asm-generic/local64.h |2 ++ 32 files changed, 50 insertions(+), 0 deletions(-) diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index e756d04..7e9434e 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h @@ -200,6 +200,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) } #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) /** * atomic64_add_unless - add unless the number is a given value @@ -226,6 +227,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) } #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) +#define atomic64_dec_not_zero(v) atomic64_add_unless((v), -1, 0) #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) 0) #define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) 0) diff --git a/arch/alpha/include/asm/local.h b/arch/alpha/include/asm/local.h index b9e3e33..09fb327 100644 --- a/arch/alpha/include/asm/local.h +++ b/arch/alpha/include/asm/local.h @@ -79,6 +79,7 @@ static __inline__ long local_sub_return(long i, local_t * l) c != (u); \ }) #define local_inc_not_zero(l) local_add_unless((l), 1, 0) +#define local_dec_not_zero(l) local_add_unless((l), -1, 0) #define local_add_negative(a, l) (local_add_return((a), (l)) 0) diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index 7e79503..a005265 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h @@ -218,6 +218,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) return c != u; } #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) #define atomic_inc(v) atomic_add(1, v) #define atomic_dec(v) atomic_sub(1, v) @@ -459,6 +460,7 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u) #define atomic64_dec_return(v) atomic64_sub_return(1LL, (v)) #define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL) +#define atomic64_dec_not_zero(v) atomic64_add_unless((v), -1LL, 0LL) #else /* !CONFIG_GENERIC_ATOMIC64 */ #include asm-generic/atomic64.h diff --git
Re: [PATCH] atomic: add *_dec_not_zero
On Tue, May 3, 2011 at 17:30, Sven Eckelmann wrote: Introduce an *_dec_not_zero operation. Make this a special case of *_add_unless because batman-adv uses atomic_dec_not_zero in different places like re-broadcast queue or aggregation queue management. There are other non-final patches which may also want to use this macro. Cc: uclinux-dist-de...@blackfin.uclinux.org --- a/arch/blackfin/include/asm/atomic.h +++ b/arch/blackfin/include/asm/atomic.h @@ -103,6 +103,7 @@ static inline int atomic_test_mask(int mask, atomic_t *v) c != (u); \ }) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) /* * atomic_inc_and_test - increment and test no opinion on the actual idea, but for the Blackfin pieces: Acked-by: Mike Frysinger vap...@gentoo.org -mike ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev