Peter Zijlstra
b53d6bedbe
locking/atomic: Remove linux/atomic.h:atomic_fetch_or()
...
Since all architectures have this implemented now natively, remove this
dead code.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2016-06-16 10:48:32 +02:00
Peter Zijlstra
1a6eafacd4
locking/atomic, arch/avr32: Implement atomic_fetch_{add,sub,and,or,xor}()
...
Implement FETCH-OP atomic primitives, these are very similar to the
existing OP-RETURN primitives we already have, except they return the
value of the atomic variable _before_ modification.
This is especially useful for irreversible operations -- such as
bitops (because it becomes impossible to reconstruct the state prior
to modification).
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com >
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2016-06-16 10:48:23 +02:00
Peter Zijlstra
62e8a3258b
atomic, arch: Audit atomic_{read,set}()
...
This patch makes sure that atomic_{read,set}() are at least
{READ,WRITE}_ONCE().
We already had the 'requirement' that atomic_read() should use
ACCESS_ONCE(), and most archs had this, but a few were lacking.
All are now converted to use READ_ONCE().
And, by a symmetry and general paranoia argument, upgrade atomic_set()
to use WRITE_ONCE().
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: james.hogan@imgtec.com
Cc: linux-kernel@vger.kernel.org
Cc: oleg@redhat.com
Cc: will.deacon@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-09-23 09:54:28 +02:00
Peter Zijlstra
e6942b7de2
atomic: Provide atomic_{or,xor,and}
...
Implement atomic logic ops -- atomic_{or,xor,and}.
These will replace the atomic_{set,clear}_mask functions that are
available on some archs.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2015-07-27 14:06:24 +02:00
Peter Zijlstra
f8a570e270
avr32: Provide atomic_{or,xor,and}
...
Implement atomic logic ops -- atomic_{or,xor,and}.
These will replace the atomic_{set,clear}_mask functions that are
available on some archs.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2015-07-27 14:06:22 +02:00
Pranith Kumar
2291059c85
locking,arch: Use ACCESS_ONCE() instead of cast to volatile in atomic_read()
...
Use the much more reader friendly ACCESS_ONCE() instead of the cast to volatile.
This is purely a stylistic change.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com >
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com >
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no >
Acked-by: Max Filippov <jcmvbkbc@gmail.com >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: linux-arch@vger.kernel.org
Link: http://lkml.kernel.org/r/1411482607-20948-1-git-send-email-bobby.prani@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2014-10-03 06:06:23 +02:00
Peter Zijlstra
d325209b60
locking,arch,avr32: Fold atomic_ops
...
Many of the atomic op implementations are the same except for one
instruction; fold the lot into a few CPP macros and reduce LoC.
This also prepares for easy addition of new ops.
Requires the asm_op because of eor.
AVR32 is a bit special in that its ADD/SUB instructions are not
symmetric. Its SUB instruction allows for an 21bit immediate.
Signed-off-by: Peter Zijlstra <peterz@infradead.org >
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no >
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com >
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com >
Link: http://lkml.kernel.org/r/20140531141445.GD16155@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2014-08-14 12:48:05 +02:00
Peter Zijlstra
710adaa913
arch,avr32: Convert smp_mb__*()
...
AVR32's mb() implementation is a compiler barrier(), therefore it all
doesn't matter, fully rely on whatever asm-generic/barrier.h
generates.
Signed-off-by: Peter Zijlstra <peterz@infradead.org >
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com >
Link: http://lkml.kernel.org/n/tip-8gow97a7mapmnec0pvf729pj@git.kernel.org
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com >
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2014-04-18 11:40:33 +02:00
David Howells
ae47394658
Disintegrate asm/system.h for AVR32
...
Disintegrate asm/system.h for AVR32. This has not been compiled at all.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Haavard Skinnemoen <hskinnemoen@gmail.com >
2012-03-28 18:30:01 +01:00
Arun Sharma
7847777a45
atomic: cleanup asm-generic atomic*.h inclusion
...
After changing all consumers of atomics to include <linux/atomic.h>, we
ran into some compile time errors due to this dependency chain:
linux/atomic.h
-> asm/atomic.h
-> asm-generic/atomic-long.h
where atomic-long.h could use funcs defined later in linux/atomic.h
without a prototype. This patches moves the code that includes
asm-generic/atomic*.h to linux/atomic.h.
Archs that need <asm-generic/atomic64.h> need to select
CONFIG_GENERIC_ATOMIC64 from now on (some of them used to include it
unconditionally).
Compile tested on i386 and x86_64 with allnoconfig.
Signed-off-by: Arun Sharma <asharma@fb.com >
Cc: Eric Dumazet <eric.dumazet@gmail.com >
Cc: Ingo Molnar <mingo@elte.hu >
Cc: David Miller <davem@davemloft.net >
Acked-by: Mike Frysinger <vapier@gentoo.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2011-07-26 16:49:47 -07:00
Arun Sharma
f24219b4e9
atomic: move atomic_add_unless to generic code
...
This is in preparation for more generic atomic primitives based on
__atomic_add_unless.
Signed-off-by: Arun Sharma <asharma@fb.com >
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com >
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com >
Cc: Ingo Molnar <mingo@elte.hu >
Cc: David Miller <davem@davemloft.net >
Acked-by: Mike Frysinger <vapier@gentoo.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2011-07-26 16:49:47 -07:00
Arun Sharma
60063497a9
atomic: use <linux/atomic.h>
...
This allows us to move duplicated code in <asm/atomic.h>
(atomic_inc_not_zero() for now) to <linux/atomic.h>
Signed-off-by: Arun Sharma <asharma@fb.com >
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com >
Cc: Ingo Molnar <mingo@elte.hu >
Cc: David Miller <davem@davemloft.net >
Cc: Eric Dumazet <eric.dumazet@gmail.com >
Acked-by: Mike Frysinger <vapier@gentoo.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2011-07-26 16:49:47 -07:00
Anton Blanchard
f3d46f9d31
atomic_t: Cast to volatile when accessing atomic variables
...
In preparation for removing volatile from the atomic_t definition, this
patch adds a volatile cast to all the atomic read functions.
Signed-off-by: Anton Blanchard <anton@samba.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2010-05-17 07:57:27 -07:00
Arnd Bergmann
72099ed271
asm-generic: rename atomic.h to atomic-long.h
...
The existing asm-generic/atomic.h only defines the
atomic_long type. This renames it to atomic-long.h
so we have a place to add a truly generic atomic.h
that can be used on all non-SMP systems.
Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Acked-by: Ingo Molnar <mingo@elte.hu >
2009-06-11 21:02:17 +02:00
Matthew Wilcox
ea43546750
atomic_t: unify all arch definitions
...
The atomic_t type cannot currently be used in some header files because it
would create an include loop with asm/atomic.h. Move the type definition
to linux/types.h to break the loop.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Cc: Huang Ying <ying.huang@intel.com >
Cc: <linux-arch@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2009-01-06 15:59:10 -08:00
Haavard Skinnemoen
84db8d7cdb
avr32: Move include/asm-avr32 to arch/avr32/include/asm
...
Leaving include/asm/arch alone for now.
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com >
2008-08-05 13:35:07 +02:00