diff options
185 files changed, 549 insertions, 650 deletions
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt index d9ca5be9b471..68542fe13b85 100644 --- a/Documentation/atomic_ops.txt +++ b/Documentation/atomic_ops.txt | |||
@@ -285,15 +285,13 @@ If a caller requires memory barrier semantics around an atomic_t | |||
285 | operation which does not return a value, a set of interfaces are | 285 | operation which does not return a value, a set of interfaces are |
286 | defined which accomplish this: | 286 | defined which accomplish this: |
287 | 287 | ||
288 | void smp_mb__before_atomic_dec(void); | 288 | void smp_mb__before_atomic(void); |
289 | void smp_mb__after_atomic_dec(void); | 289 | void smp_mb__after_atomic(void); |
290 | void smp_mb__before_atomic_inc(void); | ||
291 | void smp_mb__after_atomic_inc(void); | ||
292 | 290 | ||
293 | For example, smp_mb__before_atomic_dec() can be used like so: | 291 | For example, smp_mb__before_atomic() can be used like so: |
294 | 292 | ||
295 | obj->dead = 1; | 293 | obj->dead = 1; |
296 | smp_mb__before_atomic_dec(); | 294 | smp_mb__before_atomic(); |
297 | atomic_dec(&obj->ref_count); | 295 | atomic_dec(&obj->ref_count); |
298 | 296 | ||
299 | It makes sure that all memory operations preceding the atomic_dec() | 297 | It makes sure that all memory operations preceding the atomic_dec() |
@@ -302,15 +300,10 @@ operation. In the above example, it guarantees that the assignment of | |||
302 | "1" to obj->dead will be globally visible to other cpus before the | 300 | "1" to obj->dead will be globally visible to other cpus before the |
303 | atomic counter decrement. | 301 | atomic counter decrement. |
304 | 302 | ||
305 | Without the explicit smp_mb__before_atomic_dec() call, the | 303 | Without the explicit smp_mb__before_atomic() call, the |
306 | implementation could legally allow the atomic counter update visible | 304 | implementation could legally allow the atomic counter update visible |
307 | to other cpus before the "obj->dead = 1;" assignment. | 305 | to other cpus before the "obj->dead = 1;" assignment. |
308 | 306 | ||
309 | The other three interfaces listed are used to provide explicit | ||
310 | ordering with respect to memory operations after an atomic_dec() call | ||
311 | (smp_mb__after_atomic_dec()) and around atomic_inc() calls | ||
312 | (smp_mb__{before,after}_atomic_inc()). | ||
313 | |||
314 | A missing memory barrier in the cases where they are required by the | 307 | A missing memory barrier in the cases where they are required by the |
315 | atomic_t implementation above can have disastrous results. Here is | 308 | atomic_t implementation above can have disastrous results. Here is |
316 | an example, which follows a pattern occurring frequently in the Linux | 309 | an example, which follows a pattern occurring frequently in the Linux |
@@ -487,12 +480,12 @@ Finally there is the basic operation: | |||
487 | Which returns a boolean indicating if bit "nr" is set in the bitmask | 480 | Which returns a boolean indicating if bit "nr" is set in the bitmask |
488 | pointed to by "addr". | 481 | pointed to by "addr". |
489 | 482 | ||
490 | If explicit memory barriers are required around clear_bit() (which | 483 | If explicit memory barriers are required around {set,clear}_bit() (which do |
491 | does not return a value, and thus does not need to provide memory | 484 | not return a value, and thus does not need to provide memory barrier |
492 | barrier semantics), two interfaces are provided: | 485 | semantics), two interfaces are provided: |
493 | 486 | ||
494 | void smp_mb__before_clear_bit(void); | 487 | void smp_mb__before_atomic(void); |
495 | void smp_mb__after_clear_bit(void); | 488 | void smp_mb__after_atomic(void); |
496 | 489 | ||
497 | They are used as follows, and are akin to their atomic_t operation | 490 | They are used as follows, and are akin to their atomic_t operation |
498 | brothers: | 491 | brothers: |
@@ -500,13 +493,13 @@ brothers: | |||
500 | /* All memory operations before this call will | 493 | /* All memory operations before this call will |
501 | * be globally visible before the clear_bit(). | 494 | * be globally visible before the clear_bit(). |
502 | */ | 495 | */ |
503 | smp_mb__before_clear_bit(); | 496 | smp_mb__before_atomic(); |
504 | clear_bit( ... ); | 497 | clear_bit( ... ); |
505 | 498 | ||
506 | /* The clear_bit() will be visible before all | 499 | /* The clear_bit() will be visible before all |
507 | * subsequent memory operations. | 500 | * subsequent memory operations. |
508 | */ | 501 | */ |
509 | smp_mb__after_clear_bit(); | 502 | smp_mb__after_atomic(); |
510 | 503 | ||
511 | There are two special bitops with lock barrier semantics (acquire/release, | 504 | There are two special bitops with lock barrier semantics (acquire/release, |
512 | same as spinlocks). These operate in the same way as their non-_lock/unlock | 505 | same as spinlocks). These operate in the same way as their non-_lock/unlock |
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index 556f951f8626..46412bded104 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt | |||
@@ -1583,20 +1583,21 @@ There are some more advanced barrier functions: | |||
1583 | insert anything more than a compiler barrier in a UP compilation. | 1583 | insert anything more than a compiler barrier in a UP compilation. |
1584 | 1584 | ||
1585 | 1585 | ||
1586 | (*) smp_mb__before_atomic_dec(); | 1586 | (*) smp_mb__before_atomic(); |
1587 | (*) smp_mb__after_atomic_dec(); | 1587 | (*) smp_mb__after_atomic(); |
1588 | (*) smp_mb__before_atomic_inc(); | ||
1589 | (*) smp_mb__after_atomic_inc(); | ||
1590 | 1588 | ||
1591 | These are for use with atomic add, subtract, increment and decrement | 1589 | These are for use with atomic (such as add, subtract, increment and |
1592 | functions that don't return a value, especially when used for reference | 1590 | decrement) functions that don't return a value, especially when used for |
1593 | counting. These functions do not imply memory barriers. | 1591 | reference counting. These functions do not imply memory barriers. |
1592 | |||
1593 | These are also used for atomic bitop functions that do not return a | ||
1594 | value (such as set_bit and clear_bit). | ||
1594 | 1595 | ||
1595 | As an example, consider a piece of code that marks an object as being dead | 1596 | As an example, consider a piece of code that marks an object as being dead |
1596 | and then decrements the object's reference count: | 1597 | and then decrements the object's reference count: |
1597 | 1598 | ||
1598 | obj->dead = 1; | 1599 | obj->dead = 1; |
1599 | smp_mb__before_atomic_dec(); | 1600 | smp_mb__before_atomic(); |
1600 | atomic_dec(&obj->ref_count); | 1601 | atomic_dec(&obj->ref_count); |
1601 | 1602 | ||
1602 | This makes sure that the death mark on the object is perceived to be set | 1603 | This makes sure that the death mark on the object is perceived to be set |
@@ -1606,27 +1607,6 @@ There are some more advanced barrier functions: | |||
1606 | operations" subsection for information on where to use these. | 1607 | operations" subsection for information on where to use these. |
1607 | 1608 | ||
1608 | 1609 | ||
1609 | (*) smp_mb__before_clear_bit(void); | ||
1610 | (*) smp_mb__after_clear_bit(void); | ||
1611 | |||
1612 | These are for use similar to the atomic inc/dec barriers. These are | ||
1613 | typically used for bitwise unlocking operations, so care must be taken as | ||
1614 | there are no implicit memory barriers here either. | ||
1615 | |||
1616 | Consider implementing an unlock operation of some nature by clearing a | ||
1617 | locking bit. The clear_bit() would then need to be barriered like this: | ||
1618 | |||
1619 | smp_mb__before_clear_bit(); | ||
1620 | clear_bit( ... ); | ||
1621 | |||
1622 | This prevents memory operations before the clear leaking to after it. See | ||
1623 | the subsection on "Locking Functions" with reference to RELEASE operation | ||
1624 | implications. | ||
1625 | |||
1626 | See Documentation/atomic_ops.txt for more information. See the "Atomic | ||
1627 | operations" subsection for information on where to use these. | ||
1628 | |||
1629 | |||
1630 | MMIO WRITE BARRIER | 1610 | MMIO WRITE BARRIER |
1631 | ------------------ | 1611 | ------------------ |
1632 | 1612 | ||
@@ -2283,11 +2263,11 @@ operations: | |||
2283 | change_bit(); | 2263 | change_bit(); |
2284 | 2264 | ||
2285 | With these the appropriate explicit memory barrier should be used if necessary | 2265 | With these the appropriate explicit memory barrier should be used if necessary |
2286 | (smp_mb__before_clear_bit() for instance). | 2266 | (smp_mb__before_atomic() for instance). |
2287 | 2267 | ||
2288 | 2268 | ||
2289 | The following also do _not_ imply memory barriers, and so may require explicit | 2269 | The following also do _not_ imply memory barriers, and so may require explicit |
2290 | memory barriers under some circumstances (smp_mb__before_atomic_dec() for | 2270 | memory barriers under some circumstances (smp_mb__before_atomic() for |
2291 | instance): | 2271 | instance): |
2292 | 2272 | ||
2293 | atomic_add(); | 2273 | atomic_add(); |
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index 78b03ef39f6f..ed60a1ee1ed3 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -292,9 +292,4 @@ static inline long atomic64_dec_if_positive(atomic64_t *v) | |||
292 | #define atomic_dec(v) atomic_sub(1,(v)) | 292 | #define atomic_dec(v) atomic_sub(1,(v)) |
293 | #define atomic64_dec(v) atomic64_sub(1,(v)) | 293 | #define atomic64_dec(v) atomic64_sub(1,(v)) |
294 | 294 | ||
295 | #define smp_mb__before_atomic_dec() smp_mb() | ||
296 | #define smp_mb__after_atomic_dec() smp_mb() | ||
297 | #define smp_mb__before_atomic_inc() smp_mb() | ||
298 | #define smp_mb__after_atomic_inc() smp_mb() | ||
299 | |||
300 | #endif /* _ALPHA_ATOMIC_H */ | 295 | #endif /* _ALPHA_ATOMIC_H */ |
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h index a19ba5efea4c..4bdfbd444e63 100644 --- a/arch/alpha/include/asm/bitops.h +++ b/arch/alpha/include/asm/bitops.h | |||
@@ -53,9 +53,6 @@ __set_bit(unsigned long nr, volatile void * addr) | |||
53 | *m |= 1 << (nr & 31); | 53 | *m |= 1 << (nr & 31); |
54 | } | 54 | } |
55 | 55 | ||
56 | #define smp_mb__before_clear_bit() smp_mb() | ||
57 | #define smp_mb__after_clear_bit() smp_mb() | ||
58 | |||
59 | static inline void | 56 | static inline void |
60 | clear_bit(unsigned long nr, volatile void * addr) | 57 | clear_bit(unsigned long nr, volatile void * addr) |
61 | { | 58 | { |
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h index 03e494f695d1..83f03ca6caf6 100644 --- a/arch/arc/include/asm/atomic.h +++ b/arch/arc/include/asm/atomic.h | |||
@@ -190,11 +190,6 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) | |||
190 | 190 | ||
191 | #endif /* !CONFIG_ARC_HAS_LLSC */ | 191 | #endif /* !CONFIG_ARC_HAS_LLSC */ |
192 | 192 | ||
193 | #define smp_mb__before_atomic_dec() barrier() | ||
194 | #define smp_mb__after_atomic_dec() barrier() | ||
195 | #define smp_mb__before_atomic_inc() barrier() | ||
196 | #define smp_mb__after_atomic_inc() barrier() | ||
197 | |||
198 | /** | 193 | /** |
199 | * __atomic_add_unless - add unless the number is a given value | 194 | * __atomic_add_unless - add unless the number is a given value |
200 | * @v: pointer of type atomic_t | 195 | * @v: pointer of type atomic_t |
diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h index 647a83a8e756..ebc0cf3164dc 100644 --- a/arch/arc/include/asm/bitops.h +++ b/arch/arc/include/asm/bitops.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/compiler.h> | 21 | #include <linux/compiler.h> |
22 | #include <asm/barrier.h> | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * Hardware assisted read-modify-write using ARC700 LLOCK/SCOND insns. | 25 | * Hardware assisted read-modify-write using ARC700 LLOCK/SCOND insns. |
@@ -496,10 +497,6 @@ static inline __attribute__ ((const)) int __ffs(unsigned long word) | |||
496 | */ | 497 | */ |
497 | #define ffz(x) __ffs(~(x)) | 498 | #define ffz(x) __ffs(~(x)) |
498 | 499 | ||
499 | /* TODO does this affect uni-processor code */ | ||
500 | #define smp_mb__before_clear_bit() barrier() | ||
501 | #define smp_mb__after_clear_bit() barrier() | ||
502 | |||
503 | #include <asm-generic/bitops/hweight.h> | 500 | #include <asm-generic/bitops/hweight.h> |
504 | #include <asm-generic/bitops/fls64.h> | 501 | #include <asm-generic/bitops/fls64.h> |
505 | #include <asm-generic/bitops/sched.h> | 502 | #include <asm-generic/bitops/sched.h> |
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index 9a92fd7864a8..3040359094d9 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h | |||
@@ -241,11 +241,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
241 | 241 | ||
242 | #define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) | 242 | #define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) |
243 | 243 | ||
244 | #define smp_mb__before_atomic_dec() smp_mb() | ||
245 | #define smp_mb__after_atomic_dec() smp_mb() | ||
246 | #define smp_mb__before_atomic_inc() smp_mb() | ||
247 | #define smp_mb__after_atomic_inc() smp_mb() | ||
248 | |||
249 | #ifndef CONFIG_GENERIC_ATOMIC64 | 244 | #ifndef CONFIG_GENERIC_ATOMIC64 |
250 | typedef struct { | 245 | typedef struct { |
251 | long long counter; | 246 | long long counter; |
diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h index 2f59f7443396..c6a3e73a6e24 100644 --- a/arch/arm/include/asm/barrier.h +++ b/arch/arm/include/asm/barrier.h | |||
@@ -79,5 +79,8 @@ do { \ | |||
79 | 79 | ||
80 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) | 80 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) |
81 | 81 | ||
82 | #define smp_mb__before_atomic() smp_mb() | ||
83 | #define smp_mb__after_atomic() smp_mb() | ||
84 | |||
82 | #endif /* !__ASSEMBLY__ */ | 85 | #endif /* !__ASSEMBLY__ */ |
83 | #endif /* __ASM_BARRIER_H */ | 86 | #endif /* __ASM_BARRIER_H */ |
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index b2e298a90d76..56380995f4c3 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h | |||
@@ -25,9 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/compiler.h> | 26 | #include <linux/compiler.h> |
27 | #include <linux/irqflags.h> | 27 | #include <linux/irqflags.h> |
28 | 28 | #include <asm/barrier.h> | |
29 | #define smp_mb__before_clear_bit() smp_mb() | ||
30 | #define smp_mb__after_clear_bit() smp_mb() | ||
31 | 29 | ||
32 | /* | 30 | /* |
33 | * These functions are the basis of our bit ops. | 31 | * These functions are the basis of our bit ops. |
diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h index 0237f0867e37..57e8cb49824c 100644 --- a/arch/arm64/include/asm/atomic.h +++ b/arch/arm64/include/asm/atomic.h | |||
@@ -152,11 +152,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
152 | 152 | ||
153 | #define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) | 153 | #define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) |
154 | 154 | ||
155 | #define smp_mb__before_atomic_dec() smp_mb() | ||
156 | #define smp_mb__after_atomic_dec() smp_mb() | ||
157 | #define smp_mb__before_atomic_inc() smp_mb() | ||
158 | #define smp_mb__after_atomic_inc() smp_mb() | ||
159 | |||
160 | /* | 155 | /* |
161 | * 64-bit atomic operations. | 156 | * 64-bit atomic operations. |
162 | */ | 157 | */ |
diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 66eb7648043b..48b9e704af7c 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h | |||
@@ -98,6 +98,9 @@ do { \ | |||
98 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) | 98 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) |
99 | #define nop() asm volatile("nop"); | 99 | #define nop() asm volatile("nop"); |
100 | 100 | ||
101 | #define smp_mb__before_atomic() smp_mb() | ||
102 | #define smp_mb__after_atomic() smp_mb() | ||
103 | |||
101 | #endif /* __ASSEMBLY__ */ | 104 | #endif /* __ASSEMBLY__ */ |
102 | 105 | ||
103 | #endif /* __ASM_BARRIER_H */ | 106 | #endif /* __ASM_BARRIER_H */ |
diff --git a/arch/arm64/include/asm/bitops.h b/arch/arm64/include/asm/bitops.h index aa5b59d6ba43..9c19594ce7cb 100644 --- a/arch/arm64/include/asm/bitops.h +++ b/arch/arm64/include/asm/bitops.h | |||
@@ -17,17 +17,8 @@ | |||
17 | #define __ASM_BITOPS_H | 17 | #define __ASM_BITOPS_H |
18 | 18 | ||
19 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
20 | |||
21 | #include <asm/barrier.h> | 20 | #include <asm/barrier.h> |
22 | 21 | ||
23 | /* | ||
24 | * clear_bit may not imply a memory barrier | ||
25 | */ | ||
26 | #ifndef smp_mb__before_clear_bit | ||
27 | #define smp_mb__before_clear_bit() smp_mb() | ||
28 | #define smp_mb__after_clear_bit() smp_mb() | ||
29 | #endif | ||
30 | |||
31 | #ifndef _LINUX_BITOPS_H | 22 | #ifndef _LINUX_BITOPS_H |
32 | #error only <linux/bitops.h> can be included directly | 23 | #error only <linux/bitops.h> can be included directly |
33 | #endif | 24 | #endif |
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h index 61407279208a..0780f3f2415b 100644 --- a/arch/avr32/include/asm/atomic.h +++ b/arch/avr32/include/asm/atomic.h | |||
@@ -183,9 +183,4 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v) | |||
183 | 183 | ||
184 | #define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) | 184 | #define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) |
185 | 185 | ||
186 | #define smp_mb__before_atomic_dec() barrier() | ||
187 | #define smp_mb__after_atomic_dec() barrier() | ||
188 | #define smp_mb__before_atomic_inc() barrier() | ||
189 | #define smp_mb__after_atomic_inc() barrier() | ||
190 | |||
191 | #endif /* __ASM_AVR32_ATOMIC_H */ | 186 | #endif /* __ASM_AVR32_ATOMIC_H */ |
diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h index ebe7ad3f490b..910d5374ce59 100644 --- a/arch/avr32/include/asm/bitops.h +++ b/arch/avr32/include/asm/bitops.h | |||
@@ -13,12 +13,7 @@ | |||
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include <asm/byteorder.h> | 15 | #include <asm/byteorder.h> |
16 | 16 | #include <asm/barrier.h> | |
17 | /* | ||
18 | * clear_bit() doesn't provide any barrier for the compiler | ||
19 | */ | ||
20 | #define smp_mb__before_clear_bit() barrier() | ||
21 | #define smp_mb__after_clear_bit() barrier() | ||
22 | 17 | ||
23 | /* | 18 | /* |
24 | * set_bit - Atomically set a bit in memory | 19 | * set_bit - Atomically set a bit in memory |
@@ -67,7 +62,7 @@ static inline void set_bit(int nr, volatile void * addr) | |||
67 | * | 62 | * |
68 | * clear_bit() is atomic and may not be reordered. However, it does | 63 | * clear_bit() is atomic and may not be reordered. However, it does |
69 | * not contain a memory barrier, so if it is used for locking purposes, | 64 | * not contain a memory barrier, so if it is used for locking purposes, |
70 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 65 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
71 | * in order to ensure changes are visible on other processors. | 66 | * in order to ensure changes are visible on other processors. |
72 | */ | 67 | */ |
73 | static inline void clear_bit(int nr, volatile void * addr) | 68 | static inline void clear_bit(int nr, volatile void * addr) |
diff --git a/arch/blackfin/include/asm/barrier.h b/arch/blackfin/include/asm/barrier.h index 19283a16ac08..420006877998 100644 --- a/arch/blackfin/include/asm/barrier.h +++ b/arch/blackfin/include/asm/barrier.h | |||
@@ -27,6 +27,9 @@ | |||
27 | 27 | ||
28 | #endif /* !CONFIG_SMP */ | 28 | #endif /* !CONFIG_SMP */ |
29 | 29 | ||
30 | #define smp_mb__before_atomic() barrier() | ||
31 | #define smp_mb__after_atomic() barrier() | ||
32 | |||
30 | #include <asm-generic/barrier.h> | 33 | #include <asm-generic/barrier.h> |
31 | 34 | ||
32 | #endif /* _BLACKFIN_BARRIER_H */ | 35 | #endif /* _BLACKFIN_BARRIER_H */ |
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h index 0ca40dd44724..b298b654a26f 100644 --- a/arch/blackfin/include/asm/bitops.h +++ b/arch/blackfin/include/asm/bitops.h | |||
@@ -27,21 +27,17 @@ | |||
27 | 27 | ||
28 | #include <asm-generic/bitops/ext2-atomic.h> | 28 | #include <asm-generic/bitops/ext2-atomic.h> |
29 | 29 | ||
30 | #include <asm/barrier.h> | ||
31 | |||
30 | #ifndef CONFIG_SMP | 32 | #ifndef CONFIG_SMP |
31 | #include <linux/irqflags.h> | 33 | #include <linux/irqflags.h> |
32 | |||
33 | /* | 34 | /* |
34 | * clear_bit may not imply a memory barrier | 35 | * clear_bit may not imply a memory barrier |
35 | */ | 36 | */ |
36 | #ifndef smp_mb__before_clear_bit | ||
37 | #define smp_mb__before_clear_bit() smp_mb() | ||
38 | #define smp_mb__after_clear_bit() smp_mb() | ||
39 | #endif | ||
40 | #include <asm-generic/bitops/atomic.h> | 37 | #include <asm-generic/bitops/atomic.h> |
41 | #include <asm-generic/bitops/non-atomic.h> | 38 | #include <asm-generic/bitops/non-atomic.h> |
42 | #else | 39 | #else |
43 | 40 | ||
44 | #include <asm/barrier.h> | ||
45 | #include <asm/byteorder.h> /* swab32 */ | 41 | #include <asm/byteorder.h> /* swab32 */ |
46 | #include <linux/linkage.h> | 42 | #include <linux/linkage.h> |
47 | 43 | ||
@@ -101,12 +97,6 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) | |||
101 | return __raw_bit_test_toggle_asm(a, nr & 0x1f); | 97 | return __raw_bit_test_toggle_asm(a, nr & 0x1f); |
102 | } | 98 | } |
103 | 99 | ||
104 | /* | ||
105 | * clear_bit() doesn't provide any barrier for the compiler. | ||
106 | */ | ||
107 | #define smp_mb__before_clear_bit() barrier() | ||
108 | #define smp_mb__after_clear_bit() barrier() | ||
109 | |||
110 | #define test_bit __skip_test_bit | 100 | #define test_bit __skip_test_bit |
111 | #include <asm-generic/bitops/non-atomic.h> | 101 | #include <asm-generic/bitops/non-atomic.h> |
112 | #undef test_bit | 102 | #undef test_bit |
diff --git a/arch/c6x/include/asm/bitops.h b/arch/c6x/include/asm/bitops.h index 0bec7e5036a8..f0ab012401b6 100644 --- a/arch/c6x/include/asm/bitops.h +++ b/arch/c6x/include/asm/bitops.h | |||
@@ -14,14 +14,8 @@ | |||
14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
15 | 15 | ||
16 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
17 | |||
18 | #include <asm/byteorder.h> | 17 | #include <asm/byteorder.h> |
19 | 18 | #include <asm/barrier.h> | |
20 | /* | ||
21 | * clear_bit() doesn't provide any barrier for the compiler. | ||
22 | */ | ||
23 | #define smp_mb__before_clear_bit() barrier() | ||
24 | #define smp_mb__after_clear_bit() barrier() | ||
25 | 19 | ||
26 | /* | 20 | /* |
27 | * We are lucky, DSP is perfect for bitops: do it in 3 cycles | 21 | * We are lucky, DSP is perfect for bitops: do it in 3 cycles |
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h index 1056a5dfe04f..aa429baebaf9 100644 --- a/arch/cris/include/asm/atomic.h +++ b/arch/cris/include/asm/atomic.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | #include <asm/cmpxchg.h> | 8 | #include <asm/cmpxchg.h> |
9 | #include <arch/atomic.h> | 9 | #include <arch/atomic.h> |
10 | #include <arch/system.h> | ||
11 | #include <asm/barrier.h> | ||
10 | 12 | ||
11 | /* | 13 | /* |
12 | * Atomic operations that C can't guarantee us. Useful for | 14 | * Atomic operations that C can't guarantee us. Useful for |
@@ -151,10 +153,4 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
151 | return ret; | 153 | return ret; |
152 | } | 154 | } |
153 | 155 | ||
154 | /* Atomic operations are already serializing */ | ||
155 | #define smp_mb__before_atomic_dec() barrier() | ||
156 | #define smp_mb__after_atomic_dec() barrier() | ||
157 | #define smp_mb__before_atomic_inc() barrier() | ||
158 | #define smp_mb__after_atomic_inc() barrier() | ||
159 | |||
160 | #endif | 156 | #endif |
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h index 053c17b36559..bd49a546f4f5 100644 --- a/arch/cris/include/asm/bitops.h +++ b/arch/cris/include/asm/bitops.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <arch/bitops.h> | 21 | #include <arch/bitops.h> |
22 | #include <linux/atomic.h> | 22 | #include <linux/atomic.h> |
23 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
24 | #include <asm/barrier.h> | ||
24 | 25 | ||
25 | /* | 26 | /* |
26 | * set_bit - Atomically set a bit in memory | 27 | * set_bit - Atomically set a bit in memory |
@@ -42,7 +43,7 @@ | |||
42 | * | 43 | * |
43 | * clear_bit() is atomic and may not be reordered. However, it does | 44 | * clear_bit() is atomic and may not be reordered. However, it does |
44 | * not contain a memory barrier, so if it is used for locking purposes, | 45 | * not contain a memory barrier, so if it is used for locking purposes, |
45 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 46 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
46 | * in order to ensure changes are visible on other processors. | 47 | * in order to ensure changes are visible on other processors. |
47 | */ | 48 | */ |
48 | 49 | ||
@@ -84,12 +85,6 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr) | |||
84 | return retval; | 85 | return retval; |
85 | } | 86 | } |
86 | 87 | ||
87 | /* | ||
88 | * clear_bit() doesn't provide any barrier for the compiler. | ||
89 | */ | ||
90 | #define smp_mb__before_clear_bit() barrier() | ||
91 | #define smp_mb__after_clear_bit() barrier() | ||
92 | |||
93 | /** | 88 | /** |
94 | * test_and_clear_bit - Clear a bit and return its old value | 89 | * test_and_clear_bit - Clear a bit and return its old value |
95 | * @nr: Bit to clear | 90 | * @nr: Bit to clear |
diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h index b86329d0e316..f6c3a1690101 100644 --- a/arch/frv/include/asm/atomic.h +++ b/arch/frv/include/asm/atomic.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <asm/spr-regs.h> | 18 | #include <asm/spr-regs.h> |
19 | #include <asm/cmpxchg.h> | 19 | #include <asm/cmpxchg.h> |
20 | #include <asm/barrier.h> | ||
20 | 21 | ||
21 | #ifdef CONFIG_SMP | 22 | #ifdef CONFIG_SMP |
22 | #error not SMP safe | 23 | #error not SMP safe |
@@ -29,12 +30,6 @@ | |||
29 | * We do not have SMP systems, so we don't have to deal with that. | 30 | * We do not have SMP systems, so we don't have to deal with that. |
30 | */ | 31 | */ |
31 | 32 | ||
32 | /* Atomic operations are already serializing */ | ||
33 | #define smp_mb__before_atomic_dec() barrier() | ||
34 | #define smp_mb__after_atomic_dec() barrier() | ||
35 | #define smp_mb__before_atomic_inc() barrier() | ||
36 | #define smp_mb__after_atomic_inc() barrier() | ||
37 | |||
38 | #define ATOMIC_INIT(i) { (i) } | 33 | #define ATOMIC_INIT(i) { (i) } |
39 | #define atomic_read(v) (*(volatile int *)&(v)->counter) | 34 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
40 | #define atomic_set(v, i) (((v)->counter) = (i)) | 35 | #define atomic_set(v, i) (((v)->counter) = (i)) |
diff --git a/arch/frv/include/asm/bitops.h b/arch/frv/include/asm/bitops.h index 57bf85db893f..96de220ef131 100644 --- a/arch/frv/include/asm/bitops.h +++ b/arch/frv/include/asm/bitops.h | |||
@@ -25,12 +25,6 @@ | |||
25 | 25 | ||
26 | #include <asm-generic/bitops/ffz.h> | 26 | #include <asm-generic/bitops/ffz.h> |
27 | 27 | ||
28 | /* | ||
29 | * clear_bit() doesn't provide any barrier for the compiler. | ||
30 | */ | ||
31 | #define smp_mb__before_clear_bit() barrier() | ||
32 | #define smp_mb__after_clear_bit() barrier() | ||
33 | |||
34 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS | 28 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS |
35 | static inline | 29 | static inline |
36 | unsigned long atomic_test_and_ANDNOT_mask(unsigned long mask, volatile unsigned long *v) | 30 | unsigned long atomic_test_and_ANDNOT_mask(unsigned long mask, volatile unsigned long *v) |
diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h index 17dc63780c06..de916b11bff5 100644 --- a/arch/hexagon/include/asm/atomic.h +++ b/arch/hexagon/include/asm/atomic.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <asm/cmpxchg.h> | 26 | #include <asm/cmpxchg.h> |
27 | #include <asm/barrier.h> | ||
27 | 28 | ||
28 | #define ATOMIC_INIT(i) { (i) } | 29 | #define ATOMIC_INIT(i) { (i) } |
29 | 30 | ||
@@ -176,9 +177,4 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
176 | #define atomic_inc_return(v) (atomic_add_return(1, v)) | 177 | #define atomic_inc_return(v) (atomic_add_return(1, v)) |
177 | #define atomic_dec_return(v) (atomic_sub_return(1, v)) | 178 | #define atomic_dec_return(v) (atomic_sub_return(1, v)) |
178 | 179 | ||
179 | #define smp_mb__before_atomic_dec() barrier() | ||
180 | #define smp_mb__after_atomic_dec() barrier() | ||
181 | #define smp_mb__before_atomic_inc() barrier() | ||
182 | #define smp_mb__after_atomic_inc() barrier() | ||
183 | |||
184 | #endif | 180 | #endif |
diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h index 9b1e4afbab3c..5e4a59b3ec1b 100644 --- a/arch/hexagon/include/asm/bitops.h +++ b/arch/hexagon/include/asm/bitops.h | |||
@@ -25,12 +25,10 @@ | |||
25 | #include <linux/compiler.h> | 25 | #include <linux/compiler.h> |
26 | #include <asm/byteorder.h> | 26 | #include <asm/byteorder.h> |
27 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
28 | #include <asm/barrier.h> | ||
28 | 29 | ||
29 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
30 | 31 | ||
31 | #define smp_mb__before_clear_bit() barrier() | ||
32 | #define smp_mb__after_clear_bit() barrier() | ||
33 | |||
34 | /* | 32 | /* |
35 | * The offset calculations for these are based on BITS_PER_LONG == 32 | 33 | * The offset calculations for these are based on BITS_PER_LONG == 32 |
36 | * (i.e. I get to shift by #5-2 (32 bits per long, 4 bytes per access), | 34 | * (i.e. I get to shift by #5-2 (32 bits per long, 4 bytes per access), |
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h index 6e6fe1839f5d..0f8bf48dadf3 100644 --- a/arch/ia64/include/asm/atomic.h +++ b/arch/ia64/include/asm/atomic.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | 16 | ||
17 | #include <asm/intrinsics.h> | 17 | #include <asm/intrinsics.h> |
18 | #include <asm/barrier.h> | ||
18 | 19 | ||
19 | 20 | ||
20 | #define ATOMIC_INIT(i) { (i) } | 21 | #define ATOMIC_INIT(i) { (i) } |
@@ -208,10 +209,4 @@ atomic64_add_negative (__s64 i, atomic64_t *v) | |||
208 | #define atomic64_inc(v) atomic64_add(1, (v)) | 209 | #define atomic64_inc(v) atomic64_add(1, (v)) |
209 | #define atomic64_dec(v) atomic64_sub(1, (v)) | 210 | #define atomic64_dec(v) atomic64_sub(1, (v)) |
210 | 211 | ||
211 | /* Atomic operations are already serializing */ | ||
212 | #define smp_mb__before_atomic_dec() barrier() | ||
213 | #define smp_mb__after_atomic_dec() barrier() | ||
214 | #define smp_mb__before_atomic_inc() barrier() | ||
215 | #define smp_mb__after_atomic_inc() barrier() | ||
216 | |||
217 | #endif /* _ASM_IA64_ATOMIC_H */ | 212 | #endif /* _ASM_IA64_ATOMIC_H */ |
diff --git a/arch/ia64/include/asm/barrier.h b/arch/ia64/include/asm/barrier.h index d0a69aa35e27..a48957c7b445 100644 --- a/arch/ia64/include/asm/barrier.h +++ b/arch/ia64/include/asm/barrier.h | |||
@@ -55,6 +55,9 @@ | |||
55 | 55 | ||
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #define smp_mb__before_atomic() barrier() | ||
59 | #define smp_mb__after_atomic() barrier() | ||
60 | |||
58 | /* | 61 | /* |
59 | * IA64 GCC turns volatile stores into st.rel and volatile loads into ld.acq no | 62 | * IA64 GCC turns volatile stores into st.rel and volatile loads into ld.acq no |
60 | * need for asm trickery! | 63 | * need for asm trickery! |
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h index c27eccd33349..71e8145243ee 100644 --- a/arch/ia64/include/asm/bitops.h +++ b/arch/ia64/include/asm/bitops.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <asm/intrinsics.h> | 18 | #include <asm/intrinsics.h> |
19 | #include <asm/barrier.h> | ||
19 | 20 | ||
20 | /** | 21 | /** |
21 | * set_bit - Atomically set a bit in memory | 22 | * set_bit - Atomically set a bit in memory |
@@ -65,12 +66,6 @@ __set_bit (int nr, volatile void *addr) | |||
65 | *((__u32 *) addr + (nr >> 5)) |= (1 << (nr & 31)); | 66 | *((__u32 *) addr + (nr >> 5)) |= (1 << (nr & 31)); |
66 | } | 67 | } |
67 | 68 | ||
68 | /* | ||
69 | * clear_bit() has "acquire" semantics. | ||
70 | */ | ||
71 | #define smp_mb__before_clear_bit() smp_mb() | ||
72 | #define smp_mb__after_clear_bit() do { /* skip */; } while (0) | ||
73 | |||
74 | /** | 69 | /** |
75 | * clear_bit - Clears a bit in memory | 70 | * clear_bit - Clears a bit in memory |
76 | * @nr: Bit to clear | 71 | * @nr: Bit to clear |
@@ -78,7 +73,7 @@ __set_bit (int nr, volatile void *addr) | |||
78 | * | 73 | * |
79 | * clear_bit() is atomic and may not be reordered. However, it does | 74 | * clear_bit() is atomic and may not be reordered. However, it does |
80 | * not contain a memory barrier, so if it is used for locking purposes, | 75 | * not contain a memory barrier, so if it is used for locking purposes, |
81 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 76 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
82 | * in order to ensure changes are visible on other processors. | 77 | * in order to ensure changes are visible on other processors. |
83 | */ | 78 | */ |
84 | static __inline__ void | 79 | static __inline__ void |
diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h index 4f37dbbb8640..f35109b1d907 100644 --- a/arch/ia64/include/uapi/asm/cmpxchg.h +++ b/arch/ia64/include/uapi/asm/cmpxchg.h | |||
@@ -118,6 +118,15 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void); | |||
118 | #define cmpxchg_rel(ptr, o, n) \ | 118 | #define cmpxchg_rel(ptr, o, n) \ |
119 | ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr))) | 119 | ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr))) |
120 | 120 | ||
121 | /* | ||
122 | * Worse still - early processor implementations actually just ignored | ||
123 | * the acquire/release and did a full fence all the time. Unfortunately | ||
124 | * this meant a lot of badly written code that used .acq when they really | ||
125 | * wanted .rel became legacy out in the wild - so when we made a cpu | ||
126 | * that strictly did the .acq or .rel ... all that code started breaking - so | ||
127 | * we had to back-pedal and keep the "legacy" behavior of a full fence :-( | ||
128 | */ | ||
129 | |||
121 | /* for compatibility with other platforms: */ | 130 | /* for compatibility with other platforms: */ |
122 | #define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) | 131 | #define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) |
123 | #define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) | 132 | #define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) |
diff --git a/arch/m32r/include/asm/atomic.h b/arch/m32r/include/asm/atomic.h index 0d81697c326c..8ad0ed4182a5 100644 --- a/arch/m32r/include/asm/atomic.h +++ b/arch/m32r/include/asm/atomic.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/assembler.h> | 13 | #include <asm/assembler.h> |
14 | #include <asm/cmpxchg.h> | 14 | #include <asm/cmpxchg.h> |
15 | #include <asm/dcache_clear.h> | 15 | #include <asm/dcache_clear.h> |
16 | #include <asm/barrier.h> | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * Atomic operations that C can't guarantee us. Useful for | 19 | * Atomic operations that C can't guarantee us. Useful for |
@@ -308,10 +309,4 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *addr) | |||
308 | local_irq_restore(flags); | 309 | local_irq_restore(flags); |
309 | } | 310 | } |
310 | 311 | ||
311 | /* Atomic operations are already serializing on m32r */ | ||
312 | #define smp_mb__before_atomic_dec() barrier() | ||
313 | #define smp_mb__after_atomic_dec() barrier() | ||
314 | #define smp_mb__before_atomic_inc() barrier() | ||
315 | #define smp_mb__after_atomic_inc() barrier() | ||
316 | |||
317 | #endif /* _ASM_M32R_ATOMIC_H */ | 312 | #endif /* _ASM_M32R_ATOMIC_H */ |
diff --git a/arch/m32r/include/asm/bitops.h b/arch/m32r/include/asm/bitops.h index d3dea9ac7d4e..86ba2b42a6cf 100644 --- a/arch/m32r/include/asm/bitops.h +++ b/arch/m32r/include/asm/bitops.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
22 | #include <asm/dcache_clear.h> | 22 | #include <asm/dcache_clear.h> |
23 | #include <asm/types.h> | 23 | #include <asm/types.h> |
24 | #include <asm/barrier.h> | ||
24 | 25 | ||
25 | /* | 26 | /* |
26 | * These have to be done with inline assembly: that way the bit-setting | 27 | * These have to be done with inline assembly: that way the bit-setting |
@@ -73,7 +74,7 @@ static __inline__ void set_bit(int nr, volatile void * addr) | |||
73 | * | 74 | * |
74 | * clear_bit() is atomic and may not be reordered. However, it does | 75 | * clear_bit() is atomic and may not be reordered. However, it does |
75 | * not contain a memory barrier, so if it is used for locking purposes, | 76 | * not contain a memory barrier, so if it is used for locking purposes, |
76 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 77 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
77 | * in order to ensure changes are visible on other processors. | 78 | * in order to ensure changes are visible on other processors. |
78 | */ | 79 | */ |
79 | static __inline__ void clear_bit(int nr, volatile void * addr) | 80 | static __inline__ void clear_bit(int nr, volatile void * addr) |
@@ -103,9 +104,6 @@ static __inline__ void clear_bit(int nr, volatile void * addr) | |||
103 | local_irq_restore(flags); | 104 | local_irq_restore(flags); |
104 | } | 105 | } |
105 | 106 | ||
106 | #define smp_mb__before_clear_bit() barrier() | ||
107 | #define smp_mb__after_clear_bit() barrier() | ||
108 | |||
109 | /** | 107 | /** |
110 | * change_bit - Toggle a bit in memory | 108 | * change_bit - Toggle a bit in memory |
111 | * @nr: Bit to clear | 109 | * @nr: Bit to clear |
diff --git a/arch/m68k/include/asm/atomic.h b/arch/m68k/include/asm/atomic.h index f4e32de263a7..55695212a2ae 100644 --- a/arch/m68k/include/asm/atomic.h +++ b/arch/m68k/include/asm/atomic.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/irqflags.h> | 5 | #include <linux/irqflags.h> |
6 | #include <asm/cmpxchg.h> | 6 | #include <asm/cmpxchg.h> |
7 | #include <asm/barrier.h> | ||
7 | 8 | ||
8 | /* | 9 | /* |
9 | * Atomic operations that C can't guarantee us. Useful for | 10 | * Atomic operations that C can't guarantee us. Useful for |
@@ -209,11 +210,4 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) | |||
209 | return c; | 210 | return c; |
210 | } | 211 | } |
211 | 212 | ||
212 | |||
213 | /* Atomic operations are already serializing */ | ||
214 | #define smp_mb__before_atomic_dec() barrier() | ||
215 | #define smp_mb__after_atomic_dec() barrier() | ||
216 | #define smp_mb__before_atomic_inc() barrier() | ||
217 | #define smp_mb__after_atomic_inc() barrier() | ||
218 | |||
219 | #endif /* __ARCH_M68K_ATOMIC __ */ | 213 | #endif /* __ARCH_M68K_ATOMIC __ */ |
diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa913592a..b4a9b0d5928d 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
16 | #include <asm/barrier.h> | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * Bit access functions vary across the ColdFire and 68k families. | 19 | * Bit access functions vary across the ColdFire and 68k families. |
@@ -67,12 +68,6 @@ static inline void bfset_mem_set_bit(int nr, volatile unsigned long *vaddr) | |||
67 | #define __set_bit(nr, vaddr) set_bit(nr, vaddr) | 68 | #define __set_bit(nr, vaddr) set_bit(nr, vaddr) |
68 | 69 | ||
69 | 70 | ||
70 | /* | ||
71 | * clear_bit() doesn't provide any barrier for the compiler. | ||
72 | */ | ||
73 | #define smp_mb__before_clear_bit() barrier() | ||
74 | #define smp_mb__after_clear_bit() barrier() | ||
75 | |||
76 | static inline void bclr_reg_clear_bit(int nr, volatile unsigned long *vaddr) | 71 | static inline void bclr_reg_clear_bit(int nr, volatile unsigned long *vaddr) |
77 | { | 72 | { |
78 | char *p = (char *)vaddr + (nr ^ 31) / 8; | 73 | char *p = (char *)vaddr + (nr ^ 31) / 8; |
diff --git a/arch/metag/include/asm/atomic.h b/arch/metag/include/asm/atomic.h index 307ecd2bd9a1..470e365f04ea 100644 --- a/arch/metag/include/asm/atomic.h +++ b/arch/metag/include/asm/atomic.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <asm/cmpxchg.h> | 6 | #include <asm/cmpxchg.h> |
7 | #include <asm/barrier.h> | ||
7 | 8 | ||
8 | #if defined(CONFIG_METAG_ATOMICITY_IRQSOFF) | 9 | #if defined(CONFIG_METAG_ATOMICITY_IRQSOFF) |
9 | /* The simple UP case. */ | 10 | /* The simple UP case. */ |
@@ -39,11 +40,6 @@ | |||
39 | 40 | ||
40 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 41 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
41 | 42 | ||
42 | #define smp_mb__before_atomic_dec() barrier() | ||
43 | #define smp_mb__after_atomic_dec() barrier() | ||
44 | #define smp_mb__before_atomic_inc() barrier() | ||
45 | #define smp_mb__after_atomic_inc() barrier() | ||
46 | |||
47 | #endif | 43 | #endif |
48 | 44 | ||
49 | #define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) | 45 | #define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) |
diff --git a/arch/metag/include/asm/barrier.h b/arch/metag/include/asm/barrier.h index 2d6f0de77325..c7591e80067c 100644 --- a/arch/metag/include/asm/barrier.h +++ b/arch/metag/include/asm/barrier.h | |||
@@ -100,4 +100,7 @@ do { \ | |||
100 | ___p1; \ | 100 | ___p1; \ |
101 | }) | 101 | }) |
102 | 102 | ||
103 | #define smp_mb__before_atomic() barrier() | ||
104 | #define smp_mb__after_atomic() barrier() | ||
105 | |||
103 | #endif /* _ASM_METAG_BARRIER_H */ | 106 | #endif /* _ASM_METAG_BARRIER_H */ |
diff --git a/arch/metag/include/asm/bitops.h b/arch/metag/include/asm/bitops.h index c0d0df0d1378..2671134ee745 100644 --- a/arch/metag/include/asm/bitops.h +++ b/arch/metag/include/asm/bitops.h | |||
@@ -5,12 +5,6 @@ | |||
5 | #include <asm/barrier.h> | 5 | #include <asm/barrier.h> |
6 | #include <asm/global_lock.h> | 6 | #include <asm/global_lock.h> |
7 | 7 | ||
8 | /* | ||
9 | * clear_bit() doesn't provide any barrier for the compiler. | ||
10 | */ | ||
11 | #define smp_mb__before_clear_bit() barrier() | ||
12 | #define smp_mb__after_clear_bit() barrier() | ||
13 | |||
14 | #ifdef CONFIG_SMP | 8 | #ifdef CONFIG_SMP |
15 | /* | 9 | /* |
16 | * These functions are the basis of our bit ops. | 10 | * These functions are the basis of our bit ops. |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index e8eb3d53a241..37b2befe651a 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
@@ -761,13 +761,4 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) | |||
761 | 761 | ||
762 | #endif /* CONFIG_64BIT */ | 762 | #endif /* CONFIG_64BIT */ |
763 | 763 | ||
764 | /* | ||
765 | * atomic*_return operations are serializing but not the non-*_return | ||
766 | * versions. | ||
767 | */ | ||
768 | #define smp_mb__before_atomic_dec() smp_mb__before_llsc() | ||
769 | #define smp_mb__after_atomic_dec() smp_llsc_mb() | ||
770 | #define smp_mb__before_atomic_inc() smp_mb__before_llsc() | ||
771 | #define smp_mb__after_atomic_inc() smp_llsc_mb() | ||
772 | |||
773 | #endif /* _ASM_ATOMIC_H */ | 764 | #endif /* _ASM_ATOMIC_H */ |
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h index e1aa4e4c2984..d0101dd0575e 100644 --- a/arch/mips/include/asm/barrier.h +++ b/arch/mips/include/asm/barrier.h | |||
@@ -195,4 +195,7 @@ do { \ | |||
195 | ___p1; \ | 195 | ___p1; \ |
196 | }) | 196 | }) |
197 | 197 | ||
198 | #define smp_mb__before_atomic() smp_mb__before_llsc() | ||
199 | #define smp_mb__after_atomic() smp_llsc_mb() | ||
200 | |||
198 | #endif /* __ASM_BARRIER_H */ | 201 | #endif /* __ASM_BARRIER_H */ |
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index 6a65d49e2c0d..7c8816f7b7c4 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h | |||
@@ -38,13 +38,6 @@ | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * clear_bit() doesn't provide any barrier for the compiler. | ||
42 | */ | ||
43 | #define smp_mb__before_clear_bit() smp_mb__before_llsc() | ||
44 | #define smp_mb__after_clear_bit() smp_llsc_mb() | ||
45 | |||
46 | |||
47 | /* | ||
48 | * These are the "slower" versions of the functions and are in bitops.c. | 41 | * These are the "slower" versions of the functions and are in bitops.c. |
49 | * These functions call raw_local_irq_{save,restore}(). | 42 | * These functions call raw_local_irq_{save,restore}(). |
50 | */ | 43 | */ |
@@ -120,7 +113,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
120 | * | 113 | * |
121 | * clear_bit() is atomic and may not be reordered. However, it does | 114 | * clear_bit() is atomic and may not be reordered. However, it does |
122 | * not contain a memory barrier, so if it is used for locking purposes, | 115 | * not contain a memory barrier, so if it is used for locking purposes, |
123 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 116 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
124 | * in order to ensure changes are visible on other processors. | 117 | * in order to ensure changes are visible on other processors. |
125 | */ | 118 | */ |
126 | static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | 119 | static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) |
@@ -175,7 +168,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
175 | */ | 168 | */ |
176 | static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *addr) | 169 | static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *addr) |
177 | { | 170 | { |
178 | smp_mb__before_clear_bit(); | 171 | smp_mb__before_atomic(); |
179 | clear_bit(nr, addr); | 172 | clear_bit(nr, addr); |
180 | } | 173 | } |
181 | 174 | ||
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index d1fea7a054be..1818da4dbb85 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c | |||
@@ -62,9 +62,9 @@ void __init alloc_legacy_irqno(void) | |||
62 | 62 | ||
63 | void free_irqno(unsigned int irq) | 63 | void free_irqno(unsigned int irq) |
64 | { | 64 | { |
65 | smp_mb__before_clear_bit(); | 65 | smp_mb__before_atomic(); |
66 | clear_bit(irq, irq_map); | 66 | clear_bit(irq, irq_map); |
67 | smp_mb__after_clear_bit(); | 67 | smp_mb__after_atomic(); |
68 | } | 68 | } |
69 | 69 | ||
70 | /* | 70 | /* |
diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h index 975e1841ca64..cadeb1e2cdfc 100644 --- a/arch/mn10300/include/asm/atomic.h +++ b/arch/mn10300/include/asm/atomic.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <asm/irqflags.h> | 14 | #include <asm/irqflags.h> |
15 | #include <asm/cmpxchg.h> | 15 | #include <asm/cmpxchg.h> |
16 | #include <asm/barrier.h> | ||
16 | 17 | ||
17 | #ifndef CONFIG_SMP | 18 | #ifndef CONFIG_SMP |
18 | #include <asm-generic/atomic.h> | 19 | #include <asm-generic/atomic.h> |
@@ -234,12 +235,6 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *addr) | |||
234 | #endif | 235 | #endif |
235 | } | 236 | } |
236 | 237 | ||
237 | /* Atomic operations are already serializing on MN10300??? */ | ||
238 | #define smp_mb__before_atomic_dec() barrier() | ||
239 | #define smp_mb__after_atomic_dec() barrier() | ||
240 | #define smp_mb__before_atomic_inc() barrier() | ||
241 | #define smp_mb__after_atomic_inc() barrier() | ||
242 | |||
243 | #endif /* __KERNEL__ */ | 238 | #endif /* __KERNEL__ */ |
244 | #endif /* CONFIG_SMP */ | 239 | #endif /* CONFIG_SMP */ |
245 | #endif /* _ASM_ATOMIC_H */ | 240 | #endif /* _ASM_ATOMIC_H */ |
diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h index 596bb2706d81..fe6f8e2c3617 100644 --- a/arch/mn10300/include/asm/bitops.h +++ b/arch/mn10300/include/asm/bitops.h | |||
@@ -18,9 +18,7 @@ | |||
18 | #define __ASM_BITOPS_H | 18 | #define __ASM_BITOPS_H |
19 | 19 | ||
20 | #include <asm/cpu-regs.h> | 20 | #include <asm/cpu-regs.h> |
21 | 21 | #include <asm/barrier.h> | |
22 | #define smp_mb__before_clear_bit() barrier() | ||
23 | #define smp_mb__after_clear_bit() barrier() | ||
24 | 22 | ||
25 | /* | 23 | /* |
26 | * set bit | 24 | * set bit |
diff --git a/arch/mn10300/mm/tlb-smp.c b/arch/mn10300/mm/tlb-smp.c index 3e57faf04083..e5d0ef722bfa 100644 --- a/arch/mn10300/mm/tlb-smp.c +++ b/arch/mn10300/mm/tlb-smp.c | |||
@@ -78,9 +78,9 @@ void smp_flush_tlb(void *unused) | |||
78 | else | 78 | else |
79 | local_flush_tlb_page(flush_mm, flush_va); | 79 | local_flush_tlb_page(flush_mm, flush_va); |
80 | 80 | ||
81 | smp_mb__before_clear_bit(); | 81 | smp_mb__before_atomic(); |
82 | cpumask_clear_cpu(cpu_id, &flush_cpumask); | 82 | cpumask_clear_cpu(cpu_id, &flush_cpumask); |
83 | smp_mb__after_clear_bit(); | 83 | smp_mb__after_atomic(); |
84 | out: | 84 | out: |
85 | put_cpu(); | 85 | put_cpu(); |
86 | } | 86 | } |
diff --git a/arch/openrisc/include/asm/bitops.h b/arch/openrisc/include/asm/bitops.h index 2c64f2228dc7..3003cdad561b 100644 --- a/arch/openrisc/include/asm/bitops.h +++ b/arch/openrisc/include/asm/bitops.h | |||
@@ -27,14 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/irqflags.h> | 28 | #include <linux/irqflags.h> |
29 | #include <linux/compiler.h> | 29 | #include <linux/compiler.h> |
30 | 30 | #include <asm/barrier.h> | |
31 | /* | ||
32 | * clear_bit may not imply a memory barrier | ||
33 | */ | ||
34 | #ifndef smp_mb__before_clear_bit | ||
35 | #define smp_mb__before_clear_bit() smp_mb() | ||
36 | #define smp_mb__after_clear_bit() smp_mb() | ||
37 | #endif | ||
38 | 31 | ||
39 | #include <asm/bitops/__ffs.h> | 32 | #include <asm/bitops/__ffs.h> |
40 | #include <asm-generic/bitops/ffz.h> | 33 | #include <asm-generic/bitops/ffz.h> |
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index 472886ceab1d..0be2db2c7d44 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include <asm/cmpxchg.h> | 9 | #include <asm/cmpxchg.h> |
10 | #include <asm/barrier.h> | ||
10 | 11 | ||
11 | /* | 12 | /* |
12 | * Atomic operations that C can't guarantee us. Useful for | 13 | * Atomic operations that C can't guarantee us. Useful for |
@@ -143,11 +144,6 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) | |||
143 | 144 | ||
144 | #define ATOMIC_INIT(i) { (i) } | 145 | #define ATOMIC_INIT(i) { (i) } |
145 | 146 | ||
146 | #define smp_mb__before_atomic_dec() smp_mb() | ||
147 | #define smp_mb__after_atomic_dec() smp_mb() | ||
148 | #define smp_mb__before_atomic_inc() smp_mb() | ||
149 | #define smp_mb__after_atomic_inc() smp_mb() | ||
150 | |||
151 | #ifdef CONFIG_64BIT | 147 | #ifdef CONFIG_64BIT |
152 | 148 | ||
153 | #define ATOMIC64_INIT(i) { (i) } | 149 | #define ATOMIC64_INIT(i) { (i) } |
diff --git a/arch/parisc/include/asm/bitops.h b/arch/parisc/include/asm/bitops.h index 8c9b631d2a78..3f9406d9b9d6 100644 --- a/arch/parisc/include/asm/bitops.h +++ b/arch/parisc/include/asm/bitops.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
9 | #include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */ | 9 | #include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */ |
10 | #include <asm/byteorder.h> | 10 | #include <asm/byteorder.h> |
11 | #include <asm/barrier.h> | ||
11 | #include <linux/atomic.h> | 12 | #include <linux/atomic.h> |
12 | 13 | ||
13 | /* | 14 | /* |
@@ -19,9 +20,6 @@ | |||
19 | #define CHOP_SHIFTCOUNT(x) (((unsigned long) (x)) & (BITS_PER_LONG - 1)) | 20 | #define CHOP_SHIFTCOUNT(x) (((unsigned long) (x)) & (BITS_PER_LONG - 1)) |
20 | 21 | ||
21 | 22 | ||
22 | #define smp_mb__before_clear_bit() smp_mb() | ||
23 | #define smp_mb__after_clear_bit() smp_mb() | ||
24 | |||
25 | /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion | 23 | /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion |
26 | * on use of volatile and __*_bit() (set/clear/change): | 24 | * on use of volatile and __*_bit() (set/clear/change): |
27 | * *_bit() want use of volatile. | 25 | * *_bit() want use of volatile. |
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h index e3b1d41c89be..28992d012926 100644 --- a/arch/powerpc/include/asm/atomic.h +++ b/arch/powerpc/include/asm/atomic.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifdef __KERNEL__ | 8 | #ifdef __KERNEL__ |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <asm/cmpxchg.h> | 10 | #include <asm/cmpxchg.h> |
11 | #include <asm/barrier.h> | ||
11 | 12 | ||
12 | #define ATOMIC_INIT(i) { (i) } | 13 | #define ATOMIC_INIT(i) { (i) } |
13 | 14 | ||
@@ -270,11 +271,6 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) | |||
270 | } | 271 | } |
271 | #define atomic_dec_if_positive atomic_dec_if_positive | 272 | #define atomic_dec_if_positive atomic_dec_if_positive |
272 | 273 | ||
273 | #define smp_mb__before_atomic_dec() smp_mb() | ||
274 | #define smp_mb__after_atomic_dec() smp_mb() | ||
275 | #define smp_mb__before_atomic_inc() smp_mb() | ||
276 | #define smp_mb__after_atomic_inc() smp_mb() | ||
277 | |||
278 | #ifdef __powerpc64__ | 274 | #ifdef __powerpc64__ |
279 | 275 | ||
280 | #define ATOMIC64_INIT(i) { (i) } | 276 | #define ATOMIC64_INIT(i) { (i) } |
diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h index f89da808ce31..bab79a110c7b 100644 --- a/arch/powerpc/include/asm/barrier.h +++ b/arch/powerpc/include/asm/barrier.h | |||
@@ -84,4 +84,7 @@ do { \ | |||
84 | ___p1; \ | 84 | ___p1; \ |
85 | }) | 85 | }) |
86 | 86 | ||
87 | #define smp_mb__before_atomic() smp_mb() | ||
88 | #define smp_mb__after_atomic() smp_mb() | ||
89 | |||
87 | #endif /* _ASM_POWERPC_BARRIER_H */ | 90 | #endif /* _ASM_POWERPC_BARRIER_H */ |
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index a5e9a7d494d8..bd3bd573d0ae 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h | |||
@@ -51,11 +51,7 @@ | |||
51 | #define PPC_BIT(bit) (1UL << PPC_BITLSHIFT(bit)) | 51 | #define PPC_BIT(bit) (1UL << PPC_BITLSHIFT(bit)) |
52 | #define PPC_BITMASK(bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs)) | 52 | #define PPC_BITMASK(bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs)) |
53 | 53 | ||
54 | /* | 54 | #include <asm/barrier.h> |
55 | * clear_bit doesn't imply a memory barrier | ||
56 | */ | ||
57 | #define smp_mb__before_clear_bit() smp_mb() | ||
58 | #define smp_mb__after_clear_bit() smp_mb() | ||
59 | 55 | ||
60 | /* Macro for generating the ***_bits() functions */ | 56 | /* Macro for generating the ***_bits() functions */ |
61 | #define DEFINE_BITOP(fn, op, prefix) \ | 57 | #define DEFINE_BITOP(fn, op, prefix) \ |
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 18d7c80ddeb9..51dbace3269b 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -81,7 +81,7 @@ void crash_ipi_callback(struct pt_regs *regs) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | atomic_inc(&cpus_in_crash); | 83 | atomic_inc(&cpus_in_crash); |
84 | smp_mb__after_atomic_inc(); | 84 | smp_mb__after_atomic(); |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * Starting the kdump boot. | 87 | * Starting the kdump boot. |
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h index 1d4706114a45..fa934fe080c1 100644 --- a/arch/s390/include/asm/atomic.h +++ b/arch/s390/include/asm/atomic.h | |||
@@ -412,9 +412,4 @@ static inline long long atomic64_dec_if_positive(atomic64_t *v) | |||
412 | #define atomic64_dec_and_test(_v) (atomic64_sub_return(1, _v) == 0) | 412 | #define atomic64_dec_and_test(_v) (atomic64_sub_return(1, _v) == 0) |
413 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | 413 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) |
414 | 414 | ||
415 | #define smp_mb__before_atomic_dec() smp_mb() | ||
416 | #define smp_mb__after_atomic_dec() smp_mb() | ||
417 | #define smp_mb__before_atomic_inc() smp_mb() | ||
418 | #define smp_mb__after_atomic_inc() smp_mb() | ||
419 | |||
420 | #endif /* __ARCH_S390_ATOMIC__ */ | 415 | #endif /* __ARCH_S390_ATOMIC__ */ |
diff --git a/arch/s390/include/asm/barrier.h b/arch/s390/include/asm/barrier.h index 578680f6207a..19ff956b752b 100644 --- a/arch/s390/include/asm/barrier.h +++ b/arch/s390/include/asm/barrier.h | |||
@@ -27,8 +27,9 @@ | |||
27 | #define smp_rmb() rmb() | 27 | #define smp_rmb() rmb() |
28 | #define smp_wmb() wmb() | 28 | #define smp_wmb() wmb() |
29 | #define smp_read_barrier_depends() read_barrier_depends() | 29 | #define smp_read_barrier_depends() read_barrier_depends() |
30 | #define smp_mb__before_clear_bit() smp_mb() | 30 | |
31 | #define smp_mb__after_clear_bit() smp_mb() | 31 | #define smp_mb__before_atomic() smp_mb() |
32 | #define smp_mb__after_atomic() smp_mb() | ||
32 | 33 | ||
33 | #define set_mb(var, value) do { var = value; mb(); } while (0) | 34 | #define set_mb(var, value) do { var = value; mb(); } while (0) |
34 | 35 | ||
diff --git a/arch/score/include/asm/bitops.h b/arch/score/include/asm/bitops.h index a304096b1894..c1bf8d6d0fb0 100644 --- a/arch/score/include/asm/bitops.h +++ b/arch/score/include/asm/bitops.h | |||
@@ -2,12 +2,7 @@ | |||
2 | #define _ASM_SCORE_BITOPS_H | 2 | #define _ASM_SCORE_BITOPS_H |
3 | 3 | ||
4 | #include <asm/byteorder.h> /* swab32 */ | 4 | #include <asm/byteorder.h> /* swab32 */ |
5 | 5 | #include <asm/barrier.h> | |
6 | /* | ||
7 | * clear_bit() doesn't provide any barrier for the compiler. | ||
8 | */ | ||
9 | #define smp_mb__before_clear_bit() barrier() | ||
10 | #define smp_mb__after_clear_bit() barrier() | ||
11 | 6 | ||
12 | #include <asm-generic/bitops.h> | 7 | #include <asm-generic/bitops.h> |
13 | #include <asm-generic/bitops/__fls.h> | 8 | #include <asm-generic/bitops/__fls.h> |
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index f4c1c20bcdf6..f57b8a6743b3 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/compiler.h> | 10 | #include <linux/compiler.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <asm/cmpxchg.h> | 12 | #include <asm/cmpxchg.h> |
13 | #include <asm/barrier.h> | ||
13 | 14 | ||
14 | #define ATOMIC_INIT(i) { (i) } | 15 | #define ATOMIC_INIT(i) { (i) } |
15 | 16 | ||
@@ -62,9 +63,4 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
62 | return c; | 63 | return c; |
63 | } | 64 | } |
64 | 65 | ||
65 | #define smp_mb__before_atomic_dec() smp_mb() | ||
66 | #define smp_mb__after_atomic_dec() smp_mb() | ||
67 | #define smp_mb__before_atomic_inc() smp_mb() | ||
68 | #define smp_mb__after_atomic_inc() smp_mb() | ||
69 | |||
70 | #endif /* __ASM_SH_ATOMIC_H */ | 66 | #endif /* __ASM_SH_ATOMIC_H */ |
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h index ea8706d94f08..fc8e652cf173 100644 --- a/arch/sh/include/asm/bitops.h +++ b/arch/sh/include/asm/bitops.h | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | /* For __swab32 */ | 10 | /* For __swab32 */ |
11 | #include <asm/byteorder.h> | 11 | #include <asm/byteorder.h> |
12 | #include <asm/barrier.h> | ||
12 | 13 | ||
13 | #ifdef CONFIG_GUSA_RB | 14 | #ifdef CONFIG_GUSA_RB |
14 | #include <asm/bitops-grb.h> | 15 | #include <asm/bitops-grb.h> |
@@ -22,12 +23,6 @@ | |||
22 | #include <asm-generic/bitops/non-atomic.h> | 23 | #include <asm-generic/bitops/non-atomic.h> |
23 | #endif | 24 | #endif |
24 | 25 | ||
25 | /* | ||
26 | * clear_bit() doesn't provide any barrier for the compiler. | ||
27 | */ | ||
28 | #define smp_mb__before_clear_bit() smp_mb() | ||
29 | #define smp_mb__after_clear_bit() smp_mb() | ||
30 | |||
31 | #ifdef CONFIG_SUPERH32 | 26 | #ifdef CONFIG_SUPERH32 |
32 | static inline unsigned long ffz(unsigned long word) | 27 | static inline unsigned long ffz(unsigned long word) |
33 | { | 28 | { |
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 905832aa9e9e..f08fe51b264d 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | 15 | ||
16 | #include <asm/cmpxchg.h> | 16 | #include <asm/cmpxchg.h> |
17 | #include <asm/barrier.h> | ||
17 | #include <asm-generic/atomic64.h> | 18 | #include <asm-generic/atomic64.h> |
18 | 19 | ||
19 | 20 | ||
@@ -52,10 +53,4 @@ extern void atomic_set(atomic_t *, int); | |||
52 | #define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) | 53 | #define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) |
53 | #define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) | 54 | #define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) |
54 | 55 | ||
55 | /* Atomic operations are already serializing */ | ||
56 | #define smp_mb__before_atomic_dec() barrier() | ||
57 | #define smp_mb__after_atomic_dec() barrier() | ||
58 | #define smp_mb__before_atomic_inc() barrier() | ||
59 | #define smp_mb__after_atomic_inc() barrier() | ||
60 | |||
61 | #endif /* !(__ARCH_SPARC_ATOMIC__) */ | 56 | #endif /* !(__ARCH_SPARC_ATOMIC__) */ |
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index be56a244c9cf..8b2f1bde2889 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <asm/cmpxchg.h> | 11 | #include <asm/cmpxchg.h> |
12 | #include <asm/barrier.h> | ||
12 | 13 | ||
13 | #define ATOMIC_INIT(i) { (i) } | 14 | #define ATOMIC_INIT(i) { (i) } |
14 | #define ATOMIC64_INIT(i) { (i) } | 15 | #define ATOMIC64_INIT(i) { (i) } |
@@ -108,10 +109,4 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u) | |||
108 | 109 | ||
109 | extern long atomic64_dec_if_positive(atomic64_t *v); | 110 | extern long atomic64_dec_if_positive(atomic64_t *v); |
110 | 111 | ||
111 | /* Atomic operations are already serializing */ | ||
112 | #define smp_mb__before_atomic_dec() barrier() | ||
113 | #define smp_mb__after_atomic_dec() barrier() | ||
114 | #define smp_mb__before_atomic_inc() barrier() | ||
115 | #define smp_mb__after_atomic_inc() barrier() | ||
116 | |||
117 | #endif /* !(__ARCH_SPARC64_ATOMIC__) */ | 112 | #endif /* !(__ARCH_SPARC64_ATOMIC__) */ |
diff --git a/arch/sparc/include/asm/barrier_64.h b/arch/sparc/include/asm/barrier_64.h index b5aad964558e..305dcc3dc721 100644 --- a/arch/sparc/include/asm/barrier_64.h +++ b/arch/sparc/include/asm/barrier_64.h | |||
@@ -68,4 +68,7 @@ do { \ | |||
68 | ___p1; \ | 68 | ___p1; \ |
69 | }) | 69 | }) |
70 | 70 | ||
71 | #define smp_mb__before_atomic() barrier() | ||
72 | #define smp_mb__after_atomic() barrier() | ||
73 | |||
71 | #endif /* !(__SPARC64_BARRIER_H) */ | 74 | #endif /* !(__SPARC64_BARRIER_H) */ |
diff --git a/arch/sparc/include/asm/bitops_32.h b/arch/sparc/include/asm/bitops_32.h index 25a676653d45..88c9a962502c 100644 --- a/arch/sparc/include/asm/bitops_32.h +++ b/arch/sparc/include/asm/bitops_32.h | |||
@@ -90,9 +90,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | |||
90 | 90 | ||
91 | #include <asm-generic/bitops/non-atomic.h> | 91 | #include <asm-generic/bitops/non-atomic.h> |
92 | 92 | ||
93 | #define smp_mb__before_clear_bit() do { } while(0) | ||
94 | #define smp_mb__after_clear_bit() do { } while(0) | ||
95 | |||
96 | #include <asm-generic/bitops/ffz.h> | 93 | #include <asm-generic/bitops/ffz.h> |
97 | #include <asm-generic/bitops/__ffs.h> | 94 | #include <asm-generic/bitops/__ffs.h> |
98 | #include <asm-generic/bitops/sched.h> | 95 | #include <asm-generic/bitops/sched.h> |
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index 29011cc0e4be..f1a051ca301a 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
15 | #include <asm/byteorder.h> | 15 | #include <asm/byteorder.h> |
16 | #include <asm/barrier.h> | ||
16 | 17 | ||
17 | extern int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); | 18 | extern int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); |
18 | extern int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); | 19 | extern int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); |
@@ -23,9 +24,6 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); | |||
23 | 24 | ||
24 | #include <asm-generic/bitops/non-atomic.h> | 25 | #include <asm-generic/bitops/non-atomic.h> |
25 | 26 | ||
26 | #define smp_mb__before_clear_bit() barrier() | ||
27 | #define smp_mb__after_clear_bit() barrier() | ||
28 | |||
29 | #include <asm-generic/bitops/fls.h> | 27 | #include <asm-generic/bitops/fls.h> |
30 | #include <asm-generic/bitops/__fls.h> | 28 | #include <asm-generic/bitops/__fls.h> |
31 | #include <asm-generic/bitops/fls64.h> | 29 | #include <asm-generic/bitops/fls64.h> |
diff --git a/arch/tile/include/asm/atomic_32.h b/arch/tile/include/asm/atomic_32.h index 1ad4a1f7d42b..1b109fad9fff 100644 --- a/arch/tile/include/asm/atomic_32.h +++ b/arch/tile/include/asm/atomic_32.h | |||
@@ -169,16 +169,6 @@ static inline void atomic64_set(atomic64_t *v, long long n) | |||
169 | #define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) | 169 | #define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) |
170 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL) | 170 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL) |
171 | 171 | ||
172 | /* | ||
173 | * We need to barrier before modifying the word, since the _atomic_xxx() | ||
174 | * routines just tns the lock and then read/modify/write of the word. | ||
175 | * But after the word is updated, the routine issues an "mf" before returning, | ||
176 | * and since it's a function call, we don't even need a compiler barrier. | ||
177 | */ | ||
178 | #define smp_mb__before_atomic_dec() smp_mb() | ||
179 | #define smp_mb__before_atomic_inc() smp_mb() | ||
180 | #define smp_mb__after_atomic_dec() do { } while (0) | ||
181 | #define smp_mb__after_atomic_inc() do { } while (0) | ||
182 | 172 | ||
183 | #endif /* !__ASSEMBLY__ */ | 173 | #endif /* !__ASSEMBLY__ */ |
184 | 174 | ||
diff --git a/arch/tile/include/asm/atomic_64.h b/arch/tile/include/asm/atomic_64.h index ad220eed05fc..7b11c5fadd42 100644 --- a/arch/tile/include/asm/atomic_64.h +++ b/arch/tile/include/asm/atomic_64.h | |||
@@ -105,12 +105,6 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u) | |||
105 | 105 | ||
106 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | 106 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) |
107 | 107 | ||
108 | /* Atomic dec and inc don't implement barrier, so provide them if needed. */ | ||
109 | #define smp_mb__before_atomic_dec() smp_mb() | ||
110 | #define smp_mb__after_atomic_dec() smp_mb() | ||
111 | #define smp_mb__before_atomic_inc() smp_mb() | ||
112 | #define smp_mb__after_atomic_inc() smp_mb() | ||
113 | |||
114 | /* Define this to indicate that cmpxchg is an efficient operation. */ | 108 | /* Define this to indicate that cmpxchg is an efficient operation. */ |
115 | #define __HAVE_ARCH_CMPXCHG | 109 | #define __HAVE_ARCH_CMPXCHG |
116 | 110 | ||
diff --git a/arch/tile/include/asm/barrier.h b/arch/tile/include/asm/barrier.h index b5a05d050a8f..96a42ae79f4d 100644 --- a/arch/tile/include/asm/barrier.h +++ b/arch/tile/include/asm/barrier.h | |||
@@ -72,6 +72,20 @@ mb_incoherent(void) | |||
72 | #define mb() fast_mb() | 72 | #define mb() fast_mb() |
73 | #define iob() fast_iob() | 73 | #define iob() fast_iob() |
74 | 74 | ||
75 | #ifndef __tilegx__ /* 32 bit */ | ||
76 | /* | ||
77 | * We need to barrier before modifying the word, since the _atomic_xxx() | ||
78 | * routines just tns the lock and then read/modify/write of the word. | ||
79 | * But after the word is updated, the routine issues an "mf" before returning, | ||
80 | * and since it's a function call, we don't even need a compiler barrier. | ||
81 | */ | ||
82 | #define smp_mb__before_atomic() smp_mb() | ||
83 | #define smp_mb__after_atomic() do { } while (0) | ||
84 | #else /* 64 bit */ | ||
85 | #define smp_mb__before_atomic() smp_mb() | ||
86 | #define smp_mb__after_atomic() smp_mb() | ||
87 | #endif | ||
88 | |||
75 | #include <asm-generic/barrier.h> | 89 | #include <asm-generic/barrier.h> |
76 | 90 | ||
77 | #endif /* !__ASSEMBLY__ */ | 91 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/tile/include/asm/bitops.h b/arch/tile/include/asm/bitops.h index d5a206865036..20caa346ac06 100644 --- a/arch/tile/include/asm/bitops.h +++ b/arch/tile/include/asm/bitops.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define _ASM_TILE_BITOPS_H | 17 | #define _ASM_TILE_BITOPS_H |
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <asm/barrier.h> | ||
20 | 21 | ||
21 | #ifndef _LINUX_BITOPS_H | 22 | #ifndef _LINUX_BITOPS_H |
22 | #error only <linux/bitops.h> can be included directly | 23 | #error only <linux/bitops.h> can be included directly |
diff --git a/arch/tile/include/asm/bitops_32.h b/arch/tile/include/asm/bitops_32.h index 386865ad2f55..bbf7b666f21d 100644 --- a/arch/tile/include/asm/bitops_32.h +++ b/arch/tile/include/asm/bitops_32.h | |||
@@ -49,8 +49,8 @@ static inline void set_bit(unsigned nr, volatile unsigned long *addr) | |||
49 | * restricted to acting on a single-word quantity. | 49 | * restricted to acting on a single-word quantity. |
50 | * | 50 | * |
51 | * clear_bit() may not contain a memory barrier, so if it is used for | 51 | * clear_bit() may not contain a memory barrier, so if it is used for |
52 | * locking purposes, you should call smp_mb__before_clear_bit() and/or | 52 | * locking purposes, you should call smp_mb__before_atomic() and/or |
53 | * smp_mb__after_clear_bit() to ensure changes are visible on other cpus. | 53 | * smp_mb__after_atomic() to ensure changes are visible on other cpus. |
54 | */ | 54 | */ |
55 | static inline void clear_bit(unsigned nr, volatile unsigned long *addr) | 55 | static inline void clear_bit(unsigned nr, volatile unsigned long *addr) |
56 | { | 56 | { |
@@ -121,10 +121,6 @@ static inline int test_and_change_bit(unsigned nr, | |||
121 | return (_atomic_xor(addr, mask) & mask) != 0; | 121 | return (_atomic_xor(addr, mask) & mask) != 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | /* See discussion at smp_mb__before_atomic_dec() in <asm/atomic_32.h>. */ | ||
125 | #define smp_mb__before_clear_bit() smp_mb() | ||
126 | #define smp_mb__after_clear_bit() do {} while (0) | ||
127 | |||
128 | #include <asm-generic/bitops/ext2-atomic.h> | 124 | #include <asm-generic/bitops/ext2-atomic.h> |
129 | 125 | ||
130 | #endif /* _ASM_TILE_BITOPS_32_H */ | 126 | #endif /* _ASM_TILE_BITOPS_32_H */ |
diff --git a/arch/tile/include/asm/bitops_64.h b/arch/tile/include/asm/bitops_64.h index ad34cd056085..bb1a29221fcd 100644 --- a/arch/tile/include/asm/bitops_64.h +++ b/arch/tile/include/asm/bitops_64.h | |||
@@ -32,10 +32,6 @@ static inline void clear_bit(unsigned nr, volatile unsigned long *addr) | |||
32 | __insn_fetchand((void *)(addr + nr / BITS_PER_LONG), ~mask); | 32 | __insn_fetchand((void *)(addr + nr / BITS_PER_LONG), ~mask); |
33 | } | 33 | } |
34 | 34 | ||
35 | #define smp_mb__before_clear_bit() smp_mb() | ||
36 | #define smp_mb__after_clear_bit() smp_mb() | ||
37 | |||
38 | |||
39 | static inline void change_bit(unsigned nr, volatile unsigned long *addr) | 35 | static inline void change_bit(unsigned nr, volatile unsigned long *addr) |
40 | { | 36 | { |
41 | unsigned long mask = (1UL << (nr % BITS_PER_LONG)); | 37 | unsigned long mask = (1UL << (nr % BITS_PER_LONG)); |
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index b17f4f48ecd7..6dd1c7dd0473 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <asm/alternative.h> | 7 | #include <asm/alternative.h> |
8 | #include <asm/cmpxchg.h> | 8 | #include <asm/cmpxchg.h> |
9 | #include <asm/rmwcc.h> | 9 | #include <asm/rmwcc.h> |
10 | #include <asm/barrier.h> | ||
10 | 11 | ||
11 | /* | 12 | /* |
12 | * Atomic operations that C can't guarantee us. Useful for | 13 | * Atomic operations that C can't guarantee us. Useful for |
@@ -243,12 +244,6 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2) | |||
243 | : : "r" ((unsigned)(mask)), "m" (*(addr)) \ | 244 | : : "r" ((unsigned)(mask)), "m" (*(addr)) \ |
244 | : "memory") | 245 | : "memory") |
245 | 246 | ||
246 | /* Atomic operations are already serializing on x86 */ | ||
247 | #define smp_mb__before_atomic_dec() barrier() | ||
248 | #define smp_mb__after_atomic_dec() barrier() | ||
249 | #define smp_mb__before_atomic_inc() barrier() | ||
250 | #define smp_mb__after_atomic_inc() barrier() | ||
251 | |||
252 | #ifdef CONFIG_X86_32 | 247 | #ifdef CONFIG_X86_32 |
253 | # include <asm/atomic64_32.h> | 248 | # include <asm/atomic64_32.h> |
254 | #else | 249 | #else |
diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h index 69bbb4845020..5c7198cca5ed 100644 --- a/arch/x86/include/asm/barrier.h +++ b/arch/x86/include/asm/barrier.h | |||
@@ -137,6 +137,10 @@ do { \ | |||
137 | 137 | ||
138 | #endif | 138 | #endif |
139 | 139 | ||
140 | /* Atomic operations are already serializing on x86 */ | ||
141 | #define smp_mb__before_atomic() barrier() | ||
142 | #define smp_mb__after_atomic() barrier() | ||
143 | |||
140 | /* | 144 | /* |
141 | * Stop RDTSC speculation. This is needed when you need to use RDTSC | 145 | * Stop RDTSC speculation. This is needed when you need to use RDTSC |
142 | * (or get_cycles or vread that possibly accesses the TSC) in a defined | 146 | * (or get_cycles or vread that possibly accesses the TSC) in a defined |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 9fc1af74dc83..afcd35d331de 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
16 | #include <asm/alternative.h> | 16 | #include <asm/alternative.h> |
17 | #include <asm/rmwcc.h> | 17 | #include <asm/rmwcc.h> |
18 | #include <asm/barrier.h> | ||
18 | 19 | ||
19 | #if BITS_PER_LONG == 32 | 20 | #if BITS_PER_LONG == 32 |
20 | # define _BITOPS_LONG_SHIFT 5 | 21 | # define _BITOPS_LONG_SHIFT 5 |
@@ -102,7 +103,7 @@ static inline void __set_bit(long nr, volatile unsigned long *addr) | |||
102 | * | 103 | * |
103 | * clear_bit() is atomic and may not be reordered. However, it does | 104 | * clear_bit() is atomic and may not be reordered. However, it does |
104 | * not contain a memory barrier, so if it is used for locking purposes, | 105 | * not contain a memory barrier, so if it is used for locking purposes, |
105 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 106 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
106 | * in order to ensure changes are visible on other processors. | 107 | * in order to ensure changes are visible on other processors. |
107 | */ | 108 | */ |
108 | static __always_inline void | 109 | static __always_inline void |
@@ -156,9 +157,6 @@ static inline void __clear_bit_unlock(long nr, volatile unsigned long *addr) | |||
156 | __clear_bit(nr, addr); | 157 | __clear_bit(nr, addr); |
157 | } | 158 | } |
158 | 159 | ||
159 | #define smp_mb__before_clear_bit() barrier() | ||
160 | #define smp_mb__after_clear_bit() barrier() | ||
161 | |||
162 | /** | 160 | /** |
163 | * __change_bit - Toggle a bit in memory | 161 | * __change_bit - Toggle a bit in memory |
164 | * @nr: the bit to change | 162 | * @nr: the bit to change |
diff --git a/arch/x86/include/asm/sync_bitops.h b/arch/x86/include/asm/sync_bitops.h index 05af3b31d522..f28a24b51dc7 100644 --- a/arch/x86/include/asm/sync_bitops.h +++ b/arch/x86/include/asm/sync_bitops.h | |||
@@ -41,7 +41,7 @@ static inline void sync_set_bit(long nr, volatile unsigned long *addr) | |||
41 | * | 41 | * |
42 | * sync_clear_bit() is atomic and may not be reordered. However, it does | 42 | * sync_clear_bit() is atomic and may not be reordered. However, it does |
43 | * not contain a memory barrier, so if it is used for locking purposes, | 43 | * not contain a memory barrier, so if it is used for locking purposes, |
44 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 44 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
45 | * in order to ensure changes are visible on other processors. | 45 | * in order to ensure changes are visible on other processors. |
46 | */ | 46 | */ |
47 | static inline void sync_clear_bit(long nr, volatile unsigned long *addr) | 47 | static inline void sync_clear_bit(long nr, volatile unsigned long *addr) |
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c index a698d7165c96..eab67047dec3 100644 --- a/arch/x86/kernel/apic/hw_nmi.c +++ b/arch/x86/kernel/apic/hw_nmi.c | |||
@@ -57,7 +57,7 @@ void arch_trigger_all_cpu_backtrace(void) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | clear_bit(0, &backtrace_flag); | 59 | clear_bit(0, &backtrace_flag); |
60 | smp_mb__after_clear_bit(); | 60 | smp_mb__after_atomic(); |
61 | } | 61 | } |
62 | 62 | ||
63 | static int __kprobes | 63 | static int __kprobes |
diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h index e7fb447bce8e..e5103b47a8ce 100644 --- a/arch/xtensa/include/asm/atomic.h +++ b/arch/xtensa/include/asm/atomic.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifdef __KERNEL__ | 19 | #ifdef __KERNEL__ |
20 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
21 | #include <asm/cmpxchg.h> | 21 | #include <asm/cmpxchg.h> |
22 | #include <asm/barrier.h> | ||
22 | 23 | ||
23 | #define ATOMIC_INIT(i) { (i) } | 24 | #define ATOMIC_INIT(i) { (i) } |
24 | 25 | ||
@@ -387,12 +388,6 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | |||
387 | #endif | 388 | #endif |
388 | } | 389 | } |
389 | 390 | ||
390 | /* Atomic operations are already serializing */ | ||
391 | #define smp_mb__before_atomic_dec() barrier() | ||
392 | #define smp_mb__after_atomic_dec() barrier() | ||
393 | #define smp_mb__before_atomic_inc() barrier() | ||
394 | #define smp_mb__after_atomic_inc() barrier() | ||
395 | |||
396 | #endif /* __KERNEL__ */ | 391 | #endif /* __KERNEL__ */ |
397 | 392 | ||
398 | #endif /* _XTENSA_ATOMIC_H */ | 393 | #endif /* _XTENSA_ATOMIC_H */ |
diff --git a/arch/xtensa/include/asm/barrier.h b/arch/xtensa/include/asm/barrier.h index 0a24b04d6b21..5b88774c75ab 100644 --- a/arch/xtensa/include/asm/barrier.h +++ b/arch/xtensa/include/asm/barrier.h | |||
@@ -13,6 +13,9 @@ | |||
13 | #define rmb() barrier() | 13 | #define rmb() barrier() |
14 | #define wmb() mb() | 14 | #define wmb() mb() |
15 | 15 | ||
16 | #define smp_mb__before_atomic() barrier() | ||
17 | #define smp_mb__after_atomic() barrier() | ||
18 | |||
16 | #include <asm-generic/barrier.h> | 19 | #include <asm-generic/barrier.h> |
17 | 20 | ||
18 | #endif /* _XTENSA_SYSTEM_H */ | 21 | #endif /* _XTENSA_SYSTEM_H */ |
diff --git a/arch/xtensa/include/asm/bitops.h b/arch/xtensa/include/asm/bitops.h index 7b6873ae84c2..3f44fa2a53e9 100644 --- a/arch/xtensa/include/asm/bitops.h +++ b/arch/xtensa/include/asm/bitops.h | |||
@@ -21,9 +21,7 @@ | |||
21 | 21 | ||
22 | #include <asm/processor.h> | 22 | #include <asm/processor.h> |
23 | #include <asm/byteorder.h> | 23 | #include <asm/byteorder.h> |
24 | 24 | #include <asm/barrier.h> | |
25 | #define smp_mb__before_clear_bit() smp_mb() | ||
26 | #define smp_mb__after_clear_bit() smp_mb() | ||
27 | 25 | ||
28 | #include <asm-generic/bitops/non-atomic.h> | 26 | #include <asm-generic/bitops/non-atomic.h> |
29 | 27 | ||
diff --git a/block/blk-iopoll.c b/block/blk-iopoll.c index d828b44a404b..0736729d6494 100644 --- a/block/blk-iopoll.c +++ b/block/blk-iopoll.c | |||
@@ -49,7 +49,7 @@ EXPORT_SYMBOL(blk_iopoll_sched); | |||
49 | void __blk_iopoll_complete(struct blk_iopoll *iop) | 49 | void __blk_iopoll_complete(struct blk_iopoll *iop) |
50 | { | 50 | { |
51 | list_del(&iop->list); | 51 | list_del(&iop->list); |
52 | smp_mb__before_clear_bit(); | 52 | smp_mb__before_atomic(); |
53 | clear_bit_unlock(IOPOLL_F_SCHED, &iop->state); | 53 | clear_bit_unlock(IOPOLL_F_SCHED, &iop->state); |
54 | } | 54 | } |
55 | EXPORT_SYMBOL(__blk_iopoll_complete); | 55 | EXPORT_SYMBOL(__blk_iopoll_complete); |
@@ -161,7 +161,7 @@ EXPORT_SYMBOL(blk_iopoll_disable); | |||
161 | void blk_iopoll_enable(struct blk_iopoll *iop) | 161 | void blk_iopoll_enable(struct blk_iopoll *iop) |
162 | { | 162 | { |
163 | BUG_ON(!test_bit(IOPOLL_F_SCHED, &iop->state)); | 163 | BUG_ON(!test_bit(IOPOLL_F_SCHED, &iop->state)); |
164 | smp_mb__before_clear_bit(); | 164 | smp_mb__before_atomic(); |
165 | clear_bit_unlock(IOPOLL_F_SCHED, &iop->state); | 165 | clear_bit_unlock(IOPOLL_F_SCHED, &iop->state); |
166 | } | 166 | } |
167 | EXPORT_SYMBOL(blk_iopoll_enable); | 167 | EXPORT_SYMBOL(blk_iopoll_enable); |
diff --git a/crypto/chainiv.c b/crypto/chainiv.c index 834d8dd3d4fc..9c294c8f9a07 100644 --- a/crypto/chainiv.c +++ b/crypto/chainiv.c | |||
@@ -126,7 +126,7 @@ static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx) | |||
126 | int err = ctx->err; | 126 | int err = ctx->err; |
127 | 127 | ||
128 | if (!ctx->queue.qlen) { | 128 | if (!ctx->queue.qlen) { |
129 | smp_mb__before_clear_bit(); | 129 | smp_mb__before_atomic(); |
130 | clear_bit(CHAINIV_STATE_INUSE, &ctx->state); | 130 | clear_bit(CHAINIV_STATE_INUSE, &ctx->state); |
131 | 131 | ||
132 | if (!ctx->queue.qlen || | 132 | if (!ctx->queue.qlen || |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index ae098a261fcd..eee55c1e5fde 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -105,7 +105,7 @@ static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd) | |||
105 | static void genpd_sd_counter_inc(struct generic_pm_domain *genpd) | 105 | static void genpd_sd_counter_inc(struct generic_pm_domain *genpd) |
106 | { | 106 | { |
107 | atomic_inc(&genpd->sd_count); | 107 | atomic_inc(&genpd->sd_count); |
108 | smp_mb__after_atomic_inc(); | 108 | smp_mb__after_atomic(); |
109 | } | 109 | } |
110 | 110 | ||
111 | static void genpd_acquire_lock(struct generic_pm_domain *genpd) | 111 | static void genpd_acquire_lock(struct generic_pm_domain *genpd) |
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c index cb6654bfad77..73fe2f8d7f96 100644 --- a/drivers/cpuidle/coupled.c +++ b/drivers/cpuidle/coupled.c | |||
@@ -159,7 +159,7 @@ void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a) | |||
159 | { | 159 | { |
160 | int n = dev->coupled->online_count; | 160 | int n = dev->coupled->online_count; |
161 | 161 | ||
162 | smp_mb__before_atomic_inc(); | 162 | smp_mb__before_atomic(); |
163 | atomic_inc(a); | 163 | atomic_inc(a); |
164 | 164 | ||
165 | while (atomic_read(a) < n) | 165 | while (atomic_read(a) < n) |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 586f2f7f6993..ce7a5812ae9d 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -3498,7 +3498,7 @@ static int ohci_flush_iso_completions(struct fw_iso_context *base) | |||
3498 | } | 3498 | } |
3499 | 3499 | ||
3500 | clear_bit_unlock(0, &ctx->flushing_completions); | 3500 | clear_bit_unlock(0, &ctx->flushing_completions); |
3501 | smp_mb__after_clear_bit(); | 3501 | smp_mb__after_atomic(); |
3502 | } | 3502 | } |
3503 | 3503 | ||
3504 | tasklet_enable(&ctx->context.tasklet); | 3504 | tasklet_enable(&ctx->context.tasklet); |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index c2676b5908d9..ec5c3f4cdd01 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -156,7 +156,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc) | |||
156 | */ | 156 | */ |
157 | if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { | 157 | if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { |
158 | atomic_inc(&dev->vblank[crtc].count); | 158 | atomic_inc(&dev->vblank[crtc].count); |
159 | smp_mb__after_atomic_inc(); | 159 | smp_mb__after_atomic(); |
160 | } | 160 | } |
161 | 161 | ||
162 | /* Invalidate all timestamps while vblank irq's are off. */ | 162 | /* Invalidate all timestamps while vblank irq's are off. */ |
@@ -864,9 +864,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc) | |||
864 | vblanktimestamp(dev, crtc, tslot) = t_vblank; | 864 | vblanktimestamp(dev, crtc, tslot) = t_vblank; |
865 | } | 865 | } |
866 | 866 | ||
867 | smp_mb__before_atomic_inc(); | 867 | smp_mb__before_atomic(); |
868 | atomic_add(diff, &dev->vblank[crtc].count); | 868 | atomic_add(diff, &dev->vblank[crtc].count); |
869 | smp_mb__after_atomic_inc(); | 869 | smp_mb__after_atomic(); |
870 | } | 870 | } |
871 | 871 | ||
872 | /** | 872 | /** |
@@ -1330,9 +1330,9 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1330 | /* Increment cooked vblank count. This also atomically commits | 1330 | /* Increment cooked vblank count. This also atomically commits |
1331 | * the timestamp computed above. | 1331 | * the timestamp computed above. |
1332 | */ | 1332 | */ |
1333 | smp_mb__before_atomic_inc(); | 1333 | smp_mb__before_atomic(); |
1334 | atomic_inc(&dev->vblank[crtc].count); | 1334 | atomic_inc(&dev->vblank[crtc].count); |
1335 | smp_mb__after_atomic_inc(); | 1335 | smp_mb__after_atomic(); |
1336 | } else { | 1336 | } else { |
1337 | DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", | 1337 | DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", |
1338 | crtc, (int) diff_ns); | 1338 | crtc, (int) diff_ns); |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index f98ba4e6e70b..0b99de95593b 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -2157,7 +2157,7 @@ static void i915_error_work_func(struct work_struct *work) | |||
2157 | * updates before | 2157 | * updates before |
2158 | * the counter increment. | 2158 | * the counter increment. |
2159 | */ | 2159 | */ |
2160 | smp_mb__before_atomic_inc(); | 2160 | smp_mb__before_atomic(); |
2161 | atomic_inc(&dev_priv->gpu_error.reset_counter); | 2161 | atomic_inc(&dev_priv->gpu_error.reset_counter); |
2162 | 2162 | ||
2163 | kobject_uevent_env(&dev->primary->kdev->kobj, | 2163 | kobject_uevent_env(&dev->primary->kdev->kobj, |
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 82c9c5d35251..d2ebcf323094 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h | |||
@@ -828,7 +828,7 @@ static inline bool cached_dev_get(struct cached_dev *dc) | |||
828 | return false; | 828 | return false; |
829 | 829 | ||
830 | /* Paired with the mb in cached_dev_attach */ | 830 | /* Paired with the mb in cached_dev_attach */ |
831 | smp_mb__after_atomic_inc(); | 831 | smp_mb__after_atomic(); |
832 | return true; | 832 | return true; |
833 | } | 833 | } |
834 | 834 | ||
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h index 7ef7461912be..a08e3eeac3c5 100644 --- a/drivers/md/bcache/closure.h +++ b/drivers/md/bcache/closure.h | |||
@@ -243,7 +243,7 @@ static inline void set_closure_fn(struct closure *cl, closure_fn *fn, | |||
243 | cl->fn = fn; | 243 | cl->fn = fn; |
244 | cl->wq = wq; | 244 | cl->wq = wq; |
245 | /* between atomic_dec() in closure_put() */ | 245 | /* between atomic_dec() in closure_put() */ |
246 | smp_mb__before_atomic_dec(); | 246 | smp_mb__before_atomic(); |
247 | } | 247 | } |
248 | 248 | ||
249 | static inline void closure_queue(struct closure *cl) | 249 | static inline void closure_queue(struct closure *cl) |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 66c5d130c8c2..4e84095833db 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -607,9 +607,9 @@ static void write_endio(struct bio *bio, int error) | |||
607 | 607 | ||
608 | BUG_ON(!test_bit(B_WRITING, &b->state)); | 608 | BUG_ON(!test_bit(B_WRITING, &b->state)); |
609 | 609 | ||
610 | smp_mb__before_clear_bit(); | 610 | smp_mb__before_atomic(); |
611 | clear_bit(B_WRITING, &b->state); | 611 | clear_bit(B_WRITING, &b->state); |
612 | smp_mb__after_clear_bit(); | 612 | smp_mb__after_atomic(); |
613 | 613 | ||
614 | wake_up_bit(&b->state, B_WRITING); | 614 | wake_up_bit(&b->state, B_WRITING); |
615 | } | 615 | } |
@@ -997,9 +997,9 @@ static void read_endio(struct bio *bio, int error) | |||
997 | 997 | ||
998 | BUG_ON(!test_bit(B_READING, &b->state)); | 998 | BUG_ON(!test_bit(B_READING, &b->state)); |
999 | 999 | ||
1000 | smp_mb__before_clear_bit(); | 1000 | smp_mb__before_atomic(); |
1001 | clear_bit(B_READING, &b->state); | 1001 | clear_bit(B_READING, &b->state); |
1002 | smp_mb__after_clear_bit(); | 1002 | smp_mb__after_atomic(); |
1003 | 1003 | ||
1004 | wake_up_bit(&b->state, B_READING); | 1004 | wake_up_bit(&b->state, B_READING); |
1005 | } | 1005 | } |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index ebddef5237e4..8e0caed0bf74 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -642,7 +642,7 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe) | |||
642 | struct dm_snapshot *s = pe->snap; | 642 | struct dm_snapshot *s = pe->snap; |
643 | 643 | ||
644 | mempool_free(pe, s->pending_pool); | 644 | mempool_free(pe, s->pending_pool); |
645 | smp_mb__before_atomic_dec(); | 645 | smp_mb__before_atomic(); |
646 | atomic_dec(&s->pending_exceptions_count); | 646 | atomic_dec(&s->pending_exceptions_count); |
647 | } | 647 | } |
648 | 648 | ||
@@ -783,7 +783,7 @@ static int init_hash_tables(struct dm_snapshot *s) | |||
783 | static void merge_shutdown(struct dm_snapshot *s) | 783 | static void merge_shutdown(struct dm_snapshot *s) |
784 | { | 784 | { |
785 | clear_bit_unlock(RUNNING_MERGE, &s->state_bits); | 785 | clear_bit_unlock(RUNNING_MERGE, &s->state_bits); |
786 | smp_mb__after_clear_bit(); | 786 | smp_mb__after_atomic(); |
787 | wake_up_bit(&s->state_bits, RUNNING_MERGE); | 787 | wake_up_bit(&s->state_bits, RUNNING_MERGE); |
788 | } | 788 | } |
789 | 789 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 6a71bc7c9133..aa9e093343d4 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -2446,7 +2446,7 @@ static void dm_wq_work(struct work_struct *work) | |||
2446 | static void dm_queue_flush(struct mapped_device *md) | 2446 | static void dm_queue_flush(struct mapped_device *md) |
2447 | { | 2447 | { |
2448 | clear_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags); | 2448 | clear_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags); |
2449 | smp_mb__after_clear_bit(); | 2449 | smp_mb__after_atomic(); |
2450 | queue_work(md->wq, &md->work); | 2450 | queue_work(md->wq, &md->work); |
2451 | } | 2451 | } |
2452 | 2452 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ad1b9bea446e..2afef4ec9312 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4400,7 +4400,7 @@ static void raid5_unplug(struct blk_plug_cb *blk_cb, bool from_schedule) | |||
4400 | * STRIPE_ON_UNPLUG_LIST clear but the stripe | 4400 | * STRIPE_ON_UNPLUG_LIST clear but the stripe |
4401 | * is still in our list | 4401 | * is still in our list |
4402 | */ | 4402 | */ |
4403 | smp_mb__before_clear_bit(); | 4403 | smp_mb__before_atomic(); |
4404 | clear_bit(STRIPE_ON_UNPLUG_LIST, &sh->state); | 4404 | clear_bit(STRIPE_ON_UNPLUG_LIST, &sh->state); |
4405 | /* | 4405 | /* |
4406 | * STRIPE_ON_RELEASE_LIST could be set here. In that | 4406 | * STRIPE_ON_RELEASE_LIST could be set here. In that |
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index de02db802ace..e35580618936 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | |||
@@ -399,7 +399,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
399 | 399 | ||
400 | /* clear 'streaming' status bit */ | 400 | /* clear 'streaming' status bit */ |
401 | clear_bit(ADAP_STREAMING, &adap->state_bits); | 401 | clear_bit(ADAP_STREAMING, &adap->state_bits); |
402 | smp_mb__after_clear_bit(); | 402 | smp_mb__after_atomic(); |
403 | wake_up_bit(&adap->state_bits, ADAP_STREAMING); | 403 | wake_up_bit(&adap->state_bits, ADAP_STREAMING); |
404 | skip_feed_stop: | 404 | skip_feed_stop: |
405 | 405 | ||
@@ -550,7 +550,7 @@ static int dvb_usb_fe_init(struct dvb_frontend *fe) | |||
550 | err: | 550 | err: |
551 | if (!adap->suspend_resume_active) { | 551 | if (!adap->suspend_resume_active) { |
552 | clear_bit(ADAP_INIT, &adap->state_bits); | 552 | clear_bit(ADAP_INIT, &adap->state_bits); |
553 | smp_mb__after_clear_bit(); | 553 | smp_mb__after_atomic(); |
554 | wake_up_bit(&adap->state_bits, ADAP_INIT); | 554 | wake_up_bit(&adap->state_bits, ADAP_INIT); |
555 | } | 555 | } |
556 | 556 | ||
@@ -591,7 +591,7 @@ err: | |||
591 | if (!adap->suspend_resume_active) { | 591 | if (!adap->suspend_resume_active) { |
592 | adap->active_fe = -1; | 592 | adap->active_fe = -1; |
593 | clear_bit(ADAP_SLEEP, &adap->state_bits); | 593 | clear_bit(ADAP_SLEEP, &adap->state_bits); |
594 | smp_mb__after_clear_bit(); | 594 | smp_mb__after_atomic(); |
595 | wake_up_bit(&adap->state_bits, ADAP_SLEEP); | 595 | wake_up_bit(&adap->state_bits, ADAP_SLEEP); |
596 | } | 596 | } |
597 | 597 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 9261d5313b5b..dd57c7c5a3da 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -2781,7 +2781,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
2781 | 2781 | ||
2782 | case LOAD_OPEN: | 2782 | case LOAD_OPEN: |
2783 | netif_tx_start_all_queues(bp->dev); | 2783 | netif_tx_start_all_queues(bp->dev); |
2784 | smp_mb__after_clear_bit(); | 2784 | smp_mb__after_atomic(); |
2785 | break; | 2785 | break; |
2786 | 2786 | ||
2787 | case LOAD_DIAG: | 2787 | case LOAD_DIAG: |
@@ -4939,9 +4939,9 @@ void bnx2x_update_coalesce_sb_index(struct bnx2x *bp, u8 fw_sb_id, | |||
4939 | void bnx2x_schedule_sp_rtnl(struct bnx2x *bp, enum sp_rtnl_flag flag, | 4939 | void bnx2x_schedule_sp_rtnl(struct bnx2x *bp, enum sp_rtnl_flag flag, |
4940 | u32 verbose) | 4940 | u32 verbose) |
4941 | { | 4941 | { |
4942 | smp_mb__before_clear_bit(); | 4942 | smp_mb__before_atomic(); |
4943 | set_bit(flag, &bp->sp_rtnl_state); | 4943 | set_bit(flag, &bp->sp_rtnl_state); |
4944 | smp_mb__after_clear_bit(); | 4944 | smp_mb__after_atomic(); |
4945 | DP((BNX2X_MSG_SP | verbose), "Scheduling sp_rtnl task [Flag: %d]\n", | 4945 | DP((BNX2X_MSG_SP | verbose), "Scheduling sp_rtnl task [Flag: %d]\n", |
4946 | flag); | 4946 | flag); |
4947 | schedule_delayed_work(&bp->sp_rtnl_task, 0); | 4947 | schedule_delayed_work(&bp->sp_rtnl_task, 0); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 3b0d43154e67..3a8e51ed5bec 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -1858,10 +1858,10 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe) | |||
1858 | return; | 1858 | return; |
1859 | #endif | 1859 | #endif |
1860 | 1860 | ||
1861 | smp_mb__before_atomic_inc(); | 1861 | smp_mb__before_atomic(); |
1862 | atomic_inc(&bp->cq_spq_left); | 1862 | atomic_inc(&bp->cq_spq_left); |
1863 | /* push the change in bp->spq_left and towards the memory */ | 1863 | /* push the change in bp->spq_left and towards the memory */ |
1864 | smp_mb__after_atomic_inc(); | 1864 | smp_mb__after_atomic(); |
1865 | 1865 | ||
1866 | DP(BNX2X_MSG_SP, "bp->cq_spq_left %x\n", atomic_read(&bp->cq_spq_left)); | 1866 | DP(BNX2X_MSG_SP, "bp->cq_spq_left %x\n", atomic_read(&bp->cq_spq_left)); |
1867 | 1867 | ||
@@ -1876,11 +1876,11 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe) | |||
1876 | * sp_state is cleared, and this order prevents | 1876 | * sp_state is cleared, and this order prevents |
1877 | * races | 1877 | * races |
1878 | */ | 1878 | */ |
1879 | smp_mb__before_clear_bit(); | 1879 | smp_mb__before_atomic(); |
1880 | set_bit(BNX2X_AFEX_PENDING_VIFSET_MCP_ACK, &bp->sp_state); | 1880 | set_bit(BNX2X_AFEX_PENDING_VIFSET_MCP_ACK, &bp->sp_state); |
1881 | wmb(); | 1881 | wmb(); |
1882 | clear_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state); | 1882 | clear_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state); |
1883 | smp_mb__after_clear_bit(); | 1883 | smp_mb__after_atomic(); |
1884 | 1884 | ||
1885 | /* schedule the sp task as mcp ack is required */ | 1885 | /* schedule the sp task as mcp ack is required */ |
1886 | bnx2x_schedule_sp_task(bp); | 1886 | bnx2x_schedule_sp_task(bp); |
@@ -5272,9 +5272,9 @@ static void bnx2x_after_function_update(struct bnx2x *bp) | |||
5272 | __clear_bit(RAMROD_COMP_WAIT, &queue_params.ramrod_flags); | 5272 | __clear_bit(RAMROD_COMP_WAIT, &queue_params.ramrod_flags); |
5273 | 5273 | ||
5274 | /* mark latest Q bit */ | 5274 | /* mark latest Q bit */ |
5275 | smp_mb__before_clear_bit(); | 5275 | smp_mb__before_atomic(); |
5276 | set_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state); | 5276 | set_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state); |
5277 | smp_mb__after_clear_bit(); | 5277 | smp_mb__after_atomic(); |
5278 | 5278 | ||
5279 | /* send Q update ramrod for FCoE Q */ | 5279 | /* send Q update ramrod for FCoE Q */ |
5280 | rc = bnx2x_queue_state_change(bp, &queue_params); | 5280 | rc = bnx2x_queue_state_change(bp, &queue_params); |
@@ -5500,7 +5500,7 @@ next_spqe: | |||
5500 | spqe_cnt++; | 5500 | spqe_cnt++; |
5501 | } /* for */ | 5501 | } /* for */ |
5502 | 5502 | ||
5503 | smp_mb__before_atomic_inc(); | 5503 | smp_mb__before_atomic(); |
5504 | atomic_add(spqe_cnt, &bp->eq_spq_left); | 5504 | atomic_add(spqe_cnt, &bp->eq_spq_left); |
5505 | 5505 | ||
5506 | bp->eq_cons = sw_cons; | 5506 | bp->eq_cons = sw_cons; |
@@ -13875,9 +13875,9 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl) | |||
13875 | case DRV_CTL_RET_L2_SPQ_CREDIT_CMD: { | 13875 | case DRV_CTL_RET_L2_SPQ_CREDIT_CMD: { |
13876 | int count = ctl->data.credit.credit_count; | 13876 | int count = ctl->data.credit.credit_count; |
13877 | 13877 | ||
13878 | smp_mb__before_atomic_inc(); | 13878 | smp_mb__before_atomic(); |
13879 | atomic_add(count, &bp->cq_spq_left); | 13879 | atomic_add(count, &bp->cq_spq_left); |
13880 | smp_mb__after_atomic_inc(); | 13880 | smp_mb__after_atomic(); |
13881 | break; | 13881 | break; |
13882 | } | 13882 | } |
13883 | case DRV_CTL_ULP_REGISTER_CMD: { | 13883 | case DRV_CTL_ULP_REGISTER_CMD: { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index 31297266b743..d725317c4277 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | |||
@@ -258,16 +258,16 @@ static bool bnx2x_raw_check_pending(struct bnx2x_raw_obj *o) | |||
258 | 258 | ||
259 | static void bnx2x_raw_clear_pending(struct bnx2x_raw_obj *o) | 259 | static void bnx2x_raw_clear_pending(struct bnx2x_raw_obj *o) |
260 | { | 260 | { |
261 | smp_mb__before_clear_bit(); | 261 | smp_mb__before_atomic(); |
262 | clear_bit(o->state, o->pstate); | 262 | clear_bit(o->state, o->pstate); |
263 | smp_mb__after_clear_bit(); | 263 | smp_mb__after_atomic(); |
264 | } | 264 | } |
265 | 265 | ||
266 | static void bnx2x_raw_set_pending(struct bnx2x_raw_obj *o) | 266 | static void bnx2x_raw_set_pending(struct bnx2x_raw_obj *o) |
267 | { | 267 | { |
268 | smp_mb__before_clear_bit(); | 268 | smp_mb__before_atomic(); |
269 | set_bit(o->state, o->pstate); | 269 | set_bit(o->state, o->pstate); |
270 | smp_mb__after_clear_bit(); | 270 | smp_mb__after_atomic(); |
271 | } | 271 | } |
272 | 272 | ||
273 | /** | 273 | /** |
@@ -2131,7 +2131,7 @@ static int bnx2x_set_rx_mode_e1x(struct bnx2x *bp, | |||
2131 | 2131 | ||
2132 | /* The operation is completed */ | 2132 | /* The operation is completed */ |
2133 | clear_bit(p->state, p->pstate); | 2133 | clear_bit(p->state, p->pstate); |
2134 | smp_mb__after_clear_bit(); | 2134 | smp_mb__after_atomic(); |
2135 | 2135 | ||
2136 | return 0; | 2136 | return 0; |
2137 | } | 2137 | } |
@@ -3576,16 +3576,16 @@ error_exit1: | |||
3576 | 3576 | ||
3577 | static void bnx2x_mcast_clear_sched(struct bnx2x_mcast_obj *o) | 3577 | static void bnx2x_mcast_clear_sched(struct bnx2x_mcast_obj *o) |
3578 | { | 3578 | { |
3579 | smp_mb__before_clear_bit(); | 3579 | smp_mb__before_atomic(); |
3580 | clear_bit(o->sched_state, o->raw.pstate); | 3580 | clear_bit(o->sched_state, o->raw.pstate); |
3581 | smp_mb__after_clear_bit(); | 3581 | smp_mb__after_atomic(); |
3582 | } | 3582 | } |
3583 | 3583 | ||
3584 | static void bnx2x_mcast_set_sched(struct bnx2x_mcast_obj *o) | 3584 | static void bnx2x_mcast_set_sched(struct bnx2x_mcast_obj *o) |
3585 | { | 3585 | { |
3586 | smp_mb__before_clear_bit(); | 3586 | smp_mb__before_atomic(); |
3587 | set_bit(o->sched_state, o->raw.pstate); | 3587 | set_bit(o->sched_state, o->raw.pstate); |
3588 | smp_mb__after_clear_bit(); | 3588 | smp_mb__after_atomic(); |
3589 | } | 3589 | } |
3590 | 3590 | ||
3591 | static bool bnx2x_mcast_check_sched(struct bnx2x_mcast_obj *o) | 3591 | static bool bnx2x_mcast_check_sched(struct bnx2x_mcast_obj *o) |
@@ -4200,7 +4200,7 @@ int bnx2x_queue_state_change(struct bnx2x *bp, | |||
4200 | if (rc) { | 4200 | if (rc) { |
4201 | o->next_state = BNX2X_Q_STATE_MAX; | 4201 | o->next_state = BNX2X_Q_STATE_MAX; |
4202 | clear_bit(pending_bit, pending); | 4202 | clear_bit(pending_bit, pending); |
4203 | smp_mb__after_clear_bit(); | 4203 | smp_mb__after_atomic(); |
4204 | return rc; | 4204 | return rc; |
4205 | } | 4205 | } |
4206 | 4206 | ||
@@ -4288,7 +4288,7 @@ static int bnx2x_queue_comp_cmd(struct bnx2x *bp, | |||
4288 | wmb(); | 4288 | wmb(); |
4289 | 4289 | ||
4290 | clear_bit(cmd, &o->pending); | 4290 | clear_bit(cmd, &o->pending); |
4291 | smp_mb__after_clear_bit(); | 4291 | smp_mb__after_atomic(); |
4292 | 4292 | ||
4293 | return 0; | 4293 | return 0; |
4294 | } | 4294 | } |
@@ -5279,7 +5279,7 @@ static inline int bnx2x_func_state_change_comp(struct bnx2x *bp, | |||
5279 | wmb(); | 5279 | wmb(); |
5280 | 5280 | ||
5281 | clear_bit(cmd, &o->pending); | 5281 | clear_bit(cmd, &o->pending); |
5282 | smp_mb__after_clear_bit(); | 5282 | smp_mb__after_atomic(); |
5283 | 5283 | ||
5284 | return 0; | 5284 | return 0; |
5285 | } | 5285 | } |
@@ -5926,7 +5926,7 @@ int bnx2x_func_state_change(struct bnx2x *bp, | |||
5926 | if (rc) { | 5926 | if (rc) { |
5927 | o->next_state = BNX2X_F_STATE_MAX; | 5927 | o->next_state = BNX2X_F_STATE_MAX; |
5928 | clear_bit(cmd, pending); | 5928 | clear_bit(cmd, pending); |
5929 | smp_mb__after_clear_bit(); | 5929 | smp_mb__after_atomic(); |
5930 | return rc; | 5930 | return rc; |
5931 | } | 5931 | } |
5932 | 5932 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index b8078d50261b..faf01488d26e 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -1650,9 +1650,9 @@ static | |||
1650 | void bnx2x_vf_handle_filters_eqe(struct bnx2x *bp, | 1650 | void bnx2x_vf_handle_filters_eqe(struct bnx2x *bp, |
1651 | struct bnx2x_virtf *vf) | 1651 | struct bnx2x_virtf *vf) |
1652 | { | 1652 | { |
1653 | smp_mb__before_clear_bit(); | 1653 | smp_mb__before_atomic(); |
1654 | clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); | 1654 | clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); |
1655 | smp_mb__after_clear_bit(); | 1655 | smp_mb__after_atomic(); |
1656 | } | 1656 | } |
1657 | 1657 | ||
1658 | static void bnx2x_vf_handle_rss_update_eqe(struct bnx2x *bp, | 1658 | static void bnx2x_vf_handle_rss_update_eqe(struct bnx2x *bp, |
@@ -2990,9 +2990,9 @@ void bnx2x_iov_task(struct work_struct *work) | |||
2990 | 2990 | ||
2991 | void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag) | 2991 | void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag) |
2992 | { | 2992 | { |
2993 | smp_mb__before_clear_bit(); | 2993 | smp_mb__before_atomic(); |
2994 | set_bit(flag, &bp->iov_task_state); | 2994 | set_bit(flag, &bp->iov_task_state); |
2995 | smp_mb__after_clear_bit(); | 2995 | smp_mb__after_atomic(); |
2996 | DP(BNX2X_MSG_IOV, "Scheduling iov task [Flag: %d]\n", flag); | 2996 | DP(BNX2X_MSG_IOV, "Scheduling iov task [Flag: %d]\n", flag); |
2997 | queue_delayed_work(bnx2x_iov_wq, &bp->iov_task, 0); | 2997 | queue_delayed_work(bnx2x_iov_wq, &bp->iov_task, 0); |
2998 | } | 2998 | } |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 09f3fefcbf9c..4dd48d2fa804 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -436,7 +436,7 @@ static int cnic_offld_prep(struct cnic_sock *csk) | |||
436 | static int cnic_close_prep(struct cnic_sock *csk) | 436 | static int cnic_close_prep(struct cnic_sock *csk) |
437 | { | 437 | { |
438 | clear_bit(SK_F_CONNECT_START, &csk->flags); | 438 | clear_bit(SK_F_CONNECT_START, &csk->flags); |
439 | smp_mb__after_clear_bit(); | 439 | smp_mb__after_atomic(); |
440 | 440 | ||
441 | if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) { | 441 | if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) { |
442 | while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags)) | 442 | while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags)) |
@@ -450,7 +450,7 @@ static int cnic_close_prep(struct cnic_sock *csk) | |||
450 | static int cnic_abort_prep(struct cnic_sock *csk) | 450 | static int cnic_abort_prep(struct cnic_sock *csk) |
451 | { | 451 | { |
452 | clear_bit(SK_F_CONNECT_START, &csk->flags); | 452 | clear_bit(SK_F_CONNECT_START, &csk->flags); |
453 | smp_mb__after_clear_bit(); | 453 | smp_mb__after_atomic(); |
454 | 454 | ||
455 | while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags)) | 455 | while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags)) |
456 | msleep(1); | 456 | msleep(1); |
@@ -3646,7 +3646,7 @@ static int cnic_cm_destroy(struct cnic_sock *csk) | |||
3646 | 3646 | ||
3647 | csk_hold(csk); | 3647 | csk_hold(csk); |
3648 | clear_bit(SK_F_INUSE, &csk->flags); | 3648 | clear_bit(SK_F_INUSE, &csk->flags); |
3649 | smp_mb__after_clear_bit(); | 3649 | smp_mb__after_atomic(); |
3650 | while (atomic_read(&csk->ref_count) != 1) | 3650 | while (atomic_read(&csk->ref_count) != 1) |
3651 | msleep(1); | 3651 | msleep(1); |
3652 | cnic_cm_cleanup(csk); | 3652 | cnic_cm_cleanup(csk); |
@@ -4026,7 +4026,7 @@ static void cnic_cm_process_kcqe(struct cnic_dev *dev, struct kcqe *kcqe) | |||
4026 | L4_KCQE_COMPLETION_STATUS_PARITY_ERROR) | 4026 | L4_KCQE_COMPLETION_STATUS_PARITY_ERROR) |
4027 | set_bit(SK_F_HW_ERR, &csk->flags); | 4027 | set_bit(SK_F_HW_ERR, &csk->flags); |
4028 | 4028 | ||
4029 | smp_mb__before_clear_bit(); | 4029 | smp_mb__before_atomic(); |
4030 | clear_bit(SK_F_OFFLD_SCHED, &csk->flags); | 4030 | clear_bit(SK_F_OFFLD_SCHED, &csk->flags); |
4031 | cnic_cm_upcall(cp, csk, opcode); | 4031 | cnic_cm_upcall(cp, csk, opcode); |
4032 | break; | 4032 | break; |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 675550fe8ee9..3a77f9ead004 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -249,7 +249,7 @@ bnad_tx_complete(struct bnad *bnad, struct bna_tcb *tcb) | |||
249 | if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) | 249 | if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) |
250 | bna_ib_ack(tcb->i_dbell, sent); | 250 | bna_ib_ack(tcb->i_dbell, sent); |
251 | 251 | ||
252 | smp_mb__before_clear_bit(); | 252 | smp_mb__before_atomic(); |
253 | clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); | 253 | clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); |
254 | 254 | ||
255 | return sent; | 255 | return sent; |
@@ -1126,7 +1126,7 @@ bnad_tx_cleanup(struct delayed_work *work) | |||
1126 | 1126 | ||
1127 | bnad_txq_cleanup(bnad, tcb); | 1127 | bnad_txq_cleanup(bnad, tcb); |
1128 | 1128 | ||
1129 | smp_mb__before_clear_bit(); | 1129 | smp_mb__before_atomic(); |
1130 | clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); | 1130 | clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); |
1131 | } | 1131 | } |
1132 | 1132 | ||
@@ -2992,7 +2992,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
2992 | sent = bnad_txcmpl_process(bnad, tcb); | 2992 | sent = bnad_txcmpl_process(bnad, tcb); |
2993 | if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) | 2993 | if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) |
2994 | bna_ib_ack(tcb->i_dbell, sent); | 2994 | bna_ib_ack(tcb->i_dbell, sent); |
2995 | smp_mb__before_clear_bit(); | 2995 | smp_mb__before_atomic(); |
2996 | clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); | 2996 | clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); |
2997 | } else { | 2997 | } else { |
2998 | netif_stop_queue(netdev); | 2998 | netif_stop_queue(netdev); |
diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index 0fe7ff750d77..05613a85ce61 100644 --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c | |||
@@ -281,7 +281,7 @@ static int cxgb_close(struct net_device *dev) | |||
281 | if (adapter->params.stats_update_period && | 281 | if (adapter->params.stats_update_period && |
282 | !(adapter->open_device_map & PORT_MASK)) { | 282 | !(adapter->open_device_map & PORT_MASK)) { |
283 | /* Stop statistics accumulation. */ | 283 | /* Stop statistics accumulation. */ |
284 | smp_mb__after_clear_bit(); | 284 | smp_mb__after_atomic(); |
285 | spin_lock(&adapter->work_lock); /* sync with update task */ | 285 | spin_lock(&adapter->work_lock); /* sync with update task */ |
286 | spin_unlock(&adapter->work_lock); | 286 | spin_unlock(&adapter->work_lock); |
287 | cancel_mac_stats_update(adapter); | 287 | cancel_mac_stats_update(adapter); |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c index 8b069f96e920..3dfcf600fcc6 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c | |||
@@ -1379,7 +1379,7 @@ static inline int check_desc_avail(struct adapter *adap, struct sge_txq *q, | |||
1379 | struct sge_qset *qs = txq_to_qset(q, qid); | 1379 | struct sge_qset *qs = txq_to_qset(q, qid); |
1380 | 1380 | ||
1381 | set_bit(qid, &qs->txq_stopped); | 1381 | set_bit(qid, &qs->txq_stopped); |
1382 | smp_mb__after_clear_bit(); | 1382 | smp_mb__after_atomic(); |
1383 | 1383 | ||
1384 | if (should_restart_tx(q) && | 1384 | if (should_restart_tx(q) && |
1385 | test_and_clear_bit(qid, &qs->txq_stopped)) | 1385 | test_and_clear_bit(qid, &qs->txq_stopped)) |
@@ -1492,7 +1492,7 @@ static void restart_ctrlq(unsigned long data) | |||
1492 | 1492 | ||
1493 | if (!skb_queue_empty(&q->sendq)) { | 1493 | if (!skb_queue_empty(&q->sendq)) { |
1494 | set_bit(TXQ_CTRL, &qs->txq_stopped); | 1494 | set_bit(TXQ_CTRL, &qs->txq_stopped); |
1495 | smp_mb__after_clear_bit(); | 1495 | smp_mb__after_atomic(); |
1496 | 1496 | ||
1497 | if (should_restart_tx(q) && | 1497 | if (should_restart_tx(q) && |
1498 | test_and_clear_bit(TXQ_CTRL, &qs->txq_stopped)) | 1498 | test_and_clear_bit(TXQ_CTRL, &qs->txq_stopped)) |
@@ -1697,7 +1697,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
1697 | 1697 | ||
1698 | if (unlikely(q->size - q->in_use < ndesc)) { | 1698 | if (unlikely(q->size - q->in_use < ndesc)) { |
1699 | set_bit(TXQ_OFLD, &qs->txq_stopped); | 1699 | set_bit(TXQ_OFLD, &qs->txq_stopped); |
1700 | smp_mb__after_clear_bit(); | 1700 | smp_mb__after_atomic(); |
1701 | 1701 | ||
1702 | if (should_restart_tx(q) && | 1702 | if (should_restart_tx(q) && |
1703 | test_and_clear_bit(TXQ_OFLD, &qs->txq_stopped)) | 1703 | test_and_clear_bit(TXQ_OFLD, &qs->txq_stopped)) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index ca95cf2954eb..e249528c8e60 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -2031,7 +2031,7 @@ static void sge_rx_timer_cb(unsigned long data) | |||
2031 | struct sge_fl *fl = s->egr_map[id]; | 2031 | struct sge_fl *fl = s->egr_map[id]; |
2032 | 2032 | ||
2033 | clear_bit(id, s->starving_fl); | 2033 | clear_bit(id, s->starving_fl); |
2034 | smp_mb__after_clear_bit(); | 2034 | smp_mb__after_atomic(); |
2035 | 2035 | ||
2036 | if (fl_starving(fl)) { | 2036 | if (fl_starving(fl)) { |
2037 | rxq = container_of(fl, struct sge_eth_rxq, fl); | 2037 | rxq = container_of(fl, struct sge_eth_rxq, fl); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 9cfa4b4bb089..9d88c1d50b49 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -1951,7 +1951,7 @@ static void sge_rx_timer_cb(unsigned long data) | |||
1951 | struct sge_fl *fl = s->egr_map[id]; | 1951 | struct sge_fl *fl = s->egr_map[id]; |
1952 | 1952 | ||
1953 | clear_bit(id, s->starving_fl); | 1953 | clear_bit(id, s->starving_fl); |
1954 | smp_mb__after_clear_bit(); | 1954 | smp_mb__after_atomic(); |
1955 | 1955 | ||
1956 | /* | 1956 | /* |
1957 | * Since we are accessing fl without a lock there's a | 1957 | * Since we are accessing fl without a lock there's a |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index e2d42475b006..ee6ddbd4f252 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -1798,9 +1798,9 @@ void stop_gfar(struct net_device *dev) | |||
1798 | 1798 | ||
1799 | netif_tx_stop_all_queues(dev); | 1799 | netif_tx_stop_all_queues(dev); |
1800 | 1800 | ||
1801 | smp_mb__before_clear_bit(); | 1801 | smp_mb__before_atomic(); |
1802 | set_bit(GFAR_DOWN, &priv->state); | 1802 | set_bit(GFAR_DOWN, &priv->state); |
1803 | smp_mb__after_clear_bit(); | 1803 | smp_mb__after_atomic(); |
1804 | 1804 | ||
1805 | disable_napi(priv); | 1805 | disable_napi(priv); |
1806 | 1806 | ||
@@ -2043,9 +2043,9 @@ int startup_gfar(struct net_device *ndev) | |||
2043 | 2043 | ||
2044 | gfar_init_tx_rx_base(priv); | 2044 | gfar_init_tx_rx_base(priv); |
2045 | 2045 | ||
2046 | smp_mb__before_clear_bit(); | 2046 | smp_mb__before_atomic(); |
2047 | clear_bit(GFAR_DOWN, &priv->state); | 2047 | clear_bit(GFAR_DOWN, &priv->state); |
2048 | smp_mb__after_clear_bit(); | 2048 | smp_mb__after_atomic(); |
2049 | 2049 | ||
2050 | /* Start Rx/Tx DMA and enable the interrupts */ | 2050 | /* Start Rx/Tx DMA and enable the interrupts */ |
2051 | gfar_start(priv); | 2051 | gfar_start(priv); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index cf0761f08911..2e72449f1265 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -4676,7 +4676,7 @@ static void i40e_service_event_complete(struct i40e_pf *pf) | |||
4676 | BUG_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state)); | 4676 | BUG_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state)); |
4677 | 4677 | ||
4678 | /* flush memory to make sure state is correct before next watchog */ | 4678 | /* flush memory to make sure state is correct before next watchog */ |
4679 | smp_mb__before_clear_bit(); | 4679 | smp_mb__before_atomic(); |
4680 | clear_bit(__I40E_SERVICE_SCHED, &pf->state); | 4680 | clear_bit(__I40E_SERVICE_SCHED, &pf->state); |
4681 | } | 4681 | } |
4682 | 4682 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index d62e7a25cf97..c047c3ef8d71 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -376,7 +376,7 @@ static void ixgbe_service_event_complete(struct ixgbe_adapter *adapter) | |||
376 | BUG_ON(!test_bit(__IXGBE_SERVICE_SCHED, &adapter->state)); | 376 | BUG_ON(!test_bit(__IXGBE_SERVICE_SCHED, &adapter->state)); |
377 | 377 | ||
378 | /* flush memory to make sure state is correct before next watchdog */ | 378 | /* flush memory to make sure state is correct before next watchdog */ |
379 | smp_mb__before_clear_bit(); | 379 | smp_mb__before_atomic(); |
380 | clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); | 380 | clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); |
381 | } | 381 | } |
382 | 382 | ||
@@ -4672,7 +4672,7 @@ static void ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
4672 | if (hw->mac.ops.enable_tx_laser) | 4672 | if (hw->mac.ops.enable_tx_laser) |
4673 | hw->mac.ops.enable_tx_laser(hw); | 4673 | hw->mac.ops.enable_tx_laser(hw); |
4674 | 4674 | ||
4675 | smp_mb__before_clear_bit(); | 4675 | smp_mb__before_atomic(); |
4676 | clear_bit(__IXGBE_DOWN, &adapter->state); | 4676 | clear_bit(__IXGBE_DOWN, &adapter->state); |
4677 | ixgbe_napi_enable_all(adapter); | 4677 | ixgbe_napi_enable_all(adapter); |
4678 | 4678 | ||
@@ -5568,7 +5568,7 @@ static int ixgbe_resume(struct pci_dev *pdev) | |||
5568 | e_dev_err("Cannot enable PCI device from suspend\n"); | 5568 | e_dev_err("Cannot enable PCI device from suspend\n"); |
5569 | return err; | 5569 | return err; |
5570 | } | 5570 | } |
5571 | smp_mb__before_clear_bit(); | 5571 | smp_mb__before_atomic(); |
5572 | clear_bit(__IXGBE_DISABLED, &adapter->state); | 5572 | clear_bit(__IXGBE_DISABLED, &adapter->state); |
5573 | pci_set_master(pdev); | 5573 | pci_set_master(pdev); |
5574 | 5574 | ||
@@ -8542,7 +8542,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev) | |||
8542 | e_err(probe, "Cannot re-enable PCI device after reset.\n"); | 8542 | e_err(probe, "Cannot re-enable PCI device after reset.\n"); |
8543 | result = PCI_ERS_RESULT_DISCONNECT; | 8543 | result = PCI_ERS_RESULT_DISCONNECT; |
8544 | } else { | 8544 | } else { |
8545 | smp_mb__before_clear_bit(); | 8545 | smp_mb__before_atomic(); |
8546 | clear_bit(__IXGBE_DISABLED, &adapter->state); | 8546 | clear_bit(__IXGBE_DISABLED, &adapter->state); |
8547 | adapter->hw.hw_addr = adapter->io_addr; | 8547 | adapter->hw.hw_addr = adapter->io_addr; |
8548 | pci_set_master(pdev); | 8548 | pci_set_master(pdev); |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index d0799e8e31e4..de2793b06305 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -1668,7 +1668,7 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) | |||
1668 | 1668 | ||
1669 | spin_unlock_bh(&adapter->mbx_lock); | 1669 | spin_unlock_bh(&adapter->mbx_lock); |
1670 | 1670 | ||
1671 | smp_mb__before_clear_bit(); | 1671 | smp_mb__before_atomic(); |
1672 | clear_bit(__IXGBEVF_DOWN, &adapter->state); | 1672 | clear_bit(__IXGBEVF_DOWN, &adapter->state); |
1673 | ixgbevf_napi_enable_all(adapter); | 1673 | ixgbevf_napi_enable_all(adapter); |
1674 | 1674 | ||
@@ -3354,7 +3354,7 @@ static int ixgbevf_resume(struct pci_dev *pdev) | |||
3354 | dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n"); | 3354 | dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n"); |
3355 | return err; | 3355 | return err; |
3356 | } | 3356 | } |
3357 | smp_mb__before_clear_bit(); | 3357 | smp_mb__before_atomic(); |
3358 | clear_bit(__IXGBEVF_DISABLED, &adapter->state); | 3358 | clear_bit(__IXGBEVF_DISABLED, &adapter->state); |
3359 | pci_set_master(pdev); | 3359 | pci_set_master(pdev); |
3360 | 3360 | ||
@@ -3712,7 +3712,7 @@ static pci_ers_result_t ixgbevf_io_slot_reset(struct pci_dev *pdev) | |||
3712 | return PCI_ERS_RESULT_DISCONNECT; | 3712 | return PCI_ERS_RESULT_DISCONNECT; |
3713 | } | 3713 | } |
3714 | 3714 | ||
3715 | smp_mb__before_clear_bit(); | 3715 | smp_mb__before_atomic(); |
3716 | clear_bit(__IXGBEVF_DISABLED, &adapter->state); | 3716 | clear_bit(__IXGBEVF_DISABLED, &adapter->state); |
3717 | pci_set_master(pdev); | 3717 | pci_set_master(pdev); |
3718 | 3718 | ||
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index ed88d3913483..e71eae353368 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -543,7 +543,7 @@ static int wlcore_irq_locked(struct wl1271 *wl) | |||
543 | * wl1271_ps_elp_wakeup cannot be called concurrently. | 543 | * wl1271_ps_elp_wakeup cannot be called concurrently. |
544 | */ | 544 | */ |
545 | clear_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); | 545 | clear_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); |
546 | smp_mb__after_clear_bit(); | 546 | smp_mb__after_atomic(); |
547 | 547 | ||
548 | ret = wlcore_fw_status(wl, wl->fw_status); | 548 | ret = wlcore_fw_status(wl, wl->fw_status); |
549 | if (ret < 0) | 549 | if (ret < 0) |
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 179b8edc2262..53df39a22c8a 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -662,9 +662,9 @@ static void pcifront_do_aer(struct work_struct *data) | |||
662 | notify_remote_via_evtchn(pdev->evtchn); | 662 | notify_remote_via_evtchn(pdev->evtchn); |
663 | 663 | ||
664 | /*in case of we lost an aer request in four lines time_window*/ | 664 | /*in case of we lost an aer request in four lines time_window*/ |
665 | smp_mb__before_clear_bit(); | 665 | smp_mb__before_atomic(); |
666 | clear_bit(_PDEVB_op_active, &pdev->flags); | 666 | clear_bit(_PDEVB_op_active, &pdev->flags); |
667 | smp_mb__after_clear_bit(); | 667 | smp_mb__after_atomic(); |
668 | 668 | ||
669 | schedule_pcifront_aer_op(pdev); | 669 | schedule_pcifront_aer_op(pdev); |
670 | 670 | ||
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index 96a26f454673..cc51f38b116d 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -1541,7 +1541,7 @@ void isci_remote_device_release(struct kref *kref) | |||
1541 | clear_bit(IDEV_STOP_PENDING, &idev->flags); | 1541 | clear_bit(IDEV_STOP_PENDING, &idev->flags); |
1542 | clear_bit(IDEV_IO_READY, &idev->flags); | 1542 | clear_bit(IDEV_IO_READY, &idev->flags); |
1543 | clear_bit(IDEV_GONE, &idev->flags); | 1543 | clear_bit(IDEV_GONE, &idev->flags); |
1544 | smp_mb__before_clear_bit(); | 1544 | smp_mb__before_atomic(); |
1545 | clear_bit(IDEV_ALLOCATED, &idev->flags); | 1545 | clear_bit(IDEV_ALLOCATED, &idev->flags); |
1546 | wake_up(&ihost->eventq); | 1546 | wake_up(&ihost->eventq); |
1547 | } | 1547 | } |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index c886ad1c39fb..73ab75ddaf42 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -951,7 +951,7 @@ static int tcm_loop_port_link( | |||
951 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; | 951 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
952 | 952 | ||
953 | atomic_inc(&tl_tpg->tl_tpg_port_count); | 953 | atomic_inc(&tl_tpg->tl_tpg_port_count); |
954 | smp_mb__after_atomic_inc(); | 954 | smp_mb__after_atomic(); |
955 | /* | 955 | /* |
956 | * Add Linux/SCSI struct scsi_device by HCTL | 956 | * Add Linux/SCSI struct scsi_device by HCTL |
957 | */ | 957 | */ |
@@ -986,7 +986,7 @@ static void tcm_loop_port_unlink( | |||
986 | scsi_device_put(sd); | 986 | scsi_device_put(sd); |
987 | 987 | ||
988 | atomic_dec(&tl_tpg->tl_tpg_port_count); | 988 | atomic_dec(&tl_tpg->tl_tpg_port_count); |
989 | smp_mb__after_atomic_dec(); | 989 | smp_mb__after_atomic(); |
990 | 990 | ||
991 | pr_debug("TCM_Loop_ConfigFS: Port Unlink Successful\n"); | 991 | pr_debug("TCM_Loop_ConfigFS: Port Unlink Successful\n"); |
992 | } | 992 | } |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index fcbe6125b73e..0b79b852f4b2 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -393,7 +393,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd) | |||
393 | continue; | 393 | continue; |
394 | 394 | ||
395 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 395 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); |
396 | smp_mb__after_atomic_inc(); | 396 | smp_mb__after_atomic(); |
397 | 397 | ||
398 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 398 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
399 | 399 | ||
@@ -404,7 +404,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd) | |||
404 | 404 | ||
405 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 405 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
406 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 406 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); |
407 | smp_mb__after_atomic_dec(); | 407 | smp_mb__after_atomic(); |
408 | break; | 408 | break; |
409 | } | 409 | } |
410 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 410 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
@@ -990,7 +990,7 @@ static void core_alua_do_transition_tg_pt_work(struct work_struct *work) | |||
990 | * TARGET PORT GROUPS command | 990 | * TARGET PORT GROUPS command |
991 | */ | 991 | */ |
992 | atomic_inc(&mem->tg_pt_gp_mem_ref_cnt); | 992 | atomic_inc(&mem->tg_pt_gp_mem_ref_cnt); |
993 | smp_mb__after_atomic_inc(); | 993 | smp_mb__after_atomic(); |
994 | spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 994 | spin_unlock(&tg_pt_gp->tg_pt_gp_lock); |
995 | 995 | ||
996 | spin_lock_bh(&port->sep_alua_lock); | 996 | spin_lock_bh(&port->sep_alua_lock); |
@@ -1020,7 +1020,7 @@ static void core_alua_do_transition_tg_pt_work(struct work_struct *work) | |||
1020 | 1020 | ||
1021 | spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 1021 | spin_lock(&tg_pt_gp->tg_pt_gp_lock); |
1022 | atomic_dec(&mem->tg_pt_gp_mem_ref_cnt); | 1022 | atomic_dec(&mem->tg_pt_gp_mem_ref_cnt); |
1023 | smp_mb__after_atomic_dec(); | 1023 | smp_mb__after_atomic(); |
1024 | } | 1024 | } |
1025 | spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 1025 | spin_unlock(&tg_pt_gp->tg_pt_gp_lock); |
1026 | /* | 1026 | /* |
@@ -1054,7 +1054,7 @@ static void core_alua_do_transition_tg_pt_work(struct work_struct *work) | |||
1054 | core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_pending_state)); | 1054 | core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_pending_state)); |
1055 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 1055 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
1056 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 1056 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); |
1057 | smp_mb__after_atomic_dec(); | 1057 | smp_mb__after_atomic(); |
1058 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 1058 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
1059 | 1059 | ||
1060 | if (tg_pt_gp->tg_pt_gp_transition_complete) | 1060 | if (tg_pt_gp->tg_pt_gp_transition_complete) |
@@ -1116,7 +1116,7 @@ static int core_alua_do_transition_tg_pt( | |||
1116 | */ | 1116 | */ |
1117 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 1117 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
1118 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 1118 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); |
1119 | smp_mb__after_atomic_inc(); | 1119 | smp_mb__after_atomic(); |
1120 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 1120 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
1121 | 1121 | ||
1122 | if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) { | 1122 | if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) { |
@@ -1159,7 +1159,7 @@ int core_alua_do_port_transition( | |||
1159 | spin_lock(&local_lu_gp_mem->lu_gp_mem_lock); | 1159 | spin_lock(&local_lu_gp_mem->lu_gp_mem_lock); |
1160 | lu_gp = local_lu_gp_mem->lu_gp; | 1160 | lu_gp = local_lu_gp_mem->lu_gp; |
1161 | atomic_inc(&lu_gp->lu_gp_ref_cnt); | 1161 | atomic_inc(&lu_gp->lu_gp_ref_cnt); |
1162 | smp_mb__after_atomic_inc(); | 1162 | smp_mb__after_atomic(); |
1163 | spin_unlock(&local_lu_gp_mem->lu_gp_mem_lock); | 1163 | spin_unlock(&local_lu_gp_mem->lu_gp_mem_lock); |
1164 | /* | 1164 | /* |
1165 | * For storage objects that are members of the 'default_lu_gp', | 1165 | * For storage objects that are members of the 'default_lu_gp', |
@@ -1176,7 +1176,7 @@ int core_alua_do_port_transition( | |||
1176 | rc = core_alua_do_transition_tg_pt(l_tg_pt_gp, | 1176 | rc = core_alua_do_transition_tg_pt(l_tg_pt_gp, |
1177 | new_state, explicit); | 1177 | new_state, explicit); |
1178 | atomic_dec(&lu_gp->lu_gp_ref_cnt); | 1178 | atomic_dec(&lu_gp->lu_gp_ref_cnt); |
1179 | smp_mb__after_atomic_dec(); | 1179 | smp_mb__after_atomic(); |
1180 | return rc; | 1180 | return rc; |
1181 | } | 1181 | } |
1182 | /* | 1182 | /* |
@@ -1190,7 +1190,7 @@ int core_alua_do_port_transition( | |||
1190 | 1190 | ||
1191 | dev = lu_gp_mem->lu_gp_mem_dev; | 1191 | dev = lu_gp_mem->lu_gp_mem_dev; |
1192 | atomic_inc(&lu_gp_mem->lu_gp_mem_ref_cnt); | 1192 | atomic_inc(&lu_gp_mem->lu_gp_mem_ref_cnt); |
1193 | smp_mb__after_atomic_inc(); | 1193 | smp_mb__after_atomic(); |
1194 | spin_unlock(&lu_gp->lu_gp_lock); | 1194 | spin_unlock(&lu_gp->lu_gp_lock); |
1195 | 1195 | ||
1196 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 1196 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
@@ -1219,7 +1219,7 @@ int core_alua_do_port_transition( | |||
1219 | tg_pt_gp->tg_pt_gp_alua_nacl = NULL; | 1219 | tg_pt_gp->tg_pt_gp_alua_nacl = NULL; |
1220 | } | 1220 | } |
1221 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 1221 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); |
1222 | smp_mb__after_atomic_inc(); | 1222 | smp_mb__after_atomic(); |
1223 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 1223 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
1224 | /* | 1224 | /* |
1225 | * core_alua_do_transition_tg_pt() will always return | 1225 | * core_alua_do_transition_tg_pt() will always return |
@@ -1230,7 +1230,7 @@ int core_alua_do_port_transition( | |||
1230 | 1230 | ||
1231 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 1231 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
1232 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 1232 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); |
1233 | smp_mb__after_atomic_dec(); | 1233 | smp_mb__after_atomic(); |
1234 | if (rc) | 1234 | if (rc) |
1235 | break; | 1235 | break; |
1236 | } | 1236 | } |
@@ -1238,7 +1238,7 @@ int core_alua_do_port_transition( | |||
1238 | 1238 | ||
1239 | spin_lock(&lu_gp->lu_gp_lock); | 1239 | spin_lock(&lu_gp->lu_gp_lock); |
1240 | atomic_dec(&lu_gp_mem->lu_gp_mem_ref_cnt); | 1240 | atomic_dec(&lu_gp_mem->lu_gp_mem_ref_cnt); |
1241 | smp_mb__after_atomic_dec(); | 1241 | smp_mb__after_atomic(); |
1242 | } | 1242 | } |
1243 | spin_unlock(&lu_gp->lu_gp_lock); | 1243 | spin_unlock(&lu_gp->lu_gp_lock); |
1244 | 1244 | ||
@@ -1252,7 +1252,7 @@ int core_alua_do_port_transition( | |||
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | atomic_dec(&lu_gp->lu_gp_ref_cnt); | 1254 | atomic_dec(&lu_gp->lu_gp_ref_cnt); |
1255 | smp_mb__after_atomic_dec(); | 1255 | smp_mb__after_atomic(); |
1256 | return rc; | 1256 | return rc; |
1257 | } | 1257 | } |
1258 | 1258 | ||
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 26416c15d65c..11d26fe65bfb 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -225,7 +225,7 @@ struct se_dev_entry *core_get_se_deve_from_rtpi( | |||
225 | continue; | 225 | continue; |
226 | 226 | ||
227 | atomic_inc(&deve->pr_ref_count); | 227 | atomic_inc(&deve->pr_ref_count); |
228 | smp_mb__after_atomic_inc(); | 228 | smp_mb__after_atomic(); |
229 | spin_unlock_irq(&nacl->device_list_lock); | 229 | spin_unlock_irq(&nacl->device_list_lock); |
230 | 230 | ||
231 | return deve; | 231 | return deve; |
@@ -1396,7 +1396,7 @@ int core_dev_add_initiator_node_lun_acl( | |||
1396 | spin_lock(&lun->lun_acl_lock); | 1396 | spin_lock(&lun->lun_acl_lock); |
1397 | list_add_tail(&lacl->lacl_list, &lun->lun_acl_list); | 1397 | list_add_tail(&lacl->lacl_list, &lun->lun_acl_list); |
1398 | atomic_inc(&lun->lun_acl_count); | 1398 | atomic_inc(&lun->lun_acl_count); |
1399 | smp_mb__after_atomic_inc(); | 1399 | smp_mb__after_atomic(); |
1400 | spin_unlock(&lun->lun_acl_lock); | 1400 | spin_unlock(&lun->lun_acl_lock); |
1401 | 1401 | ||
1402 | pr_debug("%s_TPG[%hu]_LUN[%u->%u] - Added %s ACL for " | 1402 | pr_debug("%s_TPG[%hu]_LUN[%u->%u] - Added %s ACL for " |
@@ -1430,7 +1430,7 @@ int core_dev_del_initiator_node_lun_acl( | |||
1430 | spin_lock(&lun->lun_acl_lock); | 1430 | spin_lock(&lun->lun_acl_lock); |
1431 | list_del(&lacl->lacl_list); | 1431 | list_del(&lacl->lacl_list); |
1432 | atomic_dec(&lun->lun_acl_count); | 1432 | atomic_dec(&lun->lun_acl_count); |
1433 | smp_mb__after_atomic_dec(); | 1433 | smp_mb__after_atomic(); |
1434 | spin_unlock(&lun->lun_acl_lock); | 1434 | spin_unlock(&lun->lun_acl_lock); |
1435 | 1435 | ||
1436 | core_disable_device_list_for_node(lun, NULL, lacl->mapped_lun, | 1436 | core_disable_device_list_for_node(lun, NULL, lacl->mapped_lun, |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 9e0232cca92e..7e6b857c6b3f 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -323,7 +323,7 @@ static void iblock_bio_done(struct bio *bio, int err) | |||
323 | * Bump the ib_bio_err_cnt and release bio. | 323 | * Bump the ib_bio_err_cnt and release bio. |
324 | */ | 324 | */ |
325 | atomic_inc(&ibr->ib_bio_err_cnt); | 325 | atomic_inc(&ibr->ib_bio_err_cnt); |
326 | smp_mb__after_atomic_inc(); | 326 | smp_mb__after_atomic(); |
327 | } | 327 | } |
328 | 328 | ||
329 | bio_put(bio); | 329 | bio_put(bio); |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 3013287a2aaa..df357862286e 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -675,7 +675,7 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration( | |||
675 | spin_lock(&dev->se_port_lock); | 675 | spin_lock(&dev->se_port_lock); |
676 | list_for_each_entry_safe(port, port_tmp, &dev->dev_sep_list, sep_list) { | 676 | list_for_each_entry_safe(port, port_tmp, &dev->dev_sep_list, sep_list) { |
677 | atomic_inc(&port->sep_tg_pt_ref_cnt); | 677 | atomic_inc(&port->sep_tg_pt_ref_cnt); |
678 | smp_mb__after_atomic_inc(); | 678 | smp_mb__after_atomic(); |
679 | spin_unlock(&dev->se_port_lock); | 679 | spin_unlock(&dev->se_port_lock); |
680 | 680 | ||
681 | spin_lock_bh(&port->sep_alua_lock); | 681 | spin_lock_bh(&port->sep_alua_lock); |
@@ -710,7 +710,7 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration( | |||
710 | continue; | 710 | continue; |
711 | 711 | ||
712 | atomic_inc(&deve_tmp->pr_ref_count); | 712 | atomic_inc(&deve_tmp->pr_ref_count); |
713 | smp_mb__after_atomic_inc(); | 713 | smp_mb__after_atomic(); |
714 | spin_unlock_bh(&port->sep_alua_lock); | 714 | spin_unlock_bh(&port->sep_alua_lock); |
715 | /* | 715 | /* |
716 | * Grab a configfs group dependency that is released | 716 | * Grab a configfs group dependency that is released |
@@ -723,9 +723,9 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration( | |||
723 | pr_err("core_scsi3_lunacl_depend" | 723 | pr_err("core_scsi3_lunacl_depend" |
724 | "_item() failed\n"); | 724 | "_item() failed\n"); |
725 | atomic_dec(&port->sep_tg_pt_ref_cnt); | 725 | atomic_dec(&port->sep_tg_pt_ref_cnt); |
726 | smp_mb__after_atomic_dec(); | 726 | smp_mb__after_atomic(); |
727 | atomic_dec(&deve_tmp->pr_ref_count); | 727 | atomic_dec(&deve_tmp->pr_ref_count); |
728 | smp_mb__after_atomic_dec(); | 728 | smp_mb__after_atomic(); |
729 | goto out; | 729 | goto out; |
730 | } | 730 | } |
731 | /* | 731 | /* |
@@ -740,9 +740,9 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration( | |||
740 | sa_res_key, all_tg_pt, aptpl); | 740 | sa_res_key, all_tg_pt, aptpl); |
741 | if (!pr_reg_atp) { | 741 | if (!pr_reg_atp) { |
742 | atomic_dec(&port->sep_tg_pt_ref_cnt); | 742 | atomic_dec(&port->sep_tg_pt_ref_cnt); |
743 | smp_mb__after_atomic_dec(); | 743 | smp_mb__after_atomic(); |
744 | atomic_dec(&deve_tmp->pr_ref_count); | 744 | atomic_dec(&deve_tmp->pr_ref_count); |
745 | smp_mb__after_atomic_dec(); | 745 | smp_mb__after_atomic(); |
746 | core_scsi3_lunacl_undepend_item(deve_tmp); | 746 | core_scsi3_lunacl_undepend_item(deve_tmp); |
747 | goto out; | 747 | goto out; |
748 | } | 748 | } |
@@ -755,7 +755,7 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration( | |||
755 | 755 | ||
756 | spin_lock(&dev->se_port_lock); | 756 | spin_lock(&dev->se_port_lock); |
757 | atomic_dec(&port->sep_tg_pt_ref_cnt); | 757 | atomic_dec(&port->sep_tg_pt_ref_cnt); |
758 | smp_mb__after_atomic_dec(); | 758 | smp_mb__after_atomic(); |
759 | } | 759 | } |
760 | spin_unlock(&dev->se_port_lock); | 760 | spin_unlock(&dev->se_port_lock); |
761 | 761 | ||
@@ -1110,7 +1110,7 @@ static struct t10_pr_registration *__core_scsi3_locate_pr_reg( | |||
1110 | continue; | 1110 | continue; |
1111 | } | 1111 | } |
1112 | atomic_inc(&pr_reg->pr_res_holders); | 1112 | atomic_inc(&pr_reg->pr_res_holders); |
1113 | smp_mb__after_atomic_inc(); | 1113 | smp_mb__after_atomic(); |
1114 | spin_unlock(&pr_tmpl->registration_lock); | 1114 | spin_unlock(&pr_tmpl->registration_lock); |
1115 | return pr_reg; | 1115 | return pr_reg; |
1116 | } | 1116 | } |
@@ -1125,7 +1125,7 @@ static struct t10_pr_registration *__core_scsi3_locate_pr_reg( | |||
1125 | continue; | 1125 | continue; |
1126 | 1126 | ||
1127 | atomic_inc(&pr_reg->pr_res_holders); | 1127 | atomic_inc(&pr_reg->pr_res_holders); |
1128 | smp_mb__after_atomic_inc(); | 1128 | smp_mb__after_atomic(); |
1129 | spin_unlock(&pr_tmpl->registration_lock); | 1129 | spin_unlock(&pr_tmpl->registration_lock); |
1130 | return pr_reg; | 1130 | return pr_reg; |
1131 | } | 1131 | } |
@@ -1155,7 +1155,7 @@ static struct t10_pr_registration *core_scsi3_locate_pr_reg( | |||
1155 | static void core_scsi3_put_pr_reg(struct t10_pr_registration *pr_reg) | 1155 | static void core_scsi3_put_pr_reg(struct t10_pr_registration *pr_reg) |
1156 | { | 1156 | { |
1157 | atomic_dec(&pr_reg->pr_res_holders); | 1157 | atomic_dec(&pr_reg->pr_res_holders); |
1158 | smp_mb__after_atomic_dec(); | 1158 | smp_mb__after_atomic(); |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | static int core_scsi3_check_implicit_release( | 1161 | static int core_scsi3_check_implicit_release( |
@@ -1349,7 +1349,7 @@ static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg) | |||
1349 | &tpg->tpg_group.cg_item); | 1349 | &tpg->tpg_group.cg_item); |
1350 | 1350 | ||
1351 | atomic_dec(&tpg->tpg_pr_ref_count); | 1351 | atomic_dec(&tpg->tpg_pr_ref_count); |
1352 | smp_mb__after_atomic_dec(); | 1352 | smp_mb__after_atomic(); |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) | 1355 | static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) |
@@ -1369,7 +1369,7 @@ static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl) | |||
1369 | 1369 | ||
1370 | if (nacl->dynamic_node_acl) { | 1370 | if (nacl->dynamic_node_acl) { |
1371 | atomic_dec(&nacl->acl_pr_ref_count); | 1371 | atomic_dec(&nacl->acl_pr_ref_count); |
1372 | smp_mb__after_atomic_dec(); | 1372 | smp_mb__after_atomic(); |
1373 | return; | 1373 | return; |
1374 | } | 1374 | } |
1375 | 1375 | ||
@@ -1377,7 +1377,7 @@ static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl) | |||
1377 | &nacl->acl_group.cg_item); | 1377 | &nacl->acl_group.cg_item); |
1378 | 1378 | ||
1379 | atomic_dec(&nacl->acl_pr_ref_count); | 1379 | atomic_dec(&nacl->acl_pr_ref_count); |
1380 | smp_mb__after_atomic_dec(); | 1380 | smp_mb__after_atomic(); |
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve) | 1383 | static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve) |
@@ -1408,7 +1408,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) | |||
1408 | */ | 1408 | */ |
1409 | if (!lun_acl) { | 1409 | if (!lun_acl) { |
1410 | atomic_dec(&se_deve->pr_ref_count); | 1410 | atomic_dec(&se_deve->pr_ref_count); |
1411 | smp_mb__after_atomic_dec(); | 1411 | smp_mb__after_atomic(); |
1412 | return; | 1412 | return; |
1413 | } | 1413 | } |
1414 | nacl = lun_acl->se_lun_nacl; | 1414 | nacl = lun_acl->se_lun_nacl; |
@@ -1418,7 +1418,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) | |||
1418 | &lun_acl->se_lun_group.cg_item); | 1418 | &lun_acl->se_lun_group.cg_item); |
1419 | 1419 | ||
1420 | atomic_dec(&se_deve->pr_ref_count); | 1420 | atomic_dec(&se_deve->pr_ref_count); |
1421 | smp_mb__after_atomic_dec(); | 1421 | smp_mb__after_atomic(); |
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | static sense_reason_t | 1424 | static sense_reason_t |
@@ -1552,14 +1552,14 @@ core_scsi3_decode_spec_i_port( | |||
1552 | continue; | 1552 | continue; |
1553 | 1553 | ||
1554 | atomic_inc(&tmp_tpg->tpg_pr_ref_count); | 1554 | atomic_inc(&tmp_tpg->tpg_pr_ref_count); |
1555 | smp_mb__after_atomic_inc(); | 1555 | smp_mb__after_atomic(); |
1556 | spin_unlock(&dev->se_port_lock); | 1556 | spin_unlock(&dev->se_port_lock); |
1557 | 1557 | ||
1558 | if (core_scsi3_tpg_depend_item(tmp_tpg)) { | 1558 | if (core_scsi3_tpg_depend_item(tmp_tpg)) { |
1559 | pr_err(" core_scsi3_tpg_depend_item()" | 1559 | pr_err(" core_scsi3_tpg_depend_item()" |
1560 | " for tmp_tpg\n"); | 1560 | " for tmp_tpg\n"); |
1561 | atomic_dec(&tmp_tpg->tpg_pr_ref_count); | 1561 | atomic_dec(&tmp_tpg->tpg_pr_ref_count); |
1562 | smp_mb__after_atomic_dec(); | 1562 | smp_mb__after_atomic(); |
1563 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 1563 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
1564 | goto out_unmap; | 1564 | goto out_unmap; |
1565 | } | 1565 | } |
@@ -1573,7 +1573,7 @@ core_scsi3_decode_spec_i_port( | |||
1573 | tmp_tpg, i_str); | 1573 | tmp_tpg, i_str); |
1574 | if (dest_node_acl) { | 1574 | if (dest_node_acl) { |
1575 | atomic_inc(&dest_node_acl->acl_pr_ref_count); | 1575 | atomic_inc(&dest_node_acl->acl_pr_ref_count); |
1576 | smp_mb__after_atomic_inc(); | 1576 | smp_mb__after_atomic(); |
1577 | } | 1577 | } |
1578 | spin_unlock_irq(&tmp_tpg->acl_node_lock); | 1578 | spin_unlock_irq(&tmp_tpg->acl_node_lock); |
1579 | 1579 | ||
@@ -1587,7 +1587,7 @@ core_scsi3_decode_spec_i_port( | |||
1587 | pr_err("configfs_depend_item() failed" | 1587 | pr_err("configfs_depend_item() failed" |
1588 | " for dest_node_acl->acl_group\n"); | 1588 | " for dest_node_acl->acl_group\n"); |
1589 | atomic_dec(&dest_node_acl->acl_pr_ref_count); | 1589 | atomic_dec(&dest_node_acl->acl_pr_ref_count); |
1590 | smp_mb__after_atomic_dec(); | 1590 | smp_mb__after_atomic(); |
1591 | core_scsi3_tpg_undepend_item(tmp_tpg); | 1591 | core_scsi3_tpg_undepend_item(tmp_tpg); |
1592 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 1592 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
1593 | goto out_unmap; | 1593 | goto out_unmap; |
@@ -1647,7 +1647,7 @@ core_scsi3_decode_spec_i_port( | |||
1647 | pr_err("core_scsi3_lunacl_depend_item()" | 1647 | pr_err("core_scsi3_lunacl_depend_item()" |
1648 | " failed\n"); | 1648 | " failed\n"); |
1649 | atomic_dec(&dest_se_deve->pr_ref_count); | 1649 | atomic_dec(&dest_se_deve->pr_ref_count); |
1650 | smp_mb__after_atomic_dec(); | 1650 | smp_mb__after_atomic(); |
1651 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1651 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
1652 | core_scsi3_tpg_undepend_item(dest_tpg); | 1652 | core_scsi3_tpg_undepend_item(dest_tpg); |
1653 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 1653 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
@@ -3168,14 +3168,14 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key, | |||
3168 | continue; | 3168 | continue; |
3169 | 3169 | ||
3170 | atomic_inc(&dest_se_tpg->tpg_pr_ref_count); | 3170 | atomic_inc(&dest_se_tpg->tpg_pr_ref_count); |
3171 | smp_mb__after_atomic_inc(); | 3171 | smp_mb__after_atomic(); |
3172 | spin_unlock(&dev->se_port_lock); | 3172 | spin_unlock(&dev->se_port_lock); |
3173 | 3173 | ||
3174 | if (core_scsi3_tpg_depend_item(dest_se_tpg)) { | 3174 | if (core_scsi3_tpg_depend_item(dest_se_tpg)) { |
3175 | pr_err("core_scsi3_tpg_depend_item() failed" | 3175 | pr_err("core_scsi3_tpg_depend_item() failed" |
3176 | " for dest_se_tpg\n"); | 3176 | " for dest_se_tpg\n"); |
3177 | atomic_dec(&dest_se_tpg->tpg_pr_ref_count); | 3177 | atomic_dec(&dest_se_tpg->tpg_pr_ref_count); |
3178 | smp_mb__after_atomic_dec(); | 3178 | smp_mb__after_atomic(); |
3179 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 3179 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3180 | goto out_put_pr_reg; | 3180 | goto out_put_pr_reg; |
3181 | } | 3181 | } |
@@ -3273,7 +3273,7 @@ after_iport_check: | |||
3273 | initiator_str); | 3273 | initiator_str); |
3274 | if (dest_node_acl) { | 3274 | if (dest_node_acl) { |
3275 | atomic_inc(&dest_node_acl->acl_pr_ref_count); | 3275 | atomic_inc(&dest_node_acl->acl_pr_ref_count); |
3276 | smp_mb__after_atomic_inc(); | 3276 | smp_mb__after_atomic(); |
3277 | } | 3277 | } |
3278 | spin_unlock_irq(&dest_se_tpg->acl_node_lock); | 3278 | spin_unlock_irq(&dest_se_tpg->acl_node_lock); |
3279 | 3279 | ||
@@ -3289,7 +3289,7 @@ after_iport_check: | |||
3289 | pr_err("core_scsi3_nodeacl_depend_item() for" | 3289 | pr_err("core_scsi3_nodeacl_depend_item() for" |
3290 | " dest_node_acl\n"); | 3290 | " dest_node_acl\n"); |
3291 | atomic_dec(&dest_node_acl->acl_pr_ref_count); | 3291 | atomic_dec(&dest_node_acl->acl_pr_ref_count); |
3292 | smp_mb__after_atomic_dec(); | 3292 | smp_mb__after_atomic(); |
3293 | dest_node_acl = NULL; | 3293 | dest_node_acl = NULL; |
3294 | ret = TCM_INVALID_PARAMETER_LIST; | 3294 | ret = TCM_INVALID_PARAMETER_LIST; |
3295 | goto out; | 3295 | goto out; |
@@ -3314,7 +3314,7 @@ after_iport_check: | |||
3314 | if (core_scsi3_lunacl_depend_item(dest_se_deve)) { | 3314 | if (core_scsi3_lunacl_depend_item(dest_se_deve)) { |
3315 | pr_err("core_scsi3_lunacl_depend_item() failed\n"); | 3315 | pr_err("core_scsi3_lunacl_depend_item() failed\n"); |
3316 | atomic_dec(&dest_se_deve->pr_ref_count); | 3316 | atomic_dec(&dest_se_deve->pr_ref_count); |
3317 | smp_mb__after_atomic_dec(); | 3317 | smp_mb__after_atomic(); |
3318 | dest_se_deve = NULL; | 3318 | dest_se_deve = NULL; |
3319 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 3319 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3320 | goto out; | 3320 | goto out; |
@@ -3880,7 +3880,7 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
3880 | add_desc_len = 0; | 3880 | add_desc_len = 0; |
3881 | 3881 | ||
3882 | atomic_inc(&pr_reg->pr_res_holders); | 3882 | atomic_inc(&pr_reg->pr_res_holders); |
3883 | smp_mb__after_atomic_inc(); | 3883 | smp_mb__after_atomic(); |
3884 | spin_unlock(&pr_tmpl->registration_lock); | 3884 | spin_unlock(&pr_tmpl->registration_lock); |
3885 | /* | 3885 | /* |
3886 | * Determine expected length of $FABRIC_MOD specific | 3886 | * Determine expected length of $FABRIC_MOD specific |
@@ -3894,7 +3894,7 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
3894 | " out of buffer: %d\n", cmd->data_length); | 3894 | " out of buffer: %d\n", cmd->data_length); |
3895 | spin_lock(&pr_tmpl->registration_lock); | 3895 | spin_lock(&pr_tmpl->registration_lock); |
3896 | atomic_dec(&pr_reg->pr_res_holders); | 3896 | atomic_dec(&pr_reg->pr_res_holders); |
3897 | smp_mb__after_atomic_dec(); | 3897 | smp_mb__after_atomic(); |
3898 | break; | 3898 | break; |
3899 | } | 3899 | } |
3900 | /* | 3900 | /* |
@@ -3956,7 +3956,7 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
3956 | 3956 | ||
3957 | spin_lock(&pr_tmpl->registration_lock); | 3957 | spin_lock(&pr_tmpl->registration_lock); |
3958 | atomic_dec(&pr_reg->pr_res_holders); | 3958 | atomic_dec(&pr_reg->pr_res_holders); |
3959 | smp_mb__after_atomic_dec(); | 3959 | smp_mb__after_atomic(); |
3960 | /* | 3960 | /* |
3961 | * Set the ADDITIONAL DESCRIPTOR LENGTH | 3961 | * Set the ADDITIONAL DESCRIPTOR LENGTH |
3962 | */ | 3962 | */ |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 789aa9eb0a1e..2179feed0d63 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -736,7 +736,7 @@ void target_qf_do_work(struct work_struct *work) | |||
736 | list_for_each_entry_safe(cmd, cmd_tmp, &qf_cmd_list, se_qf_node) { | 736 | list_for_each_entry_safe(cmd, cmd_tmp, &qf_cmd_list, se_qf_node) { |
737 | list_del(&cmd->se_qf_node); | 737 | list_del(&cmd->se_qf_node); |
738 | atomic_dec(&dev->dev_qf_count); | 738 | atomic_dec(&dev->dev_qf_count); |
739 | smp_mb__after_atomic_dec(); | 739 | smp_mb__after_atomic(); |
740 | 740 | ||
741 | pr_debug("Processing %s cmd: %p QUEUE_FULL in work queue" | 741 | pr_debug("Processing %s cmd: %p QUEUE_FULL in work queue" |
742 | " context: %s\n", cmd->se_tfo->get_fabric_name(), cmd, | 742 | " context: %s\n", cmd->se_tfo->get_fabric_name(), cmd, |
@@ -1149,7 +1149,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd) | |||
1149 | * Dormant to Active status. | 1149 | * Dormant to Active status. |
1150 | */ | 1150 | */ |
1151 | cmd->se_ordered_id = atomic_inc_return(&dev->dev_ordered_id); | 1151 | cmd->se_ordered_id = atomic_inc_return(&dev->dev_ordered_id); |
1152 | smp_mb__after_atomic_inc(); | 1152 | smp_mb__after_atomic(); |
1153 | pr_debug("Allocated se_ordered_id: %u for Task Attr: 0x%02x on %s\n", | 1153 | pr_debug("Allocated se_ordered_id: %u for Task Attr: 0x%02x on %s\n", |
1154 | cmd->se_ordered_id, cmd->sam_task_attr, | 1154 | cmd->se_ordered_id, cmd->sam_task_attr, |
1155 | dev->transport->name); | 1155 | dev->transport->name); |
@@ -1706,7 +1706,7 @@ static bool target_handle_task_attr(struct se_cmd *cmd) | |||
1706 | return false; | 1706 | return false; |
1707 | case MSG_ORDERED_TAG: | 1707 | case MSG_ORDERED_TAG: |
1708 | atomic_inc(&dev->dev_ordered_sync); | 1708 | atomic_inc(&dev->dev_ordered_sync); |
1709 | smp_mb__after_atomic_inc(); | 1709 | smp_mb__after_atomic(); |
1710 | 1710 | ||
1711 | pr_debug("Added ORDERED for CDB: 0x%02x to ordered list, " | 1711 | pr_debug("Added ORDERED for CDB: 0x%02x to ordered list, " |
1712 | " se_ordered_id: %u\n", | 1712 | " se_ordered_id: %u\n", |
@@ -1724,7 +1724,7 @@ static bool target_handle_task_attr(struct se_cmd *cmd) | |||
1724 | * For SIMPLE and UNTAGGED Task Attribute commands | 1724 | * For SIMPLE and UNTAGGED Task Attribute commands |
1725 | */ | 1725 | */ |
1726 | atomic_inc(&dev->simple_cmds); | 1726 | atomic_inc(&dev->simple_cmds); |
1727 | smp_mb__after_atomic_inc(); | 1727 | smp_mb__after_atomic(); |
1728 | break; | 1728 | break; |
1729 | } | 1729 | } |
1730 | 1730 | ||
@@ -1829,7 +1829,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
1829 | 1829 | ||
1830 | if (cmd->sam_task_attr == MSG_SIMPLE_TAG) { | 1830 | if (cmd->sam_task_attr == MSG_SIMPLE_TAG) { |
1831 | atomic_dec(&dev->simple_cmds); | 1831 | atomic_dec(&dev->simple_cmds); |
1832 | smp_mb__after_atomic_dec(); | 1832 | smp_mb__after_atomic(); |
1833 | dev->dev_cur_ordered_id++; | 1833 | dev->dev_cur_ordered_id++; |
1834 | pr_debug("Incremented dev->dev_cur_ordered_id: %u for" | 1834 | pr_debug("Incremented dev->dev_cur_ordered_id: %u for" |
1835 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, | 1835 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, |
@@ -1841,7 +1841,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
1841 | cmd->se_ordered_id); | 1841 | cmd->se_ordered_id); |
1842 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { | 1842 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { |
1843 | atomic_dec(&dev->dev_ordered_sync); | 1843 | atomic_dec(&dev->dev_ordered_sync); |
1844 | smp_mb__after_atomic_dec(); | 1844 | smp_mb__after_atomic(); |
1845 | 1845 | ||
1846 | dev->dev_cur_ordered_id++; | 1846 | dev->dev_cur_ordered_id++; |
1847 | pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" | 1847 | pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" |
@@ -1900,7 +1900,7 @@ static void transport_handle_queue_full( | |||
1900 | spin_lock_irq(&dev->qf_cmd_lock); | 1900 | spin_lock_irq(&dev->qf_cmd_lock); |
1901 | list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list); | 1901 | list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list); |
1902 | atomic_inc(&dev->dev_qf_count); | 1902 | atomic_inc(&dev->dev_qf_count); |
1903 | smp_mb__after_atomic_inc(); | 1903 | smp_mb__after_atomic(); |
1904 | spin_unlock_irq(&cmd->se_dev->qf_cmd_lock); | 1904 | spin_unlock_irq(&cmd->se_dev->qf_cmd_lock); |
1905 | 1905 | ||
1906 | schedule_work(&cmd->se_dev->qf_work_queue); | 1906 | schedule_work(&cmd->se_dev->qf_work_queue); |
@@ -2875,7 +2875,7 @@ void transport_send_task_abort(struct se_cmd *cmd) | |||
2875 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { | 2875 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { |
2876 | cmd->transport_state |= CMD_T_ABORTED; | 2876 | cmd->transport_state |= CMD_T_ABORTED; |
2877 | cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; | 2877 | cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; |
2878 | smp_mb__after_atomic_inc(); | 2878 | smp_mb__after_atomic(); |
2879 | return; | 2879 | return; |
2880 | } | 2880 | } |
2881 | } | 2881 | } |
diff --git a/drivers/target/target_core_ua.c b/drivers/target/target_core_ua.c index 505519b10cb7..101858e245b3 100644 --- a/drivers/target/target_core_ua.c +++ b/drivers/target/target_core_ua.c | |||
@@ -162,7 +162,7 @@ int core_scsi3_ua_allocate( | |||
162 | spin_unlock_irq(&nacl->device_list_lock); | 162 | spin_unlock_irq(&nacl->device_list_lock); |
163 | 163 | ||
164 | atomic_inc(&deve->ua_count); | 164 | atomic_inc(&deve->ua_count); |
165 | smp_mb__after_atomic_inc(); | 165 | smp_mb__after_atomic(); |
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | list_add_tail(&ua->ua_nacl_list, &deve->ua_list); | 168 | list_add_tail(&ua->ua_nacl_list, &deve->ua_list); |
@@ -175,7 +175,7 @@ int core_scsi3_ua_allocate( | |||
175 | asc, ascq); | 175 | asc, ascq); |
176 | 176 | ||
177 | atomic_inc(&deve->ua_count); | 177 | atomic_inc(&deve->ua_count); |
178 | smp_mb__after_atomic_inc(); | 178 | smp_mb__after_atomic(); |
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
181 | 181 | ||
@@ -190,7 +190,7 @@ void core_scsi3_ua_release_all( | |||
190 | kmem_cache_free(se_ua_cache, ua); | 190 | kmem_cache_free(se_ua_cache, ua); |
191 | 191 | ||
192 | atomic_dec(&deve->ua_count); | 192 | atomic_dec(&deve->ua_count); |
193 | smp_mb__after_atomic_dec(); | 193 | smp_mb__after_atomic(); |
194 | } | 194 | } |
195 | spin_unlock(&deve->ua_lock); | 195 | spin_unlock(&deve->ua_lock); |
196 | } | 196 | } |
@@ -251,7 +251,7 @@ void core_scsi3_ua_for_check_condition( | |||
251 | kmem_cache_free(se_ua_cache, ua); | 251 | kmem_cache_free(se_ua_cache, ua); |
252 | 252 | ||
253 | atomic_dec(&deve->ua_count); | 253 | atomic_dec(&deve->ua_count); |
254 | smp_mb__after_atomic_dec(); | 254 | smp_mb__after_atomic(); |
255 | } | 255 | } |
256 | spin_unlock(&deve->ua_lock); | 256 | spin_unlock(&deve->ua_lock); |
257 | spin_unlock_irq(&nacl->device_list_lock); | 257 | spin_unlock_irq(&nacl->device_list_lock); |
@@ -310,7 +310,7 @@ int core_scsi3_ua_clear_for_request_sense( | |||
310 | kmem_cache_free(se_ua_cache, ua); | 310 | kmem_cache_free(se_ua_cache, ua); |
311 | 311 | ||
312 | atomic_dec(&deve->ua_count); | 312 | atomic_dec(&deve->ua_count); |
313 | smp_mb__after_atomic_dec(); | 313 | smp_mb__after_atomic(); |
314 | } | 314 | } |
315 | spin_unlock(&deve->ua_lock); | 315 | spin_unlock(&deve->ua_lock); |
316 | spin_unlock_irq(&nacl->device_list_lock); | 316 | spin_unlock_irq(&nacl->device_list_lock); |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index fe9d129c8735..f95569dedc88 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -2041,7 +2041,7 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2041 | 2041 | ||
2042 | if (found) | 2042 | if (found) |
2043 | clear_bit(eol, ldata->read_flags); | 2043 | clear_bit(eol, ldata->read_flags); |
2044 | smp_mb__after_clear_bit(); | 2044 | smp_mb__after_atomic(); |
2045 | ldata->read_tail += c; | 2045 | ldata->read_tail += c; |
2046 | 2046 | ||
2047 | if (found) { | 2047 | if (found) { |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index aa97fd845b4d..4b5b3c2fe328 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
@@ -200,7 +200,7 @@ static void dma_tx_callback(void *param) | |||
200 | 200 | ||
201 | /* clear the bit used to serialize the DMA tx. */ | 201 | /* clear the bit used to serialize the DMA tx. */ |
202 | clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags); | 202 | clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags); |
203 | smp_mb__after_clear_bit(); | 203 | smp_mb__after_atomic(); |
204 | 204 | ||
205 | /* wake up the possible processes. */ | 205 | /* wake up the possible processes. */ |
206 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 206 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
@@ -275,7 +275,7 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s) | |||
275 | mxs_auart_dma_tx(s, i); | 275 | mxs_auart_dma_tx(s, i); |
276 | } else { | 276 | } else { |
277 | clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags); | 277 | clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags); |
278 | smp_mb__after_clear_bit(); | 278 | smp_mb__after_atomic(); |
279 | } | 279 | } |
280 | return; | 280 | return; |
281 | } | 281 | } |
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c index 49481e0a3382..6cdb7a534f23 100644 --- a/drivers/usb/gadget/tcm_usb_gadget.c +++ b/drivers/usb/gadget/tcm_usb_gadget.c | |||
@@ -1843,7 +1843,7 @@ static int usbg_port_link(struct se_portal_group *se_tpg, struct se_lun *lun) | |||
1843 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); | 1843 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); |
1844 | 1844 | ||
1845 | atomic_inc(&tpg->tpg_port_count); | 1845 | atomic_inc(&tpg->tpg_port_count); |
1846 | smp_mb__after_atomic_inc(); | 1846 | smp_mb__after_atomic(); |
1847 | return 0; | 1847 | return 0; |
1848 | } | 1848 | } |
1849 | 1849 | ||
@@ -1853,7 +1853,7 @@ static void usbg_port_unlink(struct se_portal_group *se_tpg, | |||
1853 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); | 1853 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); |
1854 | 1854 | ||
1855 | atomic_dec(&tpg->tpg_port_count); | 1855 | atomic_dec(&tpg->tpg_port_count); |
1856 | smp_mb__after_atomic_dec(); | 1856 | smp_mb__after_atomic(); |
1857 | } | 1857 | } |
1858 | 1858 | ||
1859 | static int usbg_check_stop_free(struct se_cmd *se_cmd) | 1859 | static int usbg_check_stop_free(struct se_cmd *se_cmd) |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 2932d9cfb166..2f805cb386a5 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -312,7 +312,7 @@ static void usb_wwan_outdat_callback(struct urb *urb) | |||
312 | 312 | ||
313 | for (i = 0; i < N_OUT_URB; ++i) { | 313 | for (i = 0; i < N_OUT_URB; ++i) { |
314 | if (portdata->out_urbs[i] == urb) { | 314 | if (portdata->out_urbs[i] == urb) { |
315 | smp_mb__before_clear_bit(); | 315 | smp_mb__before_atomic(); |
316 | clear_bit(i, &portdata->out_busy); | 316 | clear_bit(i, &portdata->out_busy); |
317 | break; | 317 | break; |
318 | } | 318 | } |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index cf50ce93975b..aeb513108448 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1255,7 +1255,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, | |||
1255 | tpg->tv_tpg_vhost_count++; | 1255 | tpg->tv_tpg_vhost_count++; |
1256 | tpg->vhost_scsi = vs; | 1256 | tpg->vhost_scsi = vs; |
1257 | vs_tpg[tpg->tport_tpgt] = tpg; | 1257 | vs_tpg[tpg->tport_tpgt] = tpg; |
1258 | smp_mb__after_atomic_inc(); | 1258 | smp_mb__after_atomic(); |
1259 | match = true; | 1259 | match = true; |
1260 | } | 1260 | } |
1261 | mutex_unlock(&tpg->tv_tpg_mutex); | 1261 | mutex_unlock(&tpg->tv_tpg_mutex); |
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c index 3bff6b37b472..3651ec801f45 100644 --- a/drivers/w1/w1_family.c +++ b/drivers/w1/w1_family.c | |||
@@ -139,9 +139,9 @@ void w1_family_get(struct w1_family *f) | |||
139 | 139 | ||
140 | void __w1_family_get(struct w1_family *f) | 140 | void __w1_family_get(struct w1_family *f) |
141 | { | 141 | { |
142 | smp_mb__before_atomic_inc(); | 142 | smp_mb__before_atomic(); |
143 | atomic_inc(&f->refcnt); | 143 | atomic_inc(&f->refcnt); |
144 | smp_mb__after_atomic_inc(); | 144 | smp_mb__after_atomic(); |
145 | } | 145 | } |
146 | 146 | ||
147 | EXPORT_SYMBOL(w1_unregister_family); | 147 | EXPORT_SYMBOL(w1_unregister_family); |
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 607e41460c0d..c4a0666de6f5 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c | |||
@@ -348,9 +348,9 @@ void xen_pcibk_do_op(struct work_struct *data) | |||
348 | notify_remote_via_irq(pdev->evtchn_irq); | 348 | notify_remote_via_irq(pdev->evtchn_irq); |
349 | 349 | ||
350 | /* Mark that we're done. */ | 350 | /* Mark that we're done. */ |
351 | smp_mb__before_clear_bit(); /* /after/ clearing PCIF_active */ | 351 | smp_mb__before_atomic(); /* /after/ clearing PCIF_active */ |
352 | clear_bit(_PDEVF_op_active, &pdev->flags); | 352 | clear_bit(_PDEVF_op_active, &pdev->flags); |
353 | smp_mb__after_clear_bit(); /* /before/ final check for work */ | 353 | smp_mb__after_atomic(); /* /before/ final check for work */ |
354 | 354 | ||
355 | /* Check to see if the driver domain tried to start another request in | 355 | /* Check to see if the driver domain tried to start another request in |
356 | * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active. | 356 | * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active. |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index c9a24444ec9a..2256e9cceec5 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -279,7 +279,7 @@ static inline void btrfs_inode_block_unlocked_dio(struct inode *inode) | |||
279 | 279 | ||
280 | static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode) | 280 | static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode) |
281 | { | 281 | { |
282 | smp_mb__before_clear_bit(); | 282 | smp_mb__before_atomic(); |
283 | clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, | 283 | clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, |
284 | &BTRFS_I(inode)->runtime_flags); | 284 | &BTRFS_I(inode)->runtime_flags); |
285 | } | 285 | } |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 3955e475ceec..f29a54e454d4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -3458,7 +3458,7 @@ static int lock_extent_buffer_for_io(struct extent_buffer *eb, | |||
3458 | static void end_extent_buffer_writeback(struct extent_buffer *eb) | 3458 | static void end_extent_buffer_writeback(struct extent_buffer *eb) |
3459 | { | 3459 | { |
3460 | clear_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags); | 3460 | clear_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags); |
3461 | smp_mb__after_clear_bit(); | 3461 | smp_mb__after_atomic(); |
3462 | wake_up_bit(&eb->bflags, EXTENT_BUFFER_WRITEBACK); | 3462 | wake_up_bit(&eb->bflags, EXTENT_BUFFER_WRITEBACK); |
3463 | } | 3463 | } |
3464 | 3464 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5f805bc944fa..5a3b8371772e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -7126,7 +7126,7 @@ static void btrfs_end_dio_bio(struct bio *bio, int err) | |||
7126 | * before atomic variable goto zero, we must make sure | 7126 | * before atomic variable goto zero, we must make sure |
7127 | * dip->errors is perceived to be set. | 7127 | * dip->errors is perceived to be set. |
7128 | */ | 7128 | */ |
7129 | smp_mb__before_atomic_dec(); | 7129 | smp_mb__before_atomic(); |
7130 | } | 7130 | } |
7131 | 7131 | ||
7132 | /* if there are more bios still pending for this dio, just exit */ | 7132 | /* if there are more bios still pending for this dio, just exit */ |
@@ -7306,7 +7306,7 @@ out_err: | |||
7306 | * before atomic variable goto zero, we must | 7306 | * before atomic variable goto zero, we must |
7307 | * make sure dip->errors is perceived to be set. | 7307 | * make sure dip->errors is perceived to be set. |
7308 | */ | 7308 | */ |
7309 | smp_mb__before_atomic_dec(); | 7309 | smp_mb__before_atomic(); |
7310 | if (atomic_dec_and_test(&dip->pending_bios)) | 7310 | if (atomic_dec_and_test(&dip->pending_bios)) |
7311 | bio_io_error(dip->orig_bio); | 7311 | bio_io_error(dip->orig_bio); |
7312 | 7312 | ||
@@ -7449,7 +7449,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
7449 | return 0; | 7449 | return 0; |
7450 | 7450 | ||
7451 | atomic_inc(&inode->i_dio_count); | 7451 | atomic_inc(&inode->i_dio_count); |
7452 | smp_mb__after_atomic_inc(); | 7452 | smp_mb__after_atomic(); |
7453 | 7453 | ||
7454 | /* | 7454 | /* |
7455 | * The generic stuff only does filemap_write_and_wait_range, which | 7455 | * The generic stuff only does filemap_write_and_wait_range, which |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2f6d7b13b5bd..3f52bb7a58d2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -642,7 +642,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
642 | return -EINVAL; | 642 | return -EINVAL; |
643 | 643 | ||
644 | atomic_inc(&root->will_be_snapshoted); | 644 | atomic_inc(&root->will_be_snapshoted); |
645 | smp_mb__after_atomic_inc(); | 645 | smp_mb__after_atomic(); |
646 | btrfs_wait_nocow_write(root); | 646 | btrfs_wait_nocow_write(root); |
647 | 647 | ||
648 | ret = btrfs_start_delalloc_inodes(root, 0); | 648 | ret = btrfs_start_delalloc_inodes(root, 0); |
diff --git a/fs/buffer.c b/fs/buffer.c index 9ddb9fc7d923..6a8110c03a47 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -77,7 +77,7 @@ EXPORT_SYMBOL(__lock_buffer); | |||
77 | void unlock_buffer(struct buffer_head *bh) | 77 | void unlock_buffer(struct buffer_head *bh) |
78 | { | 78 | { |
79 | clear_bit_unlock(BH_Lock, &bh->b_state); | 79 | clear_bit_unlock(BH_Lock, &bh->b_state); |
80 | smp_mb__after_clear_bit(); | 80 | smp_mb__after_atomic(); |
81 | wake_up_bit(&bh->b_state, BH_Lock); | 81 | wake_up_bit(&bh->b_state, BH_Lock); |
82 | } | 82 | } |
83 | EXPORT_SYMBOL(unlock_buffer); | 83 | EXPORT_SYMBOL(unlock_buffer); |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index f3b84cd9de56..08b3c116915b 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -42,7 +42,7 @@ int ext4_resize_begin(struct super_block *sb) | |||
42 | void ext4_resize_end(struct super_block *sb) | 42 | void ext4_resize_end(struct super_block *sb) |
43 | { | 43 | { |
44 | clear_bit_unlock(EXT4_RESIZING, &EXT4_SB(sb)->s_resize_flags); | 44 | clear_bit_unlock(EXT4_RESIZING, &EXT4_SB(sb)->s_resize_flags); |
45 | smp_mb__after_clear_bit(); | 45 | smp_mb__after_atomic(); |
46 | } | 46 | } |
47 | 47 | ||
48 | static ext4_group_t ext4_meta_bg_first_group(struct super_block *sb, | 48 | static ext4_group_t ext4_meta_bg_first_group(struct super_block *sb, |
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index aec7f73832f0..c355f7320e44 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -277,7 +277,7 @@ static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holde | |||
277 | static void gfs2_holder_wake(struct gfs2_holder *gh) | 277 | static void gfs2_holder_wake(struct gfs2_holder *gh) |
278 | { | 278 | { |
279 | clear_bit(HIF_WAIT, &gh->gh_iflags); | 279 | clear_bit(HIF_WAIT, &gh->gh_iflags); |
280 | smp_mb__after_clear_bit(); | 280 | smp_mb__after_atomic(); |
281 | wake_up_bit(&gh->gh_iflags, HIF_WAIT); | 281 | wake_up_bit(&gh->gh_iflags, HIF_WAIT); |
282 | } | 282 | } |
283 | 283 | ||
@@ -411,7 +411,7 @@ static void gfs2_demote_wake(struct gfs2_glock *gl) | |||
411 | { | 411 | { |
412 | gl->gl_demote_state = LM_ST_EXCLUSIVE; | 412 | gl->gl_demote_state = LM_ST_EXCLUSIVE; |
413 | clear_bit(GLF_DEMOTE, &gl->gl_flags); | 413 | clear_bit(GLF_DEMOTE, &gl->gl_flags); |
414 | smp_mb__after_clear_bit(); | 414 | smp_mb__after_atomic(); |
415 | wake_up_bit(&gl->gl_flags, GLF_DEMOTE); | 415 | wake_up_bit(&gl->gl_flags, GLF_DEMOTE); |
416 | } | 416 | } |
417 | 417 | ||
@@ -620,7 +620,7 @@ out: | |||
620 | 620 | ||
621 | out_sched: | 621 | out_sched: |
622 | clear_bit(GLF_LOCK, &gl->gl_flags); | 622 | clear_bit(GLF_LOCK, &gl->gl_flags); |
623 | smp_mb__after_clear_bit(); | 623 | smp_mb__after_atomic(); |
624 | gl->gl_lockref.count++; | 624 | gl->gl_lockref.count++; |
625 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) | 625 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) |
626 | gl->gl_lockref.count--; | 626 | gl->gl_lockref.count--; |
@@ -628,7 +628,7 @@ out_sched: | |||
628 | 628 | ||
629 | out_unlock: | 629 | out_unlock: |
630 | clear_bit(GLF_LOCK, &gl->gl_flags); | 630 | clear_bit(GLF_LOCK, &gl->gl_flags); |
631 | smp_mb__after_clear_bit(); | 631 | smp_mb__after_atomic(); |
632 | return; | 632 | return; |
633 | } | 633 | } |
634 | 634 | ||
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 54b66809e818..74d9a3dbf16f 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -221,7 +221,7 @@ static void inode_go_sync(struct gfs2_glock *gl) | |||
221 | * Writeback of the data mapping may cause the dirty flag to be set | 221 | * Writeback of the data mapping may cause the dirty flag to be set |
222 | * so we have to clear it again here. | 222 | * so we have to clear it again here. |
223 | */ | 223 | */ |
224 | smp_mb__before_clear_bit(); | 224 | smp_mb__before_atomic(); |
225 | clear_bit(GLF_DIRTY, &gl->gl_flags); | 225 | clear_bit(GLF_DIRTY, &gl->gl_flags); |
226 | } | 226 | } |
227 | 227 | ||
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index c1eb555dc588..91f274de1246 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -1134,7 +1134,7 @@ static void gdlm_recover_done(void *arg, struct dlm_slot *slots, int num_slots, | |||
1134 | queue_delayed_work(gfs2_control_wq, &sdp->sd_control_work, 0); | 1134 | queue_delayed_work(gfs2_control_wq, &sdp->sd_control_work, 0); |
1135 | 1135 | ||
1136 | clear_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags); | 1136 | clear_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags); |
1137 | smp_mb__after_clear_bit(); | 1137 | smp_mb__after_atomic(); |
1138 | wake_up_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY); | 1138 | wake_up_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY); |
1139 | spin_unlock(&ls->ls_recover_spin); | 1139 | spin_unlock(&ls->ls_recover_spin); |
1140 | } | 1140 | } |
@@ -1271,7 +1271,7 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table) | |||
1271 | 1271 | ||
1272 | ls->ls_first = !!test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); | 1272 | ls->ls_first = !!test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); |
1273 | clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); | 1273 | clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); |
1274 | smp_mb__after_clear_bit(); | 1274 | smp_mb__after_atomic(); |
1275 | wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); | 1275 | wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); |
1276 | return 0; | 1276 | return 0; |
1277 | 1277 | ||
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index 7ad4094d68c0..fe7a56fb6084 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -587,7 +587,7 @@ fail: | |||
587 | gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP); | 587 | gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP); |
588 | done: | 588 | done: |
589 | clear_bit(JDF_RECOVERY, &jd->jd_flags); | 589 | clear_bit(JDF_RECOVERY, &jd->jd_flags); |
590 | smp_mb__after_clear_bit(); | 590 | smp_mb__after_atomic(); |
591 | wake_up_bit(&jd->jd_flags, JDF_RECOVERY); | 591 | wake_up_bit(&jd->jd_flags, JDF_RECOVERY); |
592 | } | 592 | } |
593 | 593 | ||
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index de25d5577e5d..529d9a9eb897 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -333,7 +333,7 @@ static ssize_t block_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | |||
333 | set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); | 333 | set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); |
334 | else if (val == 0) { | 334 | else if (val == 0) { |
335 | clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); | 335 | clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); |
336 | smp_mb__after_clear_bit(); | 336 | smp_mb__after_atomic(); |
337 | gfs2_glock_thaw(sdp); | 337 | gfs2_glock_thaw(sdp); |
338 | } else { | 338 | } else { |
339 | ret = -EINVAL; | 339 | ret = -EINVAL; |
@@ -482,7 +482,7 @@ static ssize_t jid_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | |||
482 | rv = jid = -EINVAL; | 482 | rv = jid = -EINVAL; |
483 | sdp->sd_lockstruct.ls_jid = jid; | 483 | sdp->sd_lockstruct.ls_jid = jid; |
484 | clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); | 484 | clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); |
485 | smp_mb__after_clear_bit(); | 485 | smp_mb__after_atomic(); |
486 | wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); | 486 | wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); |
487 | out: | 487 | out: |
488 | spin_unlock(&sdp->sd_jindex_spin); | 488 | spin_unlock(&sdp->sd_jindex_spin); |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 5f26139a165a..6fac74349856 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -43,7 +43,7 @@ static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate) | |||
43 | clear_buffer_uptodate(bh); | 43 | clear_buffer_uptodate(bh); |
44 | if (orig_bh) { | 44 | if (orig_bh) { |
45 | clear_bit_unlock(BH_Shadow, &orig_bh->b_state); | 45 | clear_bit_unlock(BH_Shadow, &orig_bh->b_state); |
46 | smp_mb__after_clear_bit(); | 46 | smp_mb__after_atomic(); |
47 | wake_up_bit(&orig_bh->b_state, BH_Shadow); | 47 | wake_up_bit(&orig_bh->b_state, BH_Shadow); |
48 | } | 48 | } |
49 | unlock_buffer(bh); | 49 | unlock_buffer(bh); |
@@ -239,7 +239,7 @@ static int journal_submit_data_buffers(journal_t *journal, | |||
239 | spin_lock(&journal->j_list_lock); | 239 | spin_lock(&journal->j_list_lock); |
240 | J_ASSERT(jinode->i_transaction == commit_transaction); | 240 | J_ASSERT(jinode->i_transaction == commit_transaction); |
241 | clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); | 241 | clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); |
242 | smp_mb__after_clear_bit(); | 242 | smp_mb__after_atomic(); |
243 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); | 243 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); |
244 | } | 244 | } |
245 | spin_unlock(&journal->j_list_lock); | 245 | spin_unlock(&journal->j_list_lock); |
@@ -277,7 +277,7 @@ static int journal_finish_inode_data_buffers(journal_t *journal, | |||
277 | } | 277 | } |
278 | spin_lock(&journal->j_list_lock); | 278 | spin_lock(&journal->j_list_lock); |
279 | clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); | 279 | clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); |
280 | smp_mb__after_clear_bit(); | 280 | smp_mb__after_atomic(); |
281 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); | 281 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); |
282 | } | 282 | } |
283 | 283 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index d9f3d067cd15..4a3d4ef76127 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -2032,9 +2032,9 @@ static void nfs_access_free_entry(struct nfs_access_entry *entry) | |||
2032 | { | 2032 | { |
2033 | put_rpccred(entry->cred); | 2033 | put_rpccred(entry->cred); |
2034 | kfree(entry); | 2034 | kfree(entry); |
2035 | smp_mb__before_atomic_dec(); | 2035 | smp_mb__before_atomic(); |
2036 | atomic_long_dec(&nfs_access_nr_entries); | 2036 | atomic_long_dec(&nfs_access_nr_entries); |
2037 | smp_mb__after_atomic_dec(); | 2037 | smp_mb__after_atomic(); |
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | static void nfs_access_free_list(struct list_head *head) | 2040 | static void nfs_access_free_list(struct list_head *head) |
@@ -2082,9 +2082,9 @@ nfs_access_cache_scan(struct shrinker *shrink, struct shrink_control *sc) | |||
2082 | else { | 2082 | else { |
2083 | remove_lru_entry: | 2083 | remove_lru_entry: |
2084 | list_del_init(&nfsi->access_cache_inode_lru); | 2084 | list_del_init(&nfsi->access_cache_inode_lru); |
2085 | smp_mb__before_clear_bit(); | 2085 | smp_mb__before_atomic(); |
2086 | clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags); | 2086 | clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags); |
2087 | smp_mb__after_clear_bit(); | 2087 | smp_mb__after_atomic(); |
2088 | } | 2088 | } |
2089 | spin_unlock(&inode->i_lock); | 2089 | spin_unlock(&inode->i_lock); |
2090 | } | 2090 | } |
@@ -2232,9 +2232,9 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set) | |||
2232 | nfs_access_add_rbtree(inode, cache); | 2232 | nfs_access_add_rbtree(inode, cache); |
2233 | 2233 | ||
2234 | /* Update accounting */ | 2234 | /* Update accounting */ |
2235 | smp_mb__before_atomic_inc(); | 2235 | smp_mb__before_atomic(); |
2236 | atomic_long_inc(&nfs_access_nr_entries); | 2236 | atomic_long_inc(&nfs_access_nr_entries); |
2237 | smp_mb__after_atomic_inc(); | 2237 | smp_mb__after_atomic(); |
2238 | 2238 | ||
2239 | /* Add inode to global LRU list */ | 2239 | /* Add inode to global LRU list */ |
2240 | if (!test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags)) { | 2240 | if (!test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags)) { |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 0c438973f3c8..e6f7398d2b3c 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1085,7 +1085,7 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
1085 | trace_nfs_invalidate_mapping_exit(inode, ret); | 1085 | trace_nfs_invalidate_mapping_exit(inode, ret); |
1086 | 1086 | ||
1087 | clear_bit_unlock(NFS_INO_INVALIDATING, bitlock); | 1087 | clear_bit_unlock(NFS_INO_INVALIDATING, bitlock); |
1088 | smp_mb__after_clear_bit(); | 1088 | smp_mb__after_atomic(); |
1089 | wake_up_bit(bitlock, NFS_INO_INVALIDATING); | 1089 | wake_up_bit(bitlock, NFS_INO_INVALIDATING); |
1090 | out: | 1090 | out: |
1091 | return ret; | 1091 | return ret; |
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index efac602edb37..b9c61efe9660 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -789,9 +789,9 @@ static void nfs4_wait_ds_connect(struct nfs4_pnfs_ds *ds) | |||
789 | 789 | ||
790 | static void nfs4_clear_ds_conn_bit(struct nfs4_pnfs_ds *ds) | 790 | static void nfs4_clear_ds_conn_bit(struct nfs4_pnfs_ds *ds) |
791 | { | 791 | { |
792 | smp_mb__before_clear_bit(); | 792 | smp_mb__before_atomic(); |
793 | clear_bit(NFS4DS_CONNECTING, &ds->ds_state); | 793 | clear_bit(NFS4DS_CONNECTING, &ds->ds_state); |
794 | smp_mb__after_clear_bit(); | 794 | smp_mb__after_atomic(); |
795 | wake_up_bit(&ds->ds_state, NFS4DS_CONNECTING); | 795 | wake_up_bit(&ds->ds_state, NFS4DS_CONNECTING); |
796 | } | 796 | } |
797 | 797 | ||
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 2349518eef2c..c0583b9bef71 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1140,9 +1140,9 @@ static int nfs4_run_state_manager(void *); | |||
1140 | 1140 | ||
1141 | static void nfs4_clear_state_manager_bit(struct nfs_client *clp) | 1141 | static void nfs4_clear_state_manager_bit(struct nfs_client *clp) |
1142 | { | 1142 | { |
1143 | smp_mb__before_clear_bit(); | 1143 | smp_mb__before_atomic(); |
1144 | clear_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); | 1144 | clear_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); |
1145 | smp_mb__after_clear_bit(); | 1145 | smp_mb__after_atomic(); |
1146 | wake_up_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING); | 1146 | wake_up_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING); |
1147 | rpc_wake_up(&clp->cl_rpcwaitq); | 1147 | rpc_wake_up(&clp->cl_rpcwaitq); |
1148 | } | 1148 | } |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 2ffebf2081ce..03ed984ab4d8 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -95,7 +95,7 @@ nfs_iocounter_dec(struct nfs_io_counter *c) | |||
95 | { | 95 | { |
96 | if (atomic_dec_and_test(&c->io_count)) { | 96 | if (atomic_dec_and_test(&c->io_count)) { |
97 | clear_bit(NFS_IO_INPROGRESS, &c->flags); | 97 | clear_bit(NFS_IO_INPROGRESS, &c->flags); |
98 | smp_mb__after_clear_bit(); | 98 | smp_mb__after_atomic(); |
99 | wake_up_bit(&c->flags, NFS_IO_INPROGRESS); | 99 | wake_up_bit(&c->flags, NFS_IO_INPROGRESS); |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -193,9 +193,9 @@ void nfs_unlock_request(struct nfs_page *req) | |||
193 | printk(KERN_ERR "NFS: Invalid unlock attempted\n"); | 193 | printk(KERN_ERR "NFS: Invalid unlock attempted\n"); |
194 | BUG(); | 194 | BUG(); |
195 | } | 195 | } |
196 | smp_mb__before_clear_bit(); | 196 | smp_mb__before_atomic(); |
197 | clear_bit(PG_BUSY, &req->wb_flags); | 197 | clear_bit(PG_BUSY, &req->wb_flags); |
198 | smp_mb__after_clear_bit(); | 198 | smp_mb__after_atomic(); |
199 | wake_up_bit(&req->wb_flags, PG_BUSY); | 199 | wake_up_bit(&req->wb_flags, PG_BUSY); |
200 | } | 200 | } |
201 | 201 | ||
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index cb53d450ae32..fd9536e494bc 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1810,7 +1810,7 @@ static void pnfs_clear_layoutcommitting(struct inode *inode) | |||
1810 | unsigned long *bitlock = &NFS_I(inode)->flags; | 1810 | unsigned long *bitlock = &NFS_I(inode)->flags; |
1811 | 1811 | ||
1812 | clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock); | 1812 | clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock); |
1813 | smp_mb__after_clear_bit(); | 1813 | smp_mb__after_atomic(); |
1814 | wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING); | 1814 | wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING); |
1815 | } | 1815 | } |
1816 | 1816 | ||
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 023793909778..c3058a076596 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -275,7 +275,7 @@ pnfs_get_lseg(struct pnfs_layout_segment *lseg) | |||
275 | { | 275 | { |
276 | if (lseg) { | 276 | if (lseg) { |
277 | atomic_inc(&lseg->pls_refcount); | 277 | atomic_inc(&lseg->pls_refcount); |
278 | smp_mb__after_atomic_inc(); | 278 | smp_mb__after_atomic(); |
279 | } | 279 | } |
280 | return lseg; | 280 | return lseg; |
281 | } | 281 | } |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 9a3b6a4cd6b9..ffb9459f180b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -405,7 +405,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) | |||
405 | nfs_pageio_complete(&pgio); | 405 | nfs_pageio_complete(&pgio); |
406 | 406 | ||
407 | clear_bit_unlock(NFS_INO_FLUSHING, bitlock); | 407 | clear_bit_unlock(NFS_INO_FLUSHING, bitlock); |
408 | smp_mb__after_clear_bit(); | 408 | smp_mb__after_atomic(); |
409 | wake_up_bit(bitlock, NFS_INO_FLUSHING); | 409 | wake_up_bit(bitlock, NFS_INO_FLUSHING); |
410 | 410 | ||
411 | if (err < 0) | 411 | if (err < 0) |
@@ -1458,7 +1458,7 @@ static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait) | |||
1458 | static void nfs_commit_clear_lock(struct nfs_inode *nfsi) | 1458 | static void nfs_commit_clear_lock(struct nfs_inode *nfsi) |
1459 | { | 1459 | { |
1460 | clear_bit(NFS_INO_COMMIT, &nfsi->flags); | 1460 | clear_bit(NFS_INO_COMMIT, &nfsi->flags); |
1461 | smp_mb__after_clear_bit(); | 1461 | smp_mb__after_atomic(); |
1462 | wake_up_bit(&nfsi->flags, NFS_INO_COMMIT); | 1462 | wake_up_bit(&nfsi->flags, NFS_INO_COMMIT); |
1463 | } | 1463 | } |
1464 | 1464 | ||
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 4b826abb1528..45d4e96a6bac 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -460,9 +460,9 @@ static int write_cnodes(struct ubifs_info *c) | |||
460 | * important. | 460 | * important. |
461 | */ | 461 | */ |
462 | clear_bit(DIRTY_CNODE, &cnode->flags); | 462 | clear_bit(DIRTY_CNODE, &cnode->flags); |
463 | smp_mb__before_clear_bit(); | 463 | smp_mb__before_atomic(); |
464 | clear_bit(COW_CNODE, &cnode->flags); | 464 | clear_bit(COW_CNODE, &cnode->flags); |
465 | smp_mb__after_clear_bit(); | 465 | smp_mb__after_atomic(); |
466 | offs += len; | 466 | offs += len; |
467 | dbg_chk_lpt_sz(c, 1, len); | 467 | dbg_chk_lpt_sz(c, 1, len); |
468 | cnode = cnode->cnext; | 468 | cnode = cnode->cnext; |
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index 52a6559275c4..3600994f8411 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -895,9 +895,9 @@ static int write_index(struct ubifs_info *c) | |||
895 | * the reason for the second barrier. | 895 | * the reason for the second barrier. |
896 | */ | 896 | */ |
897 | clear_bit(DIRTY_ZNODE, &znode->flags); | 897 | clear_bit(DIRTY_ZNODE, &znode->flags); |
898 | smp_mb__before_clear_bit(); | 898 | smp_mb__before_atomic(); |
899 | clear_bit(COW_ZNODE, &znode->flags); | 899 | clear_bit(COW_ZNODE, &znode->flags); |
900 | smp_mb__after_clear_bit(); | 900 | smp_mb__after_atomic(); |
901 | 901 | ||
902 | /* | 902 | /* |
903 | * We have marked the znode as clean but have not updated the | 903 | * We have marked the znode as clean but have not updated the |
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 33bd2de3bc1e..9c79e7603459 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define __ASM_GENERIC_ATOMIC_H | 16 | #define __ASM_GENERIC_ATOMIC_H |
17 | 17 | ||
18 | #include <asm/cmpxchg.h> | 18 | #include <asm/cmpxchg.h> |
19 | #include <asm/barrier.h> | ||
19 | 20 | ||
20 | #ifdef CONFIG_SMP | 21 | #ifdef CONFIG_SMP |
21 | /* Force people to define core atomics */ | 22 | /* Force people to define core atomics */ |
@@ -182,11 +183,5 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | |||
182 | } | 183 | } |
183 | #endif | 184 | #endif |
184 | 185 | ||
185 | /* Assume that atomic operations are already serializing */ | ||
186 | #define smp_mb__before_atomic_dec() barrier() | ||
187 | #define smp_mb__after_atomic_dec() barrier() | ||
188 | #define smp_mb__before_atomic_inc() barrier() | ||
189 | #define smp_mb__after_atomic_inc() barrier() | ||
190 | |||
191 | #endif /* __KERNEL__ */ | 186 | #endif /* __KERNEL__ */ |
192 | #endif /* __ASM_GENERIC_ATOMIC_H */ | 187 | #endif /* __ASM_GENERIC_ATOMIC_H */ |
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h index 6f692f8ac664..1402fa855388 100644 --- a/include/asm-generic/barrier.h +++ b/include/asm-generic/barrier.h | |||
@@ -62,6 +62,14 @@ | |||
62 | #define set_mb(var, value) do { (var) = (value); mb(); } while (0) | 62 | #define set_mb(var, value) do { (var) = (value); mb(); } while (0) |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #ifndef smp_mb__before_atomic | ||
66 | #define smp_mb__before_atomic() smp_mb() | ||
67 | #endif | ||
68 | |||
69 | #ifndef smp_mb__after_atomic | ||
70 | #define smp_mb__after_atomic() smp_mb() | ||
71 | #endif | ||
72 | |||
65 | #define smp_store_release(p, v) \ | 73 | #define smp_store_release(p, v) \ |
66 | do { \ | 74 | do { \ |
67 | compiletime_assert_atomic_type(*p); \ | 75 | compiletime_assert_atomic_type(*p); \ |
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index 280ca7a96f75..dcdcacf2fd2b 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h | |||
@@ -11,14 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/irqflags.h> | 12 | #include <linux/irqflags.h> |
13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
14 | 14 | #include <asm/barrier.h> | |
15 | /* | ||
16 | * clear_bit may not imply a memory barrier | ||
17 | */ | ||
18 | #ifndef smp_mb__before_clear_bit | ||
19 | #define smp_mb__before_clear_bit() smp_mb() | ||
20 | #define smp_mb__after_clear_bit() smp_mb() | ||
21 | #endif | ||
22 | 15 | ||
23 | #include <asm-generic/bitops/__ffs.h> | 16 | #include <asm-generic/bitops/__ffs.h> |
24 | #include <asm-generic/bitops/ffz.h> | 17 | #include <asm-generic/bitops/ffz.h> |
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h index 9ae6c34dc191..49673510b484 100644 --- a/include/asm-generic/bitops/atomic.h +++ b/include/asm-generic/bitops/atomic.h | |||
@@ -80,7 +80,7 @@ static inline void set_bit(int nr, volatile unsigned long *addr) | |||
80 | * | 80 | * |
81 | * clear_bit() is atomic and may not be reordered. However, it does | 81 | * clear_bit() is atomic and may not be reordered. However, it does |
82 | * not contain a memory barrier, so if it is used for locking purposes, | 82 | * not contain a memory barrier, so if it is used for locking purposes, |
83 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 83 | * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() |
84 | * in order to ensure changes are visible on other processors. | 84 | * in order to ensure changes are visible on other processors. |
85 | */ | 85 | */ |
86 | static inline void clear_bit(int nr, volatile unsigned long *addr) | 86 | static inline void clear_bit(int nr, volatile unsigned long *addr) |
diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h index 308a9e22c802..c30266e94806 100644 --- a/include/asm-generic/bitops/lock.h +++ b/include/asm-generic/bitops/lock.h | |||
@@ -20,7 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | #define clear_bit_unlock(nr, addr) \ | 21 | #define clear_bit_unlock(nr, addr) \ |
22 | do { \ | 22 | do { \ |
23 | smp_mb__before_clear_bit(); \ | 23 | smp_mb__before_atomic(); \ |
24 | clear_bit(nr, addr); \ | 24 | clear_bit(nr, addr); \ |
25 | } while (0) | 25 | } while (0) |
26 | 26 | ||
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 5b08a8540ecf..fef3a809e7cf 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
@@ -3,6 +3,42 @@ | |||
3 | #define _LINUX_ATOMIC_H | 3 | #define _LINUX_ATOMIC_H |
4 | #include <asm/atomic.h> | 4 | #include <asm/atomic.h> |
5 | 5 | ||
6 | /* | ||
7 | * Provide __deprecated wrappers for the new interface, avoid flag day changes. | ||
8 | * We need the ugly external functions to break header recursion hell. | ||
9 | */ | ||
10 | #ifndef smp_mb__before_atomic_inc | ||
11 | static inline void __deprecated smp_mb__before_atomic_inc(void) | ||
12 | { | ||
13 | extern void __smp_mb__before_atomic(void); | ||
14 | __smp_mb__before_atomic(); | ||
15 | } | ||
16 | #endif | ||
17 | |||
18 | #ifndef smp_mb__after_atomic_inc | ||
19 | static inline void __deprecated smp_mb__after_atomic_inc(void) | ||
20 | { | ||
21 | extern void __smp_mb__after_atomic(void); | ||
22 | __smp_mb__after_atomic(); | ||
23 | } | ||
24 | #endif | ||
25 | |||
26 | #ifndef smp_mb__before_atomic_dec | ||
27 | static inline void __deprecated smp_mb__before_atomic_dec(void) | ||
28 | { | ||
29 | extern void __smp_mb__before_atomic(void); | ||
30 | __smp_mb__before_atomic(); | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | #ifndef smp_mb__after_atomic_dec | ||
35 | static inline void __deprecated smp_mb__after_atomic_dec(void) | ||
36 | { | ||
37 | extern void __smp_mb__after_atomic(void); | ||
38 | __smp_mb__after_atomic(); | ||
39 | } | ||
40 | #endif | ||
41 | |||
6 | /** | 42 | /** |
7 | * atomic_add_unless - add unless the number is already a given value | 43 | * atomic_add_unless - add unless the number is already a given value |
8 | * @v: pointer of type atomic_t | 44 | * @v: pointer of type atomic_t |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index be5fd38bd5a0..cbc5833fb221 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -32,6 +32,26 @@ extern unsigned long __sw_hweight64(__u64 w); | |||
32 | */ | 32 | */ |
33 | #include <asm/bitops.h> | 33 | #include <asm/bitops.h> |
34 | 34 | ||
35 | /* | ||
36 | * Provide __deprecated wrappers for the new interface, avoid flag day changes. | ||
37 | * We need the ugly external functions to break header recursion hell. | ||
38 | */ | ||
39 | #ifndef smp_mb__before_clear_bit | ||
40 | static inline void __deprecated smp_mb__before_clear_bit(void) | ||
41 | { | ||
42 | extern void __smp_mb__before_atomic(void); | ||
43 | __smp_mb__before_atomic(); | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | #ifndef smp_mb__after_clear_bit | ||
48 | static inline void __deprecated smp_mb__after_clear_bit(void) | ||
49 | { | ||
50 | extern void __smp_mb__after_atomic(void); | ||
51 | __smp_mb__after_atomic(); | ||
52 | } | ||
53 | #endif | ||
54 | |||
35 | #define for_each_set_bit(bit, addr, size) \ | 55 | #define for_each_set_bit(bit, addr, size) \ |
36 | for ((bit) = find_first_bit((addr), (size)); \ | 56 | for ((bit) = find_first_bit((addr), (size)); \ |
37 | (bit) < (size); \ | 57 | (bit) < (size); \ |
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index c40302f909ce..7cbf837a279c 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -278,7 +278,7 @@ static inline void get_bh(struct buffer_head *bh) | |||
278 | 278 | ||
279 | static inline void put_bh(struct buffer_head *bh) | 279 | static inline void put_bh(struct buffer_head *bh) |
280 | { | 280 | { |
281 | smp_mb__before_atomic_dec(); | 281 | smp_mb__before_atomic(); |
282 | atomic_dec(&bh->b_count); | 282 | atomic_dec(&bh->b_count); |
283 | } | 283 | } |
284 | 284 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 9f3c275e053e..ec274e0f4ed2 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -649,7 +649,7 @@ static inline void hd_ref_init(struct hd_struct *part) | |||
649 | static inline void hd_struct_get(struct hd_struct *part) | 649 | static inline void hd_struct_get(struct hd_struct *part) |
650 | { | 650 | { |
651 | atomic_inc(&part->ref); | 651 | atomic_inc(&part->ref); |
652 | smp_mb__after_atomic_inc(); | 652 | smp_mb__after_atomic(); |
653 | } | 653 | } |
654 | 654 | ||
655 | static inline int hd_struct_try_get(struct hd_struct *part) | 655 | static inline int hd_struct_try_get(struct hd_struct *part) |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 051c85032f48..cb19f09d7e3e 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -491,7 +491,7 @@ static inline int tasklet_trylock(struct tasklet_struct *t) | |||
491 | 491 | ||
492 | static inline void tasklet_unlock(struct tasklet_struct *t) | 492 | static inline void tasklet_unlock(struct tasklet_struct *t) |
493 | { | 493 | { |
494 | smp_mb__before_clear_bit(); | 494 | smp_mb__before_atomic(); |
495 | clear_bit(TASKLET_STATE_RUN, &(t)->state); | 495 | clear_bit(TASKLET_STATE_RUN, &(t)->state); |
496 | } | 496 | } |
497 | 497 | ||
@@ -539,7 +539,7 @@ static inline void tasklet_hi_schedule_first(struct tasklet_struct *t) | |||
539 | static inline void tasklet_disable_nosync(struct tasklet_struct *t) | 539 | static inline void tasklet_disable_nosync(struct tasklet_struct *t) |
540 | { | 540 | { |
541 | atomic_inc(&t->count); | 541 | atomic_inc(&t->count); |
542 | smp_mb__after_atomic_inc(); | 542 | smp_mb__after_atomic(); |
543 | } | 543 | } |
544 | 544 | ||
545 | static inline void tasklet_disable(struct tasklet_struct *t) | 545 | static inline void tasklet_disable(struct tasklet_struct *t) |
@@ -551,13 +551,13 @@ static inline void tasklet_disable(struct tasklet_struct *t) | |||
551 | 551 | ||
552 | static inline void tasklet_enable(struct tasklet_struct *t) | 552 | static inline void tasklet_enable(struct tasklet_struct *t) |
553 | { | 553 | { |
554 | smp_mb__before_atomic_dec(); | 554 | smp_mb__before_atomic(); |
555 | atomic_dec(&t->count); | 555 | atomic_dec(&t->count); |
556 | } | 556 | } |
557 | 557 | ||
558 | static inline void tasklet_hi_enable(struct tasklet_struct *t) | 558 | static inline void tasklet_hi_enable(struct tasklet_struct *t) |
559 | { | 559 | { |
560 | smp_mb__before_atomic_dec(); | 560 | smp_mb__before_atomic(); |
561 | atomic_dec(&t->count); | 561 | atomic_dec(&t->count); |
562 | } | 562 | } |
563 | 563 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b42d07b0390b..6c1ae9fd9505 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -493,7 +493,7 @@ static inline void napi_disable(struct napi_struct *n) | |||
493 | static inline void napi_enable(struct napi_struct *n) | 493 | static inline void napi_enable(struct napi_struct *n) |
494 | { | 494 | { |
495 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); | 495 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); |
496 | smp_mb__before_clear_bit(); | 496 | smp_mb__before_atomic(); |
497 | clear_bit(NAPI_STATE_SCHED, &n->state); | 497 | clear_bit(NAPI_STATE_SCHED, &n->state); |
498 | } | 498 | } |
499 | 499 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 221b2bde3723..4dce5d844b74 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2785,10 +2785,8 @@ static inline bool __must_check current_set_polling_and_test(void) | |||
2785 | /* | 2785 | /* |
2786 | * Polling state must be visible before we test NEED_RESCHED, | 2786 | * Polling state must be visible before we test NEED_RESCHED, |
2787 | * paired by resched_task() | 2787 | * paired by resched_task() |
2788 | * | ||
2789 | * XXX: assumes set/clear bit are identical barrier wise. | ||
2790 | */ | 2788 | */ |
2791 | smp_mb__after_clear_bit(); | 2789 | smp_mb__after_atomic(); |
2792 | 2790 | ||
2793 | return unlikely(tif_need_resched()); | 2791 | return unlikely(tif_need_resched()); |
2794 | } | 2792 | } |
@@ -2806,7 +2804,7 @@ static inline bool __must_check current_clr_polling_and_test(void) | |||
2806 | * Polling state must be visible before we test NEED_RESCHED, | 2804 | * Polling state must be visible before we test NEED_RESCHED, |
2807 | * paired by resched_task() | 2805 | * paired by resched_task() |
2808 | */ | 2806 | */ |
2809 | smp_mb__after_clear_bit(); | 2807 | smp_mb__after_atomic(); |
2810 | 2808 | ||
2811 | return unlikely(tif_need_resched()); | 2809 | return unlikely(tif_need_resched()); |
2812 | } | 2810 | } |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 3a847de83fab..ad7dbe2cfecd 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -142,18 +142,18 @@ struct rpc_task_setup { | |||
142 | test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) | 142 | test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) |
143 | #define rpc_clear_running(t) \ | 143 | #define rpc_clear_running(t) \ |
144 | do { \ | 144 | do { \ |
145 | smp_mb__before_clear_bit(); \ | 145 | smp_mb__before_atomic(); \ |
146 | clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ | 146 | clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ |
147 | smp_mb__after_clear_bit(); \ | 147 | smp_mb__after_atomic(); \ |
148 | } while (0) | 148 | } while (0) |
149 | 149 | ||
150 | #define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) | 150 | #define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) |
151 | #define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) | 151 | #define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) |
152 | #define rpc_clear_queued(t) \ | 152 | #define rpc_clear_queued(t) \ |
153 | do { \ | 153 | do { \ |
154 | smp_mb__before_clear_bit(); \ | 154 | smp_mb__before_atomic(); \ |
155 | clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ | 155 | clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ |
156 | smp_mb__after_clear_bit(); \ | 156 | smp_mb__after_atomic(); \ |
157 | } while (0) | 157 | } while (0) |
158 | 158 | ||
159 | #define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) | 159 | #define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 3e5efb2b236e..3876f0f1dfd3 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -379,9 +379,9 @@ static inline int xprt_test_and_clear_connected(struct rpc_xprt *xprt) | |||
379 | 379 | ||
380 | static inline void xprt_clear_connecting(struct rpc_xprt *xprt) | 380 | static inline void xprt_clear_connecting(struct rpc_xprt *xprt) |
381 | { | 381 | { |
382 | smp_mb__before_clear_bit(); | 382 | smp_mb__before_atomic(); |
383 | clear_bit(XPRT_CONNECTING, &xprt->state); | 383 | clear_bit(XPRT_CONNECTING, &xprt->state); |
384 | smp_mb__after_clear_bit(); | 384 | smp_mb__after_atomic(); |
385 | } | 385 | } |
386 | 386 | ||
387 | static inline int xprt_connecting(struct rpc_xprt *xprt) | 387 | static inline int xprt_connecting(struct rpc_xprt *xprt) |
@@ -411,9 +411,9 @@ static inline void xprt_clear_bound(struct rpc_xprt *xprt) | |||
411 | 411 | ||
412 | static inline void xprt_clear_binding(struct rpc_xprt *xprt) | 412 | static inline void xprt_clear_binding(struct rpc_xprt *xprt) |
413 | { | 413 | { |
414 | smp_mb__before_clear_bit(); | 414 | smp_mb__before_atomic(); |
415 | clear_bit(XPRT_BINDING, &xprt->state); | 415 | clear_bit(XPRT_BINDING, &xprt->state); |
416 | smp_mb__after_clear_bit(); | 416 | smp_mb__after_atomic(); |
417 | } | 417 | } |
418 | 418 | ||
419 | static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) | 419 | static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 1e98b5530425..6f8ab7da27c4 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -191,7 +191,7 @@ static inline void tracehook_notify_resume(struct pt_regs *regs) | |||
191 | * pairs with task_work_add()->set_notify_resume() after | 191 | * pairs with task_work_add()->set_notify_resume() after |
192 | * hlist_add_head(task->task_works); | 192 | * hlist_add_head(task->task_works); |
193 | */ | 193 | */ |
194 | smp_mb__after_clear_bit(); | 194 | smp_mb__after_atomic(); |
195 | if (unlikely(current->task_works)) | 195 | if (unlikely(current->task_works)) |
196 | task_work_run(); | 196 | task_work_run(); |
197 | } | 197 | } |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 5679d927562b..624a8a54806d 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -1204,7 +1204,7 @@ static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp) | |||
1204 | /* put back the conn without restarting its timer */ | 1204 | /* put back the conn without restarting its timer */ |
1205 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | 1205 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
1206 | { | 1206 | { |
1207 | smp_mb__before_atomic_dec(); | 1207 | smp_mb__before_atomic(); |
1208 | atomic_dec(&cp->refcnt); | 1208 | atomic_dec(&cp->refcnt); |
1209 | } | 1209 | } |
1210 | void ip_vs_conn_put(struct ip_vs_conn *cp); | 1210 | void ip_vs_conn_put(struct ip_vs_conn *cp); |
@@ -1408,7 +1408,7 @@ static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) | |||
1408 | 1408 | ||
1409 | static inline void ip_vs_dest_put(struct ip_vs_dest *dest) | 1409 | static inline void ip_vs_dest_put(struct ip_vs_dest *dest) |
1410 | { | 1410 | { |
1411 | smp_mb__before_atomic_dec(); | 1411 | smp_mb__before_atomic(); |
1412 | atomic_dec(&dest->refcnt); | 1412 | atomic_dec(&dest->refcnt); |
1413 | } | 1413 | } |
1414 | 1414 | ||
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 2956c8da1605..1adf62b39b96 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
@@ -534,7 +534,7 @@ return_normal: | |||
534 | kgdb_info[cpu].exception_state &= | 534 | kgdb_info[cpu].exception_state &= |
535 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); | 535 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); |
536 | kgdb_info[cpu].enter_kgdb--; | 536 | kgdb_info[cpu].enter_kgdb--; |
537 | smp_mb__before_atomic_dec(); | 537 | smp_mb__before_atomic(); |
538 | atomic_dec(&slaves_in_kgdb); | 538 | atomic_dec(&slaves_in_kgdb); |
539 | dbg_touch_watchdogs(); | 539 | dbg_touch_watchdogs(); |
540 | local_irq_restore(flags); | 540 | local_irq_restore(flags); |
@@ -662,7 +662,7 @@ kgdb_restore: | |||
662 | kgdb_info[cpu].exception_state &= | 662 | kgdb_info[cpu].exception_state &= |
663 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); | 663 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); |
664 | kgdb_info[cpu].enter_kgdb--; | 664 | kgdb_info[cpu].enter_kgdb--; |
665 | smp_mb__before_atomic_dec(); | 665 | smp_mb__before_atomic(); |
666 | atomic_dec(&masters_in_kgdb); | 666 | atomic_dec(&masters_in_kgdb); |
667 | /* Free kgdb_active */ | 667 | /* Free kgdb_active */ |
668 | atomic_set(&kgdb_active, -1); | 668 | atomic_set(&kgdb_active, -1); |
diff --git a/kernel/futex.c b/kernel/futex.c index 81dbe773ce4c..89bc9d59ac65 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -267,7 +267,7 @@ static inline void futex_get_mm(union futex_key *key) | |||
267 | * get_futex_key() implies a full barrier. This is relied upon | 267 | * get_futex_key() implies a full barrier. This is relied upon |
268 | * as full barrier (B), see the ordering comment above. | 268 | * as full barrier (B), see the ordering comment above. |
269 | */ | 269 | */ |
270 | smp_mb__after_atomic_inc(); | 270 | smp_mb__after_atomic(); |
271 | } | 271 | } |
272 | 272 | ||
273 | /* | 273 | /* |
@@ -280,7 +280,7 @@ static inline void hb_waiters_inc(struct futex_hash_bucket *hb) | |||
280 | /* | 280 | /* |
281 | * Full barrier (A), see the ordering comment above. | 281 | * Full barrier (A), see the ordering comment above. |
282 | */ | 282 | */ |
283 | smp_mb__after_atomic_inc(); | 283 | smp_mb__after_atomic(); |
284 | #endif | 284 | #endif |
285 | } | 285 | } |
286 | 286 | ||
diff --git a/kernel/kmod.c b/kernel/kmod.c index 6b375af4958d..0ac67a5861c5 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -498,7 +498,7 @@ int __usermodehelper_disable(enum umh_disable_depth depth) | |||
498 | static void helper_lock(void) | 498 | static void helper_lock(void) |
499 | { | 499 | { |
500 | atomic_inc(&running_helpers); | 500 | atomic_inc(&running_helpers); |
501 | smp_mb__after_atomic_inc(); | 501 | smp_mb__after_atomic(); |
502 | } | 502 | } |
503 | 503 | ||
504 | static void helper_unlock(void) | 504 | static void helper_unlock(void) |
diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h index 4f560cfedc8f..51c4b24b6328 100644 --- a/kernel/locking/lockdep_internals.h +++ b/kernel/locking/lockdep_internals.h | |||
@@ -54,9 +54,9 @@ enum { | |||
54 | * table (if it's not there yet), and we check it for lock order | 54 | * table (if it's not there yet), and we check it for lock order |
55 | * conflicts and deadlocks. | 55 | * conflicts and deadlocks. |
56 | */ | 56 | */ |
57 | #define MAX_LOCKDEP_ENTRIES 16384UL | 57 | #define MAX_LOCKDEP_ENTRIES 32768UL |
58 | 58 | ||
59 | #define MAX_LOCKDEP_CHAINS_BITS 15 | 59 | #define MAX_LOCKDEP_CHAINS_BITS 16 |
60 | #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS) | 60 | #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS) |
61 | 61 | ||
62 | #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5) | 62 | #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5) |
@@ -65,7 +65,7 @@ enum { | |||
65 | * Stack-trace: tightly packed array of stack backtrace | 65 | * Stack-trace: tightly packed array of stack backtrace |
66 | * addresses. Protected by the hash_lock. | 66 | * addresses. Protected by the hash_lock. |
67 | */ | 67 | */ |
68 | #define MAX_STACK_TRACE_ENTRIES 262144UL | 68 | #define MAX_STACK_TRACE_ENTRIES 524288UL |
69 | 69 | ||
70 | extern struct list_head all_lock_classes; | 70 | extern struct list_head all_lock_classes; |
71 | extern struct lock_chain lock_chains[]; | 71 | extern struct lock_chain lock_chains[]; |
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c index 1d66e08e897d..b4219ff87b8c 100644 --- a/kernel/locking/rwsem-xadd.c +++ b/kernel/locking/rwsem-xadd.c | |||
@@ -12,6 +12,55 @@ | |||
12 | #include <linux/export.h> | 12 | #include <linux/export.h> |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * Guide to the rw_semaphore's count field for common values. | ||
16 | * (32-bit case illustrated, similar for 64-bit) | ||
17 | * | ||
18 | * 0x0000000X (1) X readers active or attempting lock, no writer waiting | ||
19 | * X = #active_readers + #readers attempting to lock | ||
20 | * (X*ACTIVE_BIAS) | ||
21 | * | ||
22 | * 0x00000000 rwsem is unlocked, and no one is waiting for the lock or | ||
23 | * attempting to read lock or write lock. | ||
24 | * | ||
25 | * 0xffff000X (1) X readers active or attempting lock, with waiters for lock | ||
26 | * X = #active readers + # readers attempting lock | ||
27 | * (X*ACTIVE_BIAS + WAITING_BIAS) | ||
28 | * (2) 1 writer attempting lock, no waiters for lock | ||
29 | * X-1 = #active readers + #readers attempting lock | ||
30 | * ((X-1)*ACTIVE_BIAS + ACTIVE_WRITE_BIAS) | ||
31 | * (3) 1 writer active, no waiters for lock | ||
32 | * X-1 = #active readers + #readers attempting lock | ||
33 | * ((X-1)*ACTIVE_BIAS + ACTIVE_WRITE_BIAS) | ||
34 | * | ||
35 | * 0xffff0001 (1) 1 reader active or attempting lock, waiters for lock | ||
36 | * (WAITING_BIAS + ACTIVE_BIAS) | ||
37 | * (2) 1 writer active or attempting lock, no waiters for lock | ||
38 | * (ACTIVE_WRITE_BIAS) | ||
39 | * | ||
40 | * 0xffff0000 (1) There are writers or readers queued but none active | ||
41 | * or in the process of attempting lock. | ||
42 | * (WAITING_BIAS) | ||
43 | * Note: writer can attempt to steal lock for this count by adding | ||
44 | * ACTIVE_WRITE_BIAS in cmpxchg and checking the old count | ||
45 | * | ||
46 | * 0xfffe0001 (1) 1 writer active, or attempting lock. Waiters on queue. | ||
47 | * (ACTIVE_WRITE_BIAS + WAITING_BIAS) | ||
48 | * | ||
49 | * Note: Readers attempt to lock by adding ACTIVE_BIAS in down_read and checking | ||
50 | * the count becomes more than 0 for successful lock acquisition, | ||
51 | * i.e. the case where there are only readers or nobody has lock. | ||
52 | * (1st and 2nd case above). | ||
53 | * | ||
54 | * Writers attempt to lock by adding ACTIVE_WRITE_BIAS in down_write and | ||
55 | * checking the count becomes ACTIVE_WRITE_BIAS for successful lock | ||
56 | * acquisition (i.e. nobody else has lock or attempts lock). If | ||
57 | * unsuccessful, in rwsem_down_write_failed, we'll check to see if there | ||
58 | * are only waiters but none active (5th case above), and attempt to | ||
59 | * steal the lock. | ||
60 | * | ||
61 | */ | ||
62 | |||
63 | /* | ||
15 | * Initialize an rwsem: | 64 | * Initialize an rwsem: |
16 | */ | 65 | */ |
17 | void __init_rwsem(struct rw_semaphore *sem, const char *name, | 66 | void __init_rwsem(struct rw_semaphore *sem, const char *name, |
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 3e3f13e8b429..f1ba77363fbb 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -458,9 +458,9 @@ static void rcu_eqs_enter_common(struct rcu_dynticks *rdtp, long long oldval, | |||
458 | } | 458 | } |
459 | rcu_prepare_for_idle(smp_processor_id()); | 459 | rcu_prepare_for_idle(smp_processor_id()); |
460 | /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */ | 460 | /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */ |
461 | smp_mb__before_atomic_inc(); /* See above. */ | 461 | smp_mb__before_atomic(); /* See above. */ |
462 | atomic_inc(&rdtp->dynticks); | 462 | atomic_inc(&rdtp->dynticks); |
463 | smp_mb__after_atomic_inc(); /* Force ordering with next sojourn. */ | 463 | smp_mb__after_atomic(); /* Force ordering with next sojourn. */ |
464 | WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1); | 464 | WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1); |
465 | 465 | ||
466 | /* | 466 | /* |
@@ -578,10 +578,10 @@ void rcu_irq_exit(void) | |||
578 | static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval, | 578 | static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval, |
579 | int user) | 579 | int user) |
580 | { | 580 | { |
581 | smp_mb__before_atomic_inc(); /* Force ordering w/previous sojourn. */ | 581 | smp_mb__before_atomic(); /* Force ordering w/previous sojourn. */ |
582 | atomic_inc(&rdtp->dynticks); | 582 | atomic_inc(&rdtp->dynticks); |
583 | /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */ | 583 | /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */ |
584 | smp_mb__after_atomic_inc(); /* See above. */ | 584 | smp_mb__after_atomic(); /* See above. */ |
585 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); | 585 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); |
586 | rcu_cleanup_after_idle(smp_processor_id()); | 586 | rcu_cleanup_after_idle(smp_processor_id()); |
587 | trace_rcu_dyntick(TPS("End"), oldval, rdtp->dynticks_nesting); | 587 | trace_rcu_dyntick(TPS("End"), oldval, rdtp->dynticks_nesting); |
@@ -706,10 +706,10 @@ void rcu_nmi_enter(void) | |||
706 | (atomic_read(&rdtp->dynticks) & 0x1)) | 706 | (atomic_read(&rdtp->dynticks) & 0x1)) |
707 | return; | 707 | return; |
708 | rdtp->dynticks_nmi_nesting++; | 708 | rdtp->dynticks_nmi_nesting++; |
709 | smp_mb__before_atomic_inc(); /* Force delay from prior write. */ | 709 | smp_mb__before_atomic(); /* Force delay from prior write. */ |
710 | atomic_inc(&rdtp->dynticks); | 710 | atomic_inc(&rdtp->dynticks); |
711 | /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */ | 711 | /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */ |
712 | smp_mb__after_atomic_inc(); /* See above. */ | 712 | smp_mb__after_atomic(); /* See above. */ |
713 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); | 713 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); |
714 | } | 714 | } |
715 | 715 | ||
@@ -728,9 +728,9 @@ void rcu_nmi_exit(void) | |||
728 | --rdtp->dynticks_nmi_nesting != 0) | 728 | --rdtp->dynticks_nmi_nesting != 0) |
729 | return; | 729 | return; |
730 | /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */ | 730 | /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */ |
731 | smp_mb__before_atomic_inc(); /* See above. */ | 731 | smp_mb__before_atomic(); /* See above. */ |
732 | atomic_inc(&rdtp->dynticks); | 732 | atomic_inc(&rdtp->dynticks); |
733 | smp_mb__after_atomic_inc(); /* Force delay to next write. */ | 733 | smp_mb__after_atomic(); /* Force delay to next write. */ |
734 | WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1); | 734 | WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1); |
735 | } | 735 | } |
736 | 736 | ||
@@ -2918,7 +2918,7 @@ void synchronize_sched_expedited(void) | |||
2918 | s = atomic_long_read(&rsp->expedited_done); | 2918 | s = atomic_long_read(&rsp->expedited_done); |
2919 | if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) { | 2919 | if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) { |
2920 | /* ensure test happens before caller kfree */ | 2920 | /* ensure test happens before caller kfree */ |
2921 | smp_mb__before_atomic_inc(); /* ^^^ */ | 2921 | smp_mb__before_atomic(); /* ^^^ */ |
2922 | atomic_long_inc(&rsp->expedited_workdone1); | 2922 | atomic_long_inc(&rsp->expedited_workdone1); |
2923 | return; | 2923 | return; |
2924 | } | 2924 | } |
@@ -2936,7 +2936,7 @@ void synchronize_sched_expedited(void) | |||
2936 | s = atomic_long_read(&rsp->expedited_done); | 2936 | s = atomic_long_read(&rsp->expedited_done); |
2937 | if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) { | 2937 | if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) { |
2938 | /* ensure test happens before caller kfree */ | 2938 | /* ensure test happens before caller kfree */ |
2939 | smp_mb__before_atomic_inc(); /* ^^^ */ | 2939 | smp_mb__before_atomic(); /* ^^^ */ |
2940 | atomic_long_inc(&rsp->expedited_workdone2); | 2940 | atomic_long_inc(&rsp->expedited_workdone2); |
2941 | return; | 2941 | return; |
2942 | } | 2942 | } |
@@ -2965,7 +2965,7 @@ void synchronize_sched_expedited(void) | |||
2965 | s = atomic_long_read(&rsp->expedited_done); | 2965 | s = atomic_long_read(&rsp->expedited_done); |
2966 | if (ULONG_CMP_GE((ulong)s, (ulong)snap)) { | 2966 | if (ULONG_CMP_GE((ulong)s, (ulong)snap)) { |
2967 | /* ensure test happens before caller kfree */ | 2967 | /* ensure test happens before caller kfree */ |
2968 | smp_mb__before_atomic_inc(); /* ^^^ */ | 2968 | smp_mb__before_atomic(); /* ^^^ */ |
2969 | atomic_long_inc(&rsp->expedited_done_lost); | 2969 | atomic_long_inc(&rsp->expedited_done_lost); |
2970 | break; | 2970 | break; |
2971 | } | 2971 | } |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 29977ae84e7e..cbc2c45265e2 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -2462,9 +2462,9 @@ static void rcu_sysidle_enter(struct rcu_dynticks *rdtp, int irq) | |||
2462 | /* Record start of fully idle period. */ | 2462 | /* Record start of fully idle period. */ |
2463 | j = jiffies; | 2463 | j = jiffies; |
2464 | ACCESS_ONCE(rdtp->dynticks_idle_jiffies) = j; | 2464 | ACCESS_ONCE(rdtp->dynticks_idle_jiffies) = j; |
2465 | smp_mb__before_atomic_inc(); | 2465 | smp_mb__before_atomic(); |
2466 | atomic_inc(&rdtp->dynticks_idle); | 2466 | atomic_inc(&rdtp->dynticks_idle); |
2467 | smp_mb__after_atomic_inc(); | 2467 | smp_mb__after_atomic(); |
2468 | WARN_ON_ONCE(atomic_read(&rdtp->dynticks_idle) & 0x1); | 2468 | WARN_ON_ONCE(atomic_read(&rdtp->dynticks_idle) & 0x1); |
2469 | } | 2469 | } |
2470 | 2470 | ||
@@ -2529,9 +2529,9 @@ static void rcu_sysidle_exit(struct rcu_dynticks *rdtp, int irq) | |||
2529 | } | 2529 | } |
2530 | 2530 | ||
2531 | /* Record end of idle period. */ | 2531 | /* Record end of idle period. */ |
2532 | smp_mb__before_atomic_inc(); | 2532 | smp_mb__before_atomic(); |
2533 | atomic_inc(&rdtp->dynticks_idle); | 2533 | atomic_inc(&rdtp->dynticks_idle); |
2534 | smp_mb__after_atomic_inc(); | 2534 | smp_mb__after_atomic(); |
2535 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks_idle) & 0x1)); | 2535 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks_idle) & 0x1)); |
2536 | 2536 | ||
2537 | /* | 2537 | /* |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 71d9a9c93954..a62a7dec3986 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -90,6 +90,22 @@ | |||
90 | #define CREATE_TRACE_POINTS | 90 | #define CREATE_TRACE_POINTS |
91 | #include <trace/events/sched.h> | 91 | #include <trace/events/sched.h> |
92 | 92 | ||
93 | #ifdef smp_mb__before_atomic | ||
94 | void __smp_mb__before_atomic(void) | ||
95 | { | ||
96 | smp_mb__before_atomic(); | ||
97 | } | ||
98 | EXPORT_SYMBOL(__smp_mb__before_atomic); | ||
99 | #endif | ||
100 | |||
101 | #ifdef smp_mb__after_atomic | ||
102 | void __smp_mb__after_atomic(void) | ||
103 | { | ||
104 | smp_mb__after_atomic(); | ||
105 | } | ||
106 | EXPORT_SYMBOL(__smp_mb__after_atomic); | ||
107 | #endif | ||
108 | |||
93 | void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period) | 109 | void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period) |
94 | { | 110 | { |
95 | unsigned long delta; | 111 | unsigned long delta; |
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c index 8834243abee2..981fcd7dc394 100644 --- a/kernel/sched/cpupri.c +++ b/kernel/sched/cpupri.c | |||
@@ -165,7 +165,7 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) | |||
165 | * do a write memory barrier, and then update the count, to | 165 | * do a write memory barrier, and then update the count, to |
166 | * make sure the vector is visible when count is set. | 166 | * make sure the vector is visible when count is set. |
167 | */ | 167 | */ |
168 | smp_mb__before_atomic_inc(); | 168 | smp_mb__before_atomic(); |
169 | atomic_inc(&(vec)->count); | 169 | atomic_inc(&(vec)->count); |
170 | do_mb = 1; | 170 | do_mb = 1; |
171 | } | 171 | } |
@@ -185,14 +185,14 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) | |||
185 | * the new priority vec. | 185 | * the new priority vec. |
186 | */ | 186 | */ |
187 | if (do_mb) | 187 | if (do_mb) |
188 | smp_mb__after_atomic_inc(); | 188 | smp_mb__after_atomic(); |
189 | 189 | ||
190 | /* | 190 | /* |
191 | * When removing from the vector, we decrement the counter first | 191 | * When removing from the vector, we decrement the counter first |
192 | * do a memory barrier and then clear the mask. | 192 | * do a memory barrier and then clear the mask. |
193 | */ | 193 | */ |
194 | atomic_dec(&(vec)->count); | 194 | atomic_dec(&(vec)->count); |
195 | smp_mb__after_atomic_inc(); | 195 | smp_mb__after_atomic(); |
196 | cpumask_clear_cpu(cpu, vec->mask); | 196 | cpumask_clear_cpu(cpu, vec->mask); |
197 | } | 197 | } |
198 | 198 | ||
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index 7d50f794e248..0ffa20ae657b 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c | |||
@@ -394,7 +394,7 @@ EXPORT_SYMBOL(__wake_up_bit); | |||
394 | * | 394 | * |
395 | * In order for this to function properly, as it uses waitqueue_active() | 395 | * In order for this to function properly, as it uses waitqueue_active() |
396 | * internally, some kind of memory barrier must be done prior to calling | 396 | * internally, some kind of memory barrier must be done prior to calling |
397 | * this. Typically, this will be smp_mb__after_clear_bit(), but in some | 397 | * this. Typically, this will be smp_mb__after_atomic(), but in some |
398 | * cases where bitflags are manipulated non-atomically under a lock, one | 398 | * cases where bitflags are manipulated non-atomically under a lock, one |
399 | * may need to use a less regular barrier, such fs/inode.c's smp_mb(), | 399 | * may need to use a less regular barrier, such fs/inode.c's smp_mb(), |
400 | * because spin_unlock() does not guarantee a memory barrier. | 400 | * because spin_unlock() does not guarantee a memory barrier. |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 09d9591b7708..1706cbbdf5f0 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -557,7 +557,7 @@ void clear_bdi_congested(struct backing_dev_info *bdi, int sync) | |||
557 | bit = sync ? BDI_sync_congested : BDI_async_congested; | 557 | bit = sync ? BDI_sync_congested : BDI_async_congested; |
558 | if (test_and_clear_bit(bit, &bdi->state)) | 558 | if (test_and_clear_bit(bit, &bdi->state)) |
559 | atomic_dec(&nr_bdi_congested[sync]); | 559 | atomic_dec(&nr_bdi_congested[sync]); |
560 | smp_mb__after_clear_bit(); | 560 | smp_mb__after_atomic(); |
561 | if (waitqueue_active(wqh)) | 561 | if (waitqueue_active(wqh)) |
562 | wake_up(wqh); | 562 | wake_up(wqh); |
563 | } | 563 | } |
diff --git a/mm/filemap.c b/mm/filemap.c index 088358c8006b..021056c324e6 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -742,7 +742,7 @@ void unlock_page(struct page *page) | |||
742 | { | 742 | { |
743 | VM_BUG_ON_PAGE(!PageLocked(page), page); | 743 | VM_BUG_ON_PAGE(!PageLocked(page), page); |
744 | clear_bit_unlock(PG_locked, &page->flags); | 744 | clear_bit_unlock(PG_locked, &page->flags); |
745 | smp_mb__after_clear_bit(); | 745 | smp_mb__after_atomic(); |
746 | wake_up_page(page, PG_locked); | 746 | wake_up_page(page, PG_locked); |
747 | } | 747 | } |
748 | EXPORT_SYMBOL(unlock_page); | 748 | EXPORT_SYMBOL(unlock_page); |
@@ -759,7 +759,7 @@ void end_page_writeback(struct page *page) | |||
759 | if (!test_clear_page_writeback(page)) | 759 | if (!test_clear_page_writeback(page)) |
760 | BUG(); | 760 | BUG(); |
761 | 761 | ||
762 | smp_mb__after_clear_bit(); | 762 | smp_mb__after_atomic(); |
763 | wake_up_page(page, PG_writeback); | 763 | wake_up_page(page, PG_writeback); |
764 | } | 764 | } |
765 | EXPORT_SYMBOL(end_page_writeback); | 765 | EXPORT_SYMBOL(end_page_writeback); |
diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c index 8c93267ce969..c4e09846d1de 100644 --- a/net/atm/pppoatm.c +++ b/net/atm/pppoatm.c | |||
@@ -252,7 +252,7 @@ static int pppoatm_may_send(struct pppoatm_vcc *pvcc, int size) | |||
252 | * we need to ensure there's a memory barrier after it. The bit | 252 | * we need to ensure there's a memory barrier after it. The bit |
253 | * *must* be set before we do the atomic_inc() on pvcc->inflight. | 253 | * *must* be set before we do the atomic_inc() on pvcc->inflight. |
254 | * There's no smp_mb__after_set_bit(), so it's this or abuse | 254 | * There's no smp_mb__after_set_bit(), so it's this or abuse |
255 | * smp_mb__after_clear_bit(). | 255 | * smp_mb__after_atomic(). |
256 | */ | 256 | */ |
257 | test_and_set_bit(BLOCKED, &pvcc->blocked); | 257 | test_and_set_bit(BLOCKED, &pvcc->blocked); |
258 | 258 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 15010a230b6d..682f33a38366 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -45,7 +45,7 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) | |||
45 | return; | 45 | return; |
46 | 46 | ||
47 | clear_bit(HCI_INQUIRY, &hdev->flags); | 47 | clear_bit(HCI_INQUIRY, &hdev->flags); |
48 | smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */ | 48 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ |
49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); | 49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); |
50 | 50 | ||
51 | hci_conn_check_pending(hdev); | 51 | hci_conn_check_pending(hdev); |
@@ -1768,7 +1768,7 @@ static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
1768 | if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) | 1768 | if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) |
1769 | return; | 1769 | return; |
1770 | 1770 | ||
1771 | smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */ | 1771 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ |
1772 | wake_up_bit(&hdev->flags, HCI_INQUIRY); | 1772 | wake_up_bit(&hdev->flags, HCI_INQUIRY); |
1773 | 1773 | ||
1774 | if (!test_bit(HCI_MGMT, &hdev->dev_flags)) | 1774 | if (!test_bit(HCI_MGMT, &hdev->dev_flags)) |
diff --git a/net/core/dev.c b/net/core/dev.c index 9abc503b19b7..8b07db37dc10 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1326,7 +1326,7 @@ static int __dev_close_many(struct list_head *head) | |||
1326 | * dev->stop() will invoke napi_disable() on all of it's | 1326 | * dev->stop() will invoke napi_disable() on all of it's |
1327 | * napi_struct instances on this device. | 1327 | * napi_struct instances on this device. |
1328 | */ | 1328 | */ |
1329 | smp_mb__after_clear_bit(); /* Commit netif_running(). */ | 1329 | smp_mb__after_atomic(); /* Commit netif_running(). */ |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | dev_deactivate_many(head); | 1332 | dev_deactivate_many(head); |
@@ -3341,7 +3341,7 @@ static void net_tx_action(struct softirq_action *h) | |||
3341 | 3341 | ||
3342 | root_lock = qdisc_lock(q); | 3342 | root_lock = qdisc_lock(q); |
3343 | if (spin_trylock(root_lock)) { | 3343 | if (spin_trylock(root_lock)) { |
3344 | smp_mb__before_clear_bit(); | 3344 | smp_mb__before_atomic(); |
3345 | clear_bit(__QDISC_STATE_SCHED, | 3345 | clear_bit(__QDISC_STATE_SCHED, |
3346 | &q->state); | 3346 | &q->state); |
3347 | qdisc_run(q); | 3347 | qdisc_run(q); |
@@ -3351,7 +3351,7 @@ static void net_tx_action(struct softirq_action *h) | |||
3351 | &q->state)) { | 3351 | &q->state)) { |
3352 | __netif_reschedule(q); | 3352 | __netif_reschedule(q); |
3353 | } else { | 3353 | } else { |
3354 | smp_mb__before_clear_bit(); | 3354 | smp_mb__before_atomic(); |
3355 | clear_bit(__QDISC_STATE_SCHED, | 3355 | clear_bit(__QDISC_STATE_SCHED, |
3356 | &q->state); | 3356 | &q->state); |
3357 | } | 3357 | } |
@@ -4243,7 +4243,7 @@ void __napi_complete(struct napi_struct *n) | |||
4243 | BUG_ON(n->gro_list); | 4243 | BUG_ON(n->gro_list); |
4244 | 4244 | ||
4245 | list_del(&n->poll_list); | 4245 | list_del(&n->poll_list); |
4246 | smp_mb__before_clear_bit(); | 4246 | smp_mb__before_atomic(); |
4247 | clear_bit(NAPI_STATE_SCHED, &n->state); | 4247 | clear_bit(NAPI_STATE_SCHED, &n->state); |
4248 | } | 4248 | } |
4249 | EXPORT_SYMBOL(__napi_complete); | 4249 | EXPORT_SYMBOL(__napi_complete); |
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 9c3a839322ba..bd0767e6b2b3 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c | |||
@@ -147,7 +147,7 @@ static void linkwatch_do_dev(struct net_device *dev) | |||
147 | * Make sure the above read is complete since it can be | 147 | * Make sure the above read is complete since it can be |
148 | * rewritten as soon as we clear the bit below. | 148 | * rewritten as soon as we clear the bit below. |
149 | */ | 149 | */ |
150 | smp_mb__before_clear_bit(); | 150 | smp_mb__before_atomic(); |
151 | 151 | ||
152 | /* We are about to handle this device, | 152 | /* We are about to handle this device, |
153 | * so new events can be accepted | 153 | * so new events can be accepted |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 48f424465112..56cd458a1b8c 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -522,7 +522,7 @@ EXPORT_SYMBOL_GPL(inet_getpeer); | |||
522 | void inet_putpeer(struct inet_peer *p) | 522 | void inet_putpeer(struct inet_peer *p) |
523 | { | 523 | { |
524 | p->dtime = (__u32)jiffies; | 524 | p->dtime = (__u32)jiffies; |
525 | smp_mb__before_atomic_dec(); | 525 | smp_mb__before_atomic(); |
526 | atomic_dec(&p->refcnt); | 526 | atomic_dec(&p->refcnt); |
527 | } | 527 | } |
528 | EXPORT_SYMBOL_GPL(inet_putpeer); | 528 | EXPORT_SYMBOL_GPL(inet_putpeer); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 12d6016bdd9a..2d340bd2cd3d 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1930,10 +1930,8 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, | |||
1930 | /* It is possible TX completion already happened | 1930 | /* It is possible TX completion already happened |
1931 | * before we set TSQ_THROTTLED, so we must | 1931 | * before we set TSQ_THROTTLED, so we must |
1932 | * test again the condition. | 1932 | * test again the condition. |
1933 | * We abuse smp_mb__after_clear_bit() because | ||
1934 | * there is no smp_mb__after_set_bit() yet | ||
1935 | */ | 1933 | */ |
1936 | smp_mb__after_clear_bit(); | 1934 | smp_mb__after_atomic(); |
1937 | if (atomic_read(&sk->sk_wmem_alloc) > limit) | 1935 | if (atomic_read(&sk->sk_wmem_alloc) > limit) |
1938 | break; | 1936 | break; |
1939 | } | 1937 | } |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 75421f2ba8be..1f4f954c4b47 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -914,7 +914,7 @@ void nf_conntrack_free(struct nf_conn *ct) | |||
914 | nf_ct_ext_destroy(ct); | 914 | nf_ct_ext_destroy(ct); |
915 | nf_ct_ext_free(ct); | 915 | nf_ct_ext_free(ct); |
916 | kmem_cache_free(net->ct.nf_conntrack_cachep, ct); | 916 | kmem_cache_free(net->ct.nf_conntrack_cachep, ct); |
917 | smp_mb__before_atomic_dec(); | 917 | smp_mb__before_atomic(); |
918 | atomic_dec(&net->ct.count); | 918 | atomic_dec(&net->ct.count); |
919 | } | 919 | } |
920 | EXPORT_SYMBOL_GPL(nf_conntrack_free); | 920 | EXPORT_SYMBOL_GPL(nf_conntrack_free); |
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index b7ebe23cdedf..d67de453c35a 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c | |||
@@ -598,7 +598,7 @@ static void rds_ib_set_ack(struct rds_ib_connection *ic, u64 seq, | |||
598 | { | 598 | { |
599 | atomic64_set(&ic->i_ack_next, seq); | 599 | atomic64_set(&ic->i_ack_next, seq); |
600 | if (ack_required) { | 600 | if (ack_required) { |
601 | smp_mb__before_clear_bit(); | 601 | smp_mb__before_atomic(); |
602 | set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); | 602 | set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); |
603 | } | 603 | } |
604 | } | 604 | } |
@@ -606,7 +606,7 @@ static void rds_ib_set_ack(struct rds_ib_connection *ic, u64 seq, | |||
606 | static u64 rds_ib_get_ack(struct rds_ib_connection *ic) | 606 | static u64 rds_ib_get_ack(struct rds_ib_connection *ic) |
607 | { | 607 | { |
608 | clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); | 608 | clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); |
609 | smp_mb__after_clear_bit(); | 609 | smp_mb__after_atomic(); |
610 | 610 | ||
611 | return atomic64_read(&ic->i_ack_next); | 611 | return atomic64_read(&ic->i_ack_next); |
612 | } | 612 | } |
diff --git a/net/rds/iw_recv.c b/net/rds/iw_recv.c index 45033358358e..aa8bf6786008 100644 --- a/net/rds/iw_recv.c +++ b/net/rds/iw_recv.c | |||
@@ -429,7 +429,7 @@ static void rds_iw_set_ack(struct rds_iw_connection *ic, u64 seq, | |||
429 | { | 429 | { |
430 | atomic64_set(&ic->i_ack_next, seq); | 430 | atomic64_set(&ic->i_ack_next, seq); |
431 | if (ack_required) { | 431 | if (ack_required) { |
432 | smp_mb__before_clear_bit(); | 432 | smp_mb__before_atomic(); |
433 | set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); | 433 | set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); |
434 | } | 434 | } |
435 | } | 435 | } |
@@ -437,7 +437,7 @@ static void rds_iw_set_ack(struct rds_iw_connection *ic, u64 seq, | |||
437 | static u64 rds_iw_get_ack(struct rds_iw_connection *ic) | 437 | static u64 rds_iw_get_ack(struct rds_iw_connection *ic) |
438 | { | 438 | { |
439 | clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); | 439 | clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); |
440 | smp_mb__after_clear_bit(); | 440 | smp_mb__after_atomic(); |
441 | 441 | ||
442 | return atomic64_read(&ic->i_ack_next); | 442 | return atomic64_read(&ic->i_ack_next); |
443 | } | 443 | } |
diff --git a/net/rds/send.c b/net/rds/send.c index a82fb660ec00..23718160d71e 100644 --- a/net/rds/send.c +++ b/net/rds/send.c | |||
@@ -107,7 +107,7 @@ static int acquire_in_xmit(struct rds_connection *conn) | |||
107 | static void release_in_xmit(struct rds_connection *conn) | 107 | static void release_in_xmit(struct rds_connection *conn) |
108 | { | 108 | { |
109 | clear_bit(RDS_IN_XMIT, &conn->c_flags); | 109 | clear_bit(RDS_IN_XMIT, &conn->c_flags); |
110 | smp_mb__after_clear_bit(); | 110 | smp_mb__after_atomic(); |
111 | /* | 111 | /* |
112 | * We don't use wait_on_bit()/wake_up_bit() because our waking is in a | 112 | * We don't use wait_on_bit()/wake_up_bit() because our waking is in a |
113 | * hot path and finding waiters is very rare. We don't want to walk | 113 | * hot path and finding waiters is very rare. We don't want to walk |
@@ -661,7 +661,7 @@ void rds_send_drop_acked(struct rds_connection *conn, u64 ack, | |||
661 | 661 | ||
662 | /* order flag updates with spin locks */ | 662 | /* order flag updates with spin locks */ |
663 | if (!list_empty(&list)) | 663 | if (!list_empty(&list)) |
664 | smp_mb__after_clear_bit(); | 664 | smp_mb__after_atomic(); |
665 | 665 | ||
666 | spin_unlock_irqrestore(&conn->c_lock, flags); | 666 | spin_unlock_irqrestore(&conn->c_lock, flags); |
667 | 667 | ||
@@ -691,7 +691,7 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest) | |||
691 | } | 691 | } |
692 | 692 | ||
693 | /* order flag updates with the rs lock */ | 693 | /* order flag updates with the rs lock */ |
694 | smp_mb__after_clear_bit(); | 694 | smp_mb__after_atomic(); |
695 | 695 | ||
696 | spin_unlock_irqrestore(&rs->rs_lock, flags); | 696 | spin_unlock_irqrestore(&rs->rs_lock, flags); |
697 | 697 | ||
diff --git a/net/rds/tcp_send.c b/net/rds/tcp_send.c index 81cf5a4c5e40..53b17ca0dff5 100644 --- a/net/rds/tcp_send.c +++ b/net/rds/tcp_send.c | |||
@@ -93,7 +93,7 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
93 | rm->m_ack_seq = tc->t_last_sent_nxt + | 93 | rm->m_ack_seq = tc->t_last_sent_nxt + |
94 | sizeof(struct rds_header) + | 94 | sizeof(struct rds_header) + |
95 | be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1; | 95 | be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1; |
96 | smp_mb__before_clear_bit(); | 96 | smp_mb__before_atomic(); |
97 | set_bit(RDS_MSG_HAS_ACK_SEQ, &rm->m_flags); | 97 | set_bit(RDS_MSG_HAS_ACK_SEQ, &rm->m_flags); |
98 | tc->t_last_expected_una = rm->m_ack_seq + 1; | 98 | tc->t_last_expected_una = rm->m_ack_seq + 1; |
99 | 99 | ||
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 5285ead196c0..247e973544bf 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -296,7 +296,7 @@ static void | |||
296 | rpcauth_unhash_cred_locked(struct rpc_cred *cred) | 296 | rpcauth_unhash_cred_locked(struct rpc_cred *cred) |
297 | { | 297 | { |
298 | hlist_del_rcu(&cred->cr_hash); | 298 | hlist_del_rcu(&cred->cr_hash); |
299 | smp_mb__before_clear_bit(); | 299 | smp_mb__before_atomic(); |
300 | clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); | 300 | clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); |
301 | } | 301 | } |
302 | 302 | ||
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 36e431ee1c90..b6e440baccc3 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -143,7 +143,7 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx) | |||
143 | gss_get_ctx(ctx); | 143 | gss_get_ctx(ctx); |
144 | rcu_assign_pointer(gss_cred->gc_ctx, ctx); | 144 | rcu_assign_pointer(gss_cred->gc_ctx, ctx); |
145 | set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); | 145 | set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); |
146 | smp_mb__before_clear_bit(); | 146 | smp_mb__before_atomic(); |
147 | clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags); | 147 | clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags); |
148 | } | 148 | } |
149 | 149 | ||
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c index 3513d559bc45..9761a0da964d 100644 --- a/net/sunrpc/backchannel_rqst.c +++ b/net/sunrpc/backchannel_rqst.c | |||
@@ -244,10 +244,10 @@ void xprt_free_bc_request(struct rpc_rqst *req) | |||
244 | dprintk("RPC: free backchannel req=%p\n", req); | 244 | dprintk("RPC: free backchannel req=%p\n", req); |
245 | 245 | ||
246 | req->rq_connect_cookie = xprt->connect_cookie - 1; | 246 | req->rq_connect_cookie = xprt->connect_cookie - 1; |
247 | smp_mb__before_clear_bit(); | 247 | smp_mb__before_atomic(); |
248 | WARN_ON_ONCE(!test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state)); | 248 | WARN_ON_ONCE(!test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state)); |
249 | clear_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); | 249 | clear_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); |
250 | smp_mb__after_clear_bit(); | 250 | smp_mb__after_atomic(); |
251 | 251 | ||
252 | if (!xprt_need_to_requeue(xprt)) { | 252 | if (!xprt_need_to_requeue(xprt)) { |
253 | /* | 253 | /* |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index d173f79947c6..89d051de6b3e 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -230,9 +230,9 @@ static void xprt_clear_locked(struct rpc_xprt *xprt) | |||
230 | { | 230 | { |
231 | xprt->snd_task = NULL; | 231 | xprt->snd_task = NULL; |
232 | if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) { | 232 | if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) { |
233 | smp_mb__before_clear_bit(); | 233 | smp_mb__before_atomic(); |
234 | clear_bit(XPRT_LOCKED, &xprt->state); | 234 | clear_bit(XPRT_LOCKED, &xprt->state); |
235 | smp_mb__after_clear_bit(); | 235 | smp_mb__after_atomic(); |
236 | } else | 236 | } else |
237 | queue_work(rpciod_workqueue, &xprt->task_cleanup); | 237 | queue_work(rpciod_workqueue, &xprt->task_cleanup); |
238 | } | 238 | } |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 25a3dcf15cae..402a7e9a16b7 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -893,11 +893,11 @@ static void xs_close(struct rpc_xprt *xprt) | |||
893 | xs_reset_transport(transport); | 893 | xs_reset_transport(transport); |
894 | xprt->reestablish_timeout = 0; | 894 | xprt->reestablish_timeout = 0; |
895 | 895 | ||
896 | smp_mb__before_clear_bit(); | 896 | smp_mb__before_atomic(); |
897 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); | 897 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); |
898 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); | 898 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); |
899 | clear_bit(XPRT_CLOSING, &xprt->state); | 899 | clear_bit(XPRT_CLOSING, &xprt->state); |
900 | smp_mb__after_clear_bit(); | 900 | smp_mb__after_atomic(); |
901 | xprt_disconnect_done(xprt); | 901 | xprt_disconnect_done(xprt); |
902 | } | 902 | } |
903 | 903 | ||
@@ -1497,12 +1497,12 @@ static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt) | |||
1497 | 1497 | ||
1498 | static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt) | 1498 | static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt) |
1499 | { | 1499 | { |
1500 | smp_mb__before_clear_bit(); | 1500 | smp_mb__before_atomic(); |
1501 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); | 1501 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); |
1502 | clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state); | 1502 | clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state); |
1503 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); | 1503 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); |
1504 | clear_bit(XPRT_CLOSING, &xprt->state); | 1504 | clear_bit(XPRT_CLOSING, &xprt->state); |
1505 | smp_mb__after_clear_bit(); | 1505 | smp_mb__after_atomic(); |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | static void xs_sock_mark_closed(struct rpc_xprt *xprt) | 1508 | static void xs_sock_mark_closed(struct rpc_xprt *xprt) |
@@ -1556,10 +1556,10 @@ static void xs_tcp_state_change(struct sock *sk) | |||
1556 | xprt->connect_cookie++; | 1556 | xprt->connect_cookie++; |
1557 | xprt->reestablish_timeout = 0; | 1557 | xprt->reestablish_timeout = 0; |
1558 | set_bit(XPRT_CLOSING, &xprt->state); | 1558 | set_bit(XPRT_CLOSING, &xprt->state); |
1559 | smp_mb__before_clear_bit(); | 1559 | smp_mb__before_atomic(); |
1560 | clear_bit(XPRT_CONNECTED, &xprt->state); | 1560 | clear_bit(XPRT_CONNECTED, &xprt->state); |
1561 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); | 1561 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); |
1562 | smp_mb__after_clear_bit(); | 1562 | smp_mb__after_atomic(); |
1563 | xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout); | 1563 | xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout); |
1564 | break; | 1564 | break; |
1565 | case TCP_CLOSE_WAIT: | 1565 | case TCP_CLOSE_WAIT: |
@@ -1578,9 +1578,9 @@ static void xs_tcp_state_change(struct sock *sk) | |||
1578 | case TCP_LAST_ACK: | 1578 | case TCP_LAST_ACK: |
1579 | set_bit(XPRT_CLOSING, &xprt->state); | 1579 | set_bit(XPRT_CLOSING, &xprt->state); |
1580 | xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout); | 1580 | xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout); |
1581 | smp_mb__before_clear_bit(); | 1581 | smp_mb__before_atomic(); |
1582 | clear_bit(XPRT_CONNECTED, &xprt->state); | 1582 | clear_bit(XPRT_CONNECTED, &xprt->state); |
1583 | smp_mb__after_clear_bit(); | 1583 | smp_mb__after_atomic(); |
1584 | break; | 1584 | break; |
1585 | case TCP_CLOSE: | 1585 | case TCP_CLOSE: |
1586 | xs_tcp_cancel_linger_timeout(xprt); | 1586 | xs_tcp_cancel_linger_timeout(xprt); |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index bb7e8ba821f4..749f80c21e22 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1207,7 +1207,7 @@ restart: | |||
1207 | sk->sk_state = TCP_ESTABLISHED; | 1207 | sk->sk_state = TCP_ESTABLISHED; |
1208 | sock_hold(newsk); | 1208 | sock_hold(newsk); |
1209 | 1209 | ||
1210 | smp_mb__after_atomic_inc(); /* sock_hold() does an atomic_inc() */ | 1210 | smp_mb__after_atomic(); /* sock_hold() does an atomic_inc() */ |
1211 | unix_peer(sk) = newsk; | 1211 | unix_peer(sk) = newsk; |
1212 | 1212 | ||
1213 | unix_state_unlock(sk); | 1213 | unix_state_unlock(sk); |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 8546711d12f9..70951fd9b354 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -443,7 +443,7 @@ static int snd_bt87x_pcm_open(struct snd_pcm_substream *substream) | |||
443 | 443 | ||
444 | _error: | 444 | _error: |
445 | clear_bit(0, &chip->opened); | 445 | clear_bit(0, &chip->opened); |
446 | smp_mb__after_clear_bit(); | 446 | smp_mb__after_atomic(); |
447 | return err; | 447 | return err; |
448 | } | 448 | } |
449 | 449 | ||
@@ -458,7 +458,7 @@ static int snd_bt87x_close(struct snd_pcm_substream *substream) | |||
458 | 458 | ||
459 | chip->substream = NULL; | 459 | chip->substream = NULL; |
460 | clear_bit(0, &chip->opened); | 460 | clear_bit(0, &chip->opened); |
461 | smp_mb__after_clear_bit(); | 461 | smp_mb__after_atomic(); |
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | 464 | ||