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 <[email protected] >
Acked-by: Jesper Nilsson <[email protected] >
Acked-by: Hans-Christian Egtvedt <[email protected] >
Acked-by: Max Filippov <[email protected] >
Signed-off-by: Peter Zijlstra (Intel) <[email protected] >
Cc: Linus Torvalds <[email protected] >
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected] >
2014-10-03 06:06:23 +02:00
Peter Zijlstra
d038c0e838
arch,frv: Convert smp_mb__*()
...
Because:
arch/frv/include/asm/smp.h:#error SMP not supported
smp_mb() is barrier() and we can use the default implementation that
uses smp_mb().
Signed-off-by: Peter Zijlstra <[email protected] >
Acked-by: Paul E. McKenney <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Cc: David Howells <[email protected] >
Cc: Linus Torvalds <[email protected] >
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected] >
2014-04-18 14:20:34 +02:00
David Howells
40ab331749
Disintegrate asm/system.h for FRV
...
Disintegrate asm/system.h for FRV.
Signed-off-by: David Howells <[email protected] >
2012-03-28 18:30:02 +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 <[email protected] >
Cc: Eric Dumazet <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: David Miller <[email protected] >
Acked-by: Mike Frysinger <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
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 <[email protected] >
Signed-off-by: Hans-Christian Egtvedt <[email protected] >
Reviewed-by: Eric Dumazet <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: David Miller <[email protected] >
Acked-by: Mike Frysinger <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
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 <[email protected] >
Reviewed-by: Eric Dumazet <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: David Miller <[email protected] >
Cc: Eric Dumazet <[email protected] >
Acked-by: Mike Frysinger <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
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 <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2010-05-17 07:57:27 -07:00
David Howells
00460f41ff
FRV: Implement atomic64_t
...
Implement atomic64_t and its ops for FRV. Tested with the following patch:
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 55e4fab..086d50d 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -746,6 +746,52 @@ static void __init parse_cmdline_early(char *cmdline)
} /* end parse_cmdline_early() */
+static atomic64_t xxx;
+
+static void test_atomic64(void)
+{
+ atomic64_set(&xxx, 0x12300000023LL);
+
+ mb();
+ BUG_ON(atomic64_read(&xxx) != 0x12300000023LL);
+ mb();
+ if (atomic64_inc_return(&xxx) != 0x12300000024LL)
+ BUG();
+ mb();
+ BUG_ON(atomic64_read(&xxx) != 0x12300000024LL);
+ mb();
+ if (atomic64_sub_return(0x36900000050LL, &xxx) != -0x2460000002cLL)
+ BUG();
+ mb();
+ BUG_ON(atomic64_read(&xxx) != -0x2460000002cLL);
+ mb();
+ if (atomic64_dec_return(&xxx) != -0x2460000002dLL)
+ BUG();
+ mb();
+ BUG_ON(atomic64_read(&xxx) != -0x2460000002dLL);
+ mb();
+ if (atomic64_add_return(0x36800000001LL, &xxx) != 0x121ffffffd4LL)
+ BUG();
+ mb();
+ BUG_ON(atomic64_read(&xxx) != 0x121ffffffd4LL);
+ mb();
+ if (atomic64_cmpxchg(&xxx, 0x123456789abcdefLL, 0x121ffffffd4LL) != 0x121ffffffd4LL)
+ BUG();
+ mb();
+ BUG_ON(atomic64_read(&xxx) != 0x121ffffffd4LL);
+ mb();
+ if (atomic64_cmpxchg(&xxx, 0x121ffffffd4LL, 0x123456789abcdefLL) != 0x121ffffffd4LL)
+ BUG();
+ mb();
+ BUG_ON(atomic64_read(&xxx) != 0x123456789abcdefLL);
+ mb();
+ if (atomic64_xchg(&xxx, 0xabcdef123456789LL) != 0x123456789abcdefLL)
+ BUG();
+ mb();
+ BUG_ON(atomic64_read(&xxx) != 0xabcdef123456789LL);
+ mb();
+}
+
/*****************************************************************************/
/*
*
@@ -845,6 +891,8 @@ void __init setup_arch(char **cmdline_p)
// asm volatile("movgs %0,timerd" :: "r"(10000000));
// __set_HSR(0, __get_HSR(0) | HSR0_ETMD);
+ test_atomic64();
+
} /* end setup_arch() */
#if 0
Note that this doesn't cover all the trivial wrappers, but does cover all the
substantial implementations.
Signed-off-by: David Howells <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2009-07-01 19:38:09 -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 <[email protected] >
Signed-off-by: Arnd Bergmann <[email protected] >
Acked-by: Ingo Molnar <[email protected] >
2009-06-11 21:02:17 +02:00
David Howells
e69cc92788
FRV: Move to arch/frv/include/asm/
...
Move arch headers from include/asm-frv/ to arch/frv/include/asm/.
Signed-off-by: David Howells <[email protected] >
2009-04-10 01:48:06 +01:00