|
38 | 38 | * barriers on top of the relaxed variant. In the case where the relaxed |
39 | 39 | * variant is already fully ordered, no additional barriers are needed. |
40 | 40 | * |
41 | | - * Besides, if an arch has a special barrier for acquire/release, it could |
42 | | - * implement its own __atomic_op_* and use the same framework for building |
43 | | - * variants |
44 | | - * |
45 | | - * If an architecture overrides __atomic_op_acquire() it will probably want |
46 | | - * to define smp_mb__after_spinlock(). |
| 41 | + * If an architecture overrides __atomic_acquire_fence() it will probably |
| 42 | + * want to define smp_mb__after_spinlock(). |
47 | 43 | */ |
48 | | -#ifndef __atomic_op_acquire |
| 44 | +#ifndef __atomic_acquire_fence |
| 45 | +#define __atomic_acquire_fence smp_mb__after_atomic |
| 46 | +#endif |
| 47 | + |
| 48 | +#ifndef __atomic_release_fence |
| 49 | +#define __atomic_release_fence smp_mb__before_atomic |
| 50 | +#endif |
| 51 | + |
| 52 | +#ifndef __atomic_pre_full_fence |
| 53 | +#define __atomic_pre_full_fence smp_mb__before_atomic |
| 54 | +#endif |
| 55 | + |
| 56 | +#ifndef __atomic_post_full_fence |
| 57 | +#define __atomic_post_full_fence smp_mb__after_atomic |
| 58 | +#endif |
| 59 | + |
49 | 60 | #define __atomic_op_acquire(op, args...) \ |
50 | 61 | ({ \ |
51 | 62 | typeof(op##_relaxed(args)) __ret = op##_relaxed(args); \ |
52 | | - smp_mb__after_atomic(); \ |
| 63 | + __atomic_acquire_fence(); \ |
53 | 64 | __ret; \ |
54 | 65 | }) |
55 | | -#endif |
56 | 66 |
|
57 | | -#ifndef __atomic_op_release |
58 | 67 | #define __atomic_op_release(op, args...) \ |
59 | 68 | ({ \ |
60 | | - smp_mb__before_atomic(); \ |
| 69 | + __atomic_release_fence(); \ |
61 | 70 | op##_relaxed(args); \ |
62 | 71 | }) |
63 | | -#endif |
64 | 72 |
|
65 | | -#ifndef __atomic_op_fence |
66 | 73 | #define __atomic_op_fence(op, args...) \ |
67 | 74 | ({ \ |
68 | 75 | typeof(op##_relaxed(args)) __ret; \ |
69 | | - smp_mb__before_atomic(); \ |
| 76 | + __atomic_pre_full_fence(); \ |
70 | 77 | __ret = op##_relaxed(args); \ |
71 | | - smp_mb__after_atomic(); \ |
| 78 | + __atomic_post_full_fence(); \ |
72 | 79 | __ret; \ |
73 | 80 | }) |
74 | | -#endif |
75 | 81 |
|
76 | 82 | /* atomic_add_return_relaxed */ |
77 | 83 | #ifndef atomic_add_return_relaxed |
|
0 commit comments