summaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 14:52:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 14:52:29 -0400
commit5f82e71a001d14824a7728ad9e49f6aea420f161 (patch)
treebf5dfa7cf0840ec834899ae925913973bd1e65d1 /include/asm-generic
parent6c51e67b64d169419fb13318035bb442f9176612 (diff)
parentedc2988c548db05e33b921fed15821010bc74895 (diff)
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar: - Add 'cross-release' support to lockdep, which allows APIs like completions, where it's not the 'owner' who releases the lock, to be tracked. It's all activated automatically under CONFIG_PROVE_LOCKING=y. - Clean up (restructure) the x86 atomics op implementation to be more readable, in preparation of KASAN annotations. (Dmitry Vyukov) - Fix static keys (Paolo Bonzini) - Add killable versions of down_read() et al (Kirill Tkhai) - Rework and fix jump_label locking (Marc Zyngier, Paolo Bonzini) - Rework (and fix) tlb_flush_pending() barriers (Peter Zijlstra) - Remove smp_mb__before_spinlock() and convert its usages, introduce smp_mb__after_spinlock() (Peter Zijlstra) * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (56 commits) locking/lockdep/selftests: Fix mixed read-write ABBA tests sched/completion: Avoid unnecessary stack allocation for COMPLETION_INITIALIZER_ONSTACK() acpi/nfit: Fix COMPLETION_INITIALIZER_ONSTACK() abuse locking/pvqspinlock: Relax cmpxchg's to improve performance on some architectures smp: Avoid using two cache lines for struct call_single_data locking/lockdep: Untangle xhlock history save/restore from task independence locking/refcounts, x86/asm: Disable CONFIG_ARCH_HAS_REFCOUNT for the time being futex: Remove duplicated code and fix undefined behaviour Documentation/locking/atomic: Finish the document... locking/lockdep: Fix workqueue crossrelease annotation workqueue/lockdep: 'Fix' flush_work() annotation locking/lockdep/selftests: Add mixed read-write ABBA tests mm, locking/barriers: Clarify tlb_flush_pending() barriers locking/lockdep: Make CONFIG_LOCKDEP_CROSSRELEASE and CONFIG_LOCKDEP_COMPLETIONS truly non-interactive locking/lockdep: Explicitly initialize wq_barrier::done::map locking/lockdep: Rename CONFIG_LOCKDEP_COMPLETE to CONFIG_LOCKDEP_COMPLETIONS locking/lockdep: Reword title of LOCKDEP_CROSSRELEASE config locking/lockdep: Make CONFIG_LOCKDEP_CROSSRELEASE part of CONFIG_PROVE_LOCKING locking/refcounts, x86/asm: Implement fast refcount overflow protection locking/lockdep: Fix the rollback and overwrite detection logic in crossrelease ...
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/atomic64.h2
-rw-r--r--include/asm-generic/futex.h50
2 files changed, 11 insertions, 41 deletions
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h
index dad68bf46c77..8d28eb010d0d 100644
--- a/include/asm-generic/atomic64.h
+++ b/include/asm-generic/atomic64.h
@@ -21,6 +21,8 @@ typedef struct {
21extern long long atomic64_read(const atomic64_t *v); 21extern long long atomic64_read(const atomic64_t *v);
22extern void atomic64_set(atomic64_t *v, long long i); 22extern void atomic64_set(atomic64_t *v, long long i);
23 23
24#define atomic64_set_release(v, i) atomic64_set((v), (i))
25
24#define ATOMIC64_OP(op) \ 26#define ATOMIC64_OP(op) \
25extern void atomic64_##op(long long a, atomic64_t *v); 27extern void atomic64_##op(long long a, atomic64_t *v);
26 28
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
index bf2d34c9d804..f0d8b1c51343 100644
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15/** 15/**
16 * futex_atomic_op_inuser() - Atomic arithmetic operation with constant 16 * arch_futex_atomic_op_inuser() - Atomic arithmetic operation with constant
17 * argument and comparison of the previous 17 * argument and comparison of the previous
18 * futex value with another constant. 18 * futex value with another constant.
19 * 19 *
@@ -25,18 +25,11 @@
25 * <0 - On error 25 * <0 - On error
26 */ 26 */
27static inline int 27static inline int
28futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) 28arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
29{ 29{
30 int op = (encoded_op >> 28) & 7;
31 int cmp = (encoded_op >> 24) & 15;
32 int oparg = (encoded_op << 8) >> 20;
33 int cmparg = (encoded_op << 20) >> 20;
34 int oldval, ret; 30 int oldval, ret;
35 u32 tmp; 31 u32 tmp;
36 32
37 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
38 oparg = 1 << oparg;
39
40 preempt_disable(); 33 preempt_disable();
41 pagefault_disable(); 34 pagefault_disable();
42 35
@@ -74,17 +67,9 @@ out_pagefault_enable:
74 pagefault_enable(); 67 pagefault_enable();
75 preempt_enable(); 68 preempt_enable();
76 69
77 if (ret == 0) { 70 if (ret == 0)
78 switch (cmp) { 71 *oval = oldval;
79 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break; 72
80 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
81 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
82 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
83 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
84 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
85 default: ret = -ENOSYS;
86 }
87 }
88 return ret; 73 return ret;
89} 74}
90 75
@@ -126,18 +111,9 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
126 111
127#else 112#else
128static inline int 113static inline int
129futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) 114arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
130{ 115{
131 int op = (encoded_op >> 28) & 7;
132 int cmp = (encoded_op >> 24) & 15;
133 int oparg = (encoded_op << 8) >> 20;
134 int cmparg = (encoded_op << 20) >> 20;
135 int oldval = 0, ret; 116 int oldval = 0, ret;
136 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
137 oparg = 1 << oparg;
138
139 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32)))
140 return -EFAULT;
141 117
142 pagefault_disable(); 118 pagefault_disable();
143 119
@@ -153,17 +129,9 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
153 129
154 pagefault_enable(); 130 pagefault_enable();
155 131
156 if (!ret) { 132 if (!ret)
157 switch (cmp) { 133 *oval = oldval;
158 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break; 134
159 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
160 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
161 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
162 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
163 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
164 default: ret = -ENOSYS;
165 }
166 }
167 return ret; 135 return ret;
168} 136}
169 137