diff options
Diffstat (limited to 'kernel/spinlock.c')
-rw-r--r-- | kernel/spinlock.c | 306 |
1 files changed, 154 insertions, 152 deletions
diff --git a/kernel/spinlock.c b/kernel/spinlock.c index 41e042219ff6..be6517fb9c14 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c | |||
@@ -32,6 +32,8 @@ | |||
32 | * include/linux/spinlock_api_smp.h | 32 | * include/linux/spinlock_api_smp.h |
33 | */ | 33 | */ |
34 | #else | 34 | #else |
35 | #define raw_read_can_lock(l) read_can_lock(l) | ||
36 | #define raw_write_can_lock(l) write_can_lock(l) | ||
35 | /* | 37 | /* |
36 | * We build the __lock_function inlines here. They are too large for | 38 | * We build the __lock_function inlines here. They are too large for |
37 | * inlining all over the place, but here is only one user per function | 39 | * inlining all over the place, but here is only one user per function |
@@ -42,49 +44,49 @@ | |||
42 | * towards that other CPU that it should break the lock ASAP. | 44 | * towards that other CPU that it should break the lock ASAP. |
43 | */ | 45 | */ |
44 | #define BUILD_LOCK_OPS(op, locktype) \ | 46 | #define BUILD_LOCK_OPS(op, locktype) \ |
45 | void __lockfunc __##op##_lock(locktype##_t *lock) \ | 47 | void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ |
46 | { \ | 48 | { \ |
47 | for (;;) { \ | 49 | for (;;) { \ |
48 | preempt_disable(); \ | 50 | preempt_disable(); \ |
49 | if (likely(_raw_##op##_trylock(lock))) \ | 51 | if (likely(do_raw_##op##_trylock(lock))) \ |
50 | break; \ | 52 | break; \ |
51 | preempt_enable(); \ | 53 | preempt_enable(); \ |
52 | \ | 54 | \ |
53 | if (!(lock)->break_lock) \ | 55 | if (!(lock)->break_lock) \ |
54 | (lock)->break_lock = 1; \ | 56 | (lock)->break_lock = 1; \ |
55 | while (!op##_can_lock(lock) && (lock)->break_lock) \ | 57 | while (!raw_##op##_can_lock(lock) && (lock)->break_lock)\ |
56 | _raw_##op##_relax(&lock->raw_lock); \ | 58 | arch_##op##_relax(&lock->raw_lock); \ |
57 | } \ | 59 | } \ |
58 | (lock)->break_lock = 0; \ | 60 | (lock)->break_lock = 0; \ |
59 | } \ | 61 | } \ |
60 | \ | 62 | \ |
61 | unsigned long __lockfunc __##op##_lock_irqsave(locktype##_t *lock) \ | 63 | unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ |
62 | { \ | 64 | { \ |
63 | unsigned long flags; \ | 65 | unsigned long flags; \ |
64 | \ | 66 | \ |
65 | for (;;) { \ | 67 | for (;;) { \ |
66 | preempt_disable(); \ | 68 | preempt_disable(); \ |
67 | local_irq_save(flags); \ | 69 | local_irq_save(flags); \ |
68 | if (likely(_raw_##op##_trylock(lock))) \ | 70 | if (likely(do_raw_##op##_trylock(lock))) \ |
69 | break; \ | 71 | break; \ |
70 | local_irq_restore(flags); \ | 72 | local_irq_restore(flags); \ |
71 | preempt_enable(); \ | 73 | preempt_enable(); \ |
72 | \ | 74 | \ |
73 | if (!(lock)->break_lock) \ | 75 | if (!(lock)->break_lock) \ |
74 | (lock)->break_lock = 1; \ | 76 | (lock)->break_lock = 1; \ |
75 | while (!op##_can_lock(lock) && (lock)->break_lock) \ | 77 | while (!raw_##op##_can_lock(lock) && (lock)->break_lock)\ |
76 | _raw_##op##_relax(&lock->raw_lock); \ | 78 | arch_##op##_relax(&lock->raw_lock); \ |
77 | } \ | 79 | } \ |
78 | (lock)->break_lock = 0; \ | 80 | (lock)->break_lock = 0; \ |
79 | return flags; \ | 81 | return flags; \ |
80 | } \ | 82 | } \ |
81 | \ | 83 | \ |
82 | void __lockfunc __##op##_lock_irq(locktype##_t *lock) \ | 84 | void __lockfunc __raw_##op##_lock_irq(locktype##_t *lock) \ |
83 | { \ | 85 | { \ |
84 | _##op##_lock_irqsave(lock); \ | 86 | _raw_##op##_lock_irqsave(lock); \ |
85 | } \ | 87 | } \ |
86 | \ | 88 | \ |
87 | void __lockfunc __##op##_lock_bh(locktype##_t *lock) \ | 89 | void __lockfunc __raw_##op##_lock_bh(locktype##_t *lock) \ |
88 | { \ | 90 | { \ |
89 | unsigned long flags; \ | 91 | unsigned long flags; \ |
90 | \ | 92 | \ |
@@ -93,7 +95,7 @@ void __lockfunc __##op##_lock_bh(locktype##_t *lock) \ | |||
93 | /* irq-disabling. We use the generic preemption-aware */ \ | 95 | /* irq-disabling. We use the generic preemption-aware */ \ |
94 | /* function: */ \ | 96 | /* function: */ \ |
95 | /**/ \ | 97 | /**/ \ |
96 | flags = _##op##_lock_irqsave(lock); \ | 98 | flags = _raw_##op##_lock_irqsave(lock); \ |
97 | local_bh_disable(); \ | 99 | local_bh_disable(); \ |
98 | local_irq_restore(flags); \ | 100 | local_irq_restore(flags); \ |
99 | } \ | 101 | } \ |
@@ -107,269 +109,269 @@ void __lockfunc __##op##_lock_bh(locktype##_t *lock) \ | |||
107 | * __[spin|read|write]_lock_irqsave() | 109 | * __[spin|read|write]_lock_irqsave() |
108 | * __[spin|read|write]_lock_bh() | 110 | * __[spin|read|write]_lock_bh() |
109 | */ | 111 | */ |
110 | BUILD_LOCK_OPS(spin, spinlock); | 112 | BUILD_LOCK_OPS(spin, raw_spinlock); |
111 | BUILD_LOCK_OPS(read, rwlock); | 113 | BUILD_LOCK_OPS(read, rwlock); |
112 | BUILD_LOCK_OPS(write, rwlock); | 114 | BUILD_LOCK_OPS(write, rwlock); |
113 | 115 | ||
114 | #endif | 116 | #endif |
115 | 117 | ||
116 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 118 | #ifndef CONFIG_INLINE_SPIN_TRYLOCK |
117 | 119 | int __lockfunc _raw_spin_trylock(raw_spinlock_t *lock) | |
118 | void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) | ||
119 | { | 120 | { |
120 | preempt_disable(); | 121 | return __raw_spin_trylock(lock); |
121 | spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); | ||
122 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | ||
123 | } | 122 | } |
124 | EXPORT_SYMBOL(_spin_lock_nested); | 123 | EXPORT_SYMBOL(_raw_spin_trylock); |
124 | #endif | ||
125 | 125 | ||
126 | unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, | 126 | #ifndef CONFIG_INLINE_SPIN_TRYLOCK_BH |
127 | int subclass) | 127 | int __lockfunc _raw_spin_trylock_bh(raw_spinlock_t *lock) |
128 | { | 128 | { |
129 | unsigned long flags; | 129 | return __raw_spin_trylock_bh(lock); |
130 | |||
131 | local_irq_save(flags); | ||
132 | preempt_disable(); | ||
133 | spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); | ||
134 | LOCK_CONTENDED_FLAGS(lock, _raw_spin_trylock, _raw_spin_lock, | ||
135 | _raw_spin_lock_flags, &flags); | ||
136 | return flags; | ||
137 | } | 130 | } |
138 | EXPORT_SYMBOL(_spin_lock_irqsave_nested); | 131 | EXPORT_SYMBOL(_raw_spin_trylock_bh); |
132 | #endif | ||
139 | 133 | ||
140 | void __lockfunc _spin_lock_nest_lock(spinlock_t *lock, | 134 | #ifndef CONFIG_INLINE_SPIN_LOCK |
141 | struct lockdep_map *nest_lock) | 135 | void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) |
142 | { | 136 | { |
143 | preempt_disable(); | 137 | __raw_spin_lock(lock); |
144 | spin_acquire_nest(&lock->dep_map, 0, 0, nest_lock, _RET_IP_); | ||
145 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | ||
146 | } | 138 | } |
147 | EXPORT_SYMBOL(_spin_lock_nest_lock); | 139 | EXPORT_SYMBOL(_raw_spin_lock); |
148 | |||
149 | #endif | 140 | #endif |
150 | 141 | ||
151 | #ifndef CONFIG_INLINE_SPIN_TRYLOCK | 142 | #ifndef CONFIG_INLINE_SPIN_LOCK_IRQSAVE |
152 | int __lockfunc _spin_trylock(spinlock_t *lock) | 143 | unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t *lock) |
153 | { | 144 | { |
154 | return __spin_trylock(lock); | 145 | return __raw_spin_lock_irqsave(lock); |
155 | } | 146 | } |
156 | EXPORT_SYMBOL(_spin_trylock); | 147 | EXPORT_SYMBOL(_raw_spin_lock_irqsave); |
157 | #endif | 148 | #endif |
158 | 149 | ||
159 | #ifndef CONFIG_INLINE_READ_TRYLOCK | 150 | #ifndef CONFIG_INLINE_SPIN_LOCK_IRQ |
160 | int __lockfunc _read_trylock(rwlock_t *lock) | 151 | void __lockfunc _raw_spin_lock_irq(raw_spinlock_t *lock) |
161 | { | 152 | { |
162 | return __read_trylock(lock); | 153 | __raw_spin_lock_irq(lock); |
163 | } | 154 | } |
164 | EXPORT_SYMBOL(_read_trylock); | 155 | EXPORT_SYMBOL(_raw_spin_lock_irq); |
165 | #endif | 156 | #endif |
166 | 157 | ||
167 | #ifndef CONFIG_INLINE_WRITE_TRYLOCK | 158 | #ifndef CONFIG_INLINE_SPIN_LOCK_BH |
168 | int __lockfunc _write_trylock(rwlock_t *lock) | 159 | void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock) |
169 | { | 160 | { |
170 | return __write_trylock(lock); | 161 | __raw_spin_lock_bh(lock); |
171 | } | 162 | } |
172 | EXPORT_SYMBOL(_write_trylock); | 163 | EXPORT_SYMBOL(_raw_spin_lock_bh); |
173 | #endif | 164 | #endif |
174 | 165 | ||
175 | #ifndef CONFIG_INLINE_READ_LOCK | 166 | #ifndef CONFIG_INLINE_SPIN_UNLOCK |
176 | void __lockfunc _read_lock(rwlock_t *lock) | 167 | void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) |
177 | { | 168 | { |
178 | __read_lock(lock); | 169 | __raw_spin_unlock(lock); |
179 | } | 170 | } |
180 | EXPORT_SYMBOL(_read_lock); | 171 | EXPORT_SYMBOL(_raw_spin_unlock); |
181 | #endif | 172 | #endif |
182 | 173 | ||
183 | #ifndef CONFIG_INLINE_SPIN_LOCK_IRQSAVE | 174 | #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE |
184 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) | 175 | void __lockfunc _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) |
185 | { | 176 | { |
186 | return __spin_lock_irqsave(lock); | 177 | __raw_spin_unlock_irqrestore(lock, flags); |
187 | } | 178 | } |
188 | EXPORT_SYMBOL(_spin_lock_irqsave); | 179 | EXPORT_SYMBOL(_raw_spin_unlock_irqrestore); |
189 | #endif | 180 | #endif |
190 | 181 | ||
191 | #ifndef CONFIG_INLINE_SPIN_LOCK_IRQ | 182 | #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQ |
192 | void __lockfunc _spin_lock_irq(spinlock_t *lock) | 183 | void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t *lock) |
193 | { | 184 | { |
194 | __spin_lock_irq(lock); | 185 | __raw_spin_unlock_irq(lock); |
195 | } | 186 | } |
196 | EXPORT_SYMBOL(_spin_lock_irq); | 187 | EXPORT_SYMBOL(_raw_spin_unlock_irq); |
197 | #endif | 188 | #endif |
198 | 189 | ||
199 | #ifndef CONFIG_INLINE_SPIN_LOCK_BH | 190 | #ifndef CONFIG_INLINE_SPIN_UNLOCK_BH |
200 | void __lockfunc _spin_lock_bh(spinlock_t *lock) | 191 | void __lockfunc _raw_spin_unlock_bh(raw_spinlock_t *lock) |
201 | { | 192 | { |
202 | __spin_lock_bh(lock); | 193 | __raw_spin_unlock_bh(lock); |
203 | } | 194 | } |
204 | EXPORT_SYMBOL(_spin_lock_bh); | 195 | EXPORT_SYMBOL(_raw_spin_unlock_bh); |
205 | #endif | 196 | #endif |
206 | 197 | ||
207 | #ifndef CONFIG_INLINE_READ_LOCK_IRQSAVE | 198 | #ifndef CONFIG_INLINE_READ_TRYLOCK |
208 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) | 199 | int __lockfunc _raw_read_trylock(rwlock_t *lock) |
209 | { | 200 | { |
210 | return __read_lock_irqsave(lock); | 201 | return __raw_read_trylock(lock); |
211 | } | 202 | } |
212 | EXPORT_SYMBOL(_read_lock_irqsave); | 203 | EXPORT_SYMBOL(_raw_read_trylock); |
213 | #endif | 204 | #endif |
214 | 205 | ||
215 | #ifndef CONFIG_INLINE_READ_LOCK_IRQ | 206 | #ifndef CONFIG_INLINE_READ_LOCK |
216 | void __lockfunc _read_lock_irq(rwlock_t *lock) | 207 | void __lockfunc _raw_read_lock(rwlock_t *lock) |
217 | { | 208 | { |
218 | __read_lock_irq(lock); | 209 | __raw_read_lock(lock); |
219 | } | 210 | } |
220 | EXPORT_SYMBOL(_read_lock_irq); | 211 | EXPORT_SYMBOL(_raw_read_lock); |
221 | #endif | 212 | #endif |
222 | 213 | ||
223 | #ifndef CONFIG_INLINE_READ_LOCK_BH | 214 | #ifndef CONFIG_INLINE_READ_LOCK_IRQSAVE |
224 | void __lockfunc _read_lock_bh(rwlock_t *lock) | 215 | unsigned long __lockfunc _raw_read_lock_irqsave(rwlock_t *lock) |
225 | { | 216 | { |
226 | __read_lock_bh(lock); | 217 | return __raw_read_lock_irqsave(lock); |
227 | } | 218 | } |
228 | EXPORT_SYMBOL(_read_lock_bh); | 219 | EXPORT_SYMBOL(_raw_read_lock_irqsave); |
229 | #endif | 220 | #endif |
230 | 221 | ||
231 | #ifndef CONFIG_INLINE_WRITE_LOCK_IRQSAVE | 222 | #ifndef CONFIG_INLINE_READ_LOCK_IRQ |
232 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) | 223 | void __lockfunc _raw_read_lock_irq(rwlock_t *lock) |
233 | { | 224 | { |
234 | return __write_lock_irqsave(lock); | 225 | __raw_read_lock_irq(lock); |
235 | } | 226 | } |
236 | EXPORT_SYMBOL(_write_lock_irqsave); | 227 | EXPORT_SYMBOL(_raw_read_lock_irq); |
237 | #endif | 228 | #endif |
238 | 229 | ||
239 | #ifndef CONFIG_INLINE_WRITE_LOCK_IRQ | 230 | #ifndef CONFIG_INLINE_READ_LOCK_BH |
240 | void __lockfunc _write_lock_irq(rwlock_t *lock) | 231 | void __lockfunc _raw_read_lock_bh(rwlock_t *lock) |
241 | { | 232 | { |
242 | __write_lock_irq(lock); | 233 | __raw_read_lock_bh(lock); |
243 | } | 234 | } |
244 | EXPORT_SYMBOL(_write_lock_irq); | 235 | EXPORT_SYMBOL(_raw_read_lock_bh); |
245 | #endif | 236 | #endif |
246 | 237 | ||
247 | #ifndef CONFIG_INLINE_WRITE_LOCK_BH | 238 | #ifndef CONFIG_INLINE_READ_UNLOCK |
248 | void __lockfunc _write_lock_bh(rwlock_t *lock) | 239 | void __lockfunc _raw_read_unlock(rwlock_t *lock) |
249 | { | 240 | { |
250 | __write_lock_bh(lock); | 241 | __raw_read_unlock(lock); |
251 | } | 242 | } |
252 | EXPORT_SYMBOL(_write_lock_bh); | 243 | EXPORT_SYMBOL(_raw_read_unlock); |
253 | #endif | 244 | #endif |
254 | 245 | ||
255 | #ifndef CONFIG_INLINE_SPIN_LOCK | 246 | #ifndef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE |
256 | void __lockfunc _spin_lock(spinlock_t *lock) | 247 | void __lockfunc _raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) |
257 | { | 248 | { |
258 | __spin_lock(lock); | 249 | __raw_read_unlock_irqrestore(lock, flags); |
259 | } | 250 | } |
260 | EXPORT_SYMBOL(_spin_lock); | 251 | EXPORT_SYMBOL(_raw_read_unlock_irqrestore); |
261 | #endif | 252 | #endif |
262 | 253 | ||
263 | #ifndef CONFIG_INLINE_WRITE_LOCK | 254 | #ifndef CONFIG_INLINE_READ_UNLOCK_IRQ |
264 | void __lockfunc _write_lock(rwlock_t *lock) | 255 | void __lockfunc _raw_read_unlock_irq(rwlock_t *lock) |
265 | { | 256 | { |
266 | __write_lock(lock); | 257 | __raw_read_unlock_irq(lock); |
267 | } | 258 | } |
268 | EXPORT_SYMBOL(_write_lock); | 259 | EXPORT_SYMBOL(_raw_read_unlock_irq); |
269 | #endif | 260 | #endif |
270 | 261 | ||
271 | #ifndef CONFIG_INLINE_SPIN_UNLOCK | 262 | #ifndef CONFIG_INLINE_READ_UNLOCK_BH |
272 | void __lockfunc _spin_unlock(spinlock_t *lock) | 263 | void __lockfunc _raw_read_unlock_bh(rwlock_t *lock) |
273 | { | 264 | { |
274 | __spin_unlock(lock); | 265 | __raw_read_unlock_bh(lock); |
275 | } | 266 | } |
276 | EXPORT_SYMBOL(_spin_unlock); | 267 | EXPORT_SYMBOL(_raw_read_unlock_bh); |
277 | #endif | 268 | #endif |
278 | 269 | ||
279 | #ifndef CONFIG_INLINE_WRITE_UNLOCK | 270 | #ifndef CONFIG_INLINE_WRITE_TRYLOCK |
280 | void __lockfunc _write_unlock(rwlock_t *lock) | 271 | int __lockfunc _raw_write_trylock(rwlock_t *lock) |
281 | { | 272 | { |
282 | __write_unlock(lock); | 273 | return __raw_write_trylock(lock); |
283 | } | 274 | } |
284 | EXPORT_SYMBOL(_write_unlock); | 275 | EXPORT_SYMBOL(_raw_write_trylock); |
285 | #endif | 276 | #endif |
286 | 277 | ||
287 | #ifndef CONFIG_INLINE_READ_UNLOCK | 278 | #ifndef CONFIG_INLINE_WRITE_LOCK |
288 | void __lockfunc _read_unlock(rwlock_t *lock) | 279 | void __lockfunc _raw_write_lock(rwlock_t *lock) |
289 | { | 280 | { |
290 | __read_unlock(lock); | 281 | __raw_write_lock(lock); |
291 | } | 282 | } |
292 | EXPORT_SYMBOL(_read_unlock); | 283 | EXPORT_SYMBOL(_raw_write_lock); |
293 | #endif | 284 | #endif |
294 | 285 | ||
295 | #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE | 286 | #ifndef CONFIG_INLINE_WRITE_LOCK_IRQSAVE |
296 | void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) | 287 | unsigned long __lockfunc _raw_write_lock_irqsave(rwlock_t *lock) |
297 | { | 288 | { |
298 | __spin_unlock_irqrestore(lock, flags); | 289 | return __raw_write_lock_irqsave(lock); |
299 | } | 290 | } |
300 | EXPORT_SYMBOL(_spin_unlock_irqrestore); | 291 | EXPORT_SYMBOL(_raw_write_lock_irqsave); |
301 | #endif | 292 | #endif |
302 | 293 | ||
303 | #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQ | 294 | #ifndef CONFIG_INLINE_WRITE_LOCK_IRQ |
304 | void __lockfunc _spin_unlock_irq(spinlock_t *lock) | 295 | void __lockfunc _raw_write_lock_irq(rwlock_t *lock) |
305 | { | 296 | { |
306 | __spin_unlock_irq(lock); | 297 | __raw_write_lock_irq(lock); |
307 | } | 298 | } |
308 | EXPORT_SYMBOL(_spin_unlock_irq); | 299 | EXPORT_SYMBOL(_raw_write_lock_irq); |
309 | #endif | 300 | #endif |
310 | 301 | ||
311 | #ifndef CONFIG_INLINE_SPIN_UNLOCK_BH | 302 | #ifndef CONFIG_INLINE_WRITE_LOCK_BH |
312 | void __lockfunc _spin_unlock_bh(spinlock_t *lock) | 303 | void __lockfunc _raw_write_lock_bh(rwlock_t *lock) |
313 | { | 304 | { |
314 | __spin_unlock_bh(lock); | 305 | __raw_write_lock_bh(lock); |
315 | } | 306 | } |
316 | EXPORT_SYMBOL(_spin_unlock_bh); | 307 | EXPORT_SYMBOL(_raw_write_lock_bh); |
317 | #endif | 308 | #endif |
318 | 309 | ||
319 | #ifndef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE | 310 | #ifndef CONFIG_INLINE_WRITE_UNLOCK |
320 | void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | 311 | void __lockfunc _raw_write_unlock(rwlock_t *lock) |
321 | { | 312 | { |
322 | __read_unlock_irqrestore(lock, flags); | 313 | __raw_write_unlock(lock); |
323 | } | 314 | } |
324 | EXPORT_SYMBOL(_read_unlock_irqrestore); | 315 | EXPORT_SYMBOL(_raw_write_unlock); |
325 | #endif | 316 | #endif |
326 | 317 | ||
327 | #ifndef CONFIG_INLINE_READ_UNLOCK_IRQ | 318 | #ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE |
328 | void __lockfunc _read_unlock_irq(rwlock_t *lock) | 319 | void __lockfunc _raw_write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) |
329 | { | 320 | { |
330 | __read_unlock_irq(lock); | 321 | __raw_write_unlock_irqrestore(lock, flags); |
331 | } | 322 | } |
332 | EXPORT_SYMBOL(_read_unlock_irq); | 323 | EXPORT_SYMBOL(_raw_write_unlock_irqrestore); |
333 | #endif | 324 | #endif |
334 | 325 | ||
335 | #ifndef CONFIG_INLINE_READ_UNLOCK_BH | 326 | #ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQ |
336 | void __lockfunc _read_unlock_bh(rwlock_t *lock) | 327 | void __lockfunc _raw_write_unlock_irq(rwlock_t *lock) |
337 | { | 328 | { |
338 | __read_unlock_bh(lock); | 329 | __raw_write_unlock_irq(lock); |
339 | } | 330 | } |
340 | EXPORT_SYMBOL(_read_unlock_bh); | 331 | EXPORT_SYMBOL(_raw_write_unlock_irq); |
341 | #endif | 332 | #endif |
342 | 333 | ||
343 | #ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE | 334 | #ifndef CONFIG_INLINE_WRITE_UNLOCK_BH |
344 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | 335 | void __lockfunc _raw_write_unlock_bh(rwlock_t *lock) |
345 | { | 336 | { |
346 | __write_unlock_irqrestore(lock, flags); | 337 | __raw_write_unlock_bh(lock); |
347 | } | 338 | } |
348 | EXPORT_SYMBOL(_write_unlock_irqrestore); | 339 | EXPORT_SYMBOL(_raw_write_unlock_bh); |
349 | #endif | 340 | #endif |
350 | 341 | ||
351 | #ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQ | 342 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
352 | void __lockfunc _write_unlock_irq(rwlock_t *lock) | 343 | |
344 | void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) | ||
353 | { | 345 | { |
354 | __write_unlock_irq(lock); | 346 | preempt_disable(); |
347 | spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); | ||
348 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); | ||
355 | } | 349 | } |
356 | EXPORT_SYMBOL(_write_unlock_irq); | 350 | EXPORT_SYMBOL(_raw_spin_lock_nested); |
357 | #endif | ||
358 | 351 | ||
359 | #ifndef CONFIG_INLINE_WRITE_UNLOCK_BH | 352 | unsigned long __lockfunc _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, |
360 | void __lockfunc _write_unlock_bh(rwlock_t *lock) | 353 | int subclass) |
361 | { | 354 | { |
362 | __write_unlock_bh(lock); | 355 | unsigned long flags; |
356 | |||
357 | local_irq_save(flags); | ||
358 | preempt_disable(); | ||
359 | spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); | ||
360 | LOCK_CONTENDED_FLAGS(lock, do_raw_spin_trylock, do_raw_spin_lock, | ||
361 | do_raw_spin_lock_flags, &flags); | ||
362 | return flags; | ||
363 | } | 363 | } |
364 | EXPORT_SYMBOL(_write_unlock_bh); | 364 | EXPORT_SYMBOL(_raw_spin_lock_irqsave_nested); |
365 | #endif | ||
366 | 365 | ||
367 | #ifndef CONFIG_INLINE_SPIN_TRYLOCK_BH | 366 | void __lockfunc _raw_spin_lock_nest_lock(raw_spinlock_t *lock, |
368 | int __lockfunc _spin_trylock_bh(spinlock_t *lock) | 367 | struct lockdep_map *nest_lock) |
369 | { | 368 | { |
370 | return __spin_trylock_bh(lock); | 369 | preempt_disable(); |
370 | spin_acquire_nest(&lock->dep_map, 0, 0, nest_lock, _RET_IP_); | ||
371 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); | ||
371 | } | 372 | } |
372 | EXPORT_SYMBOL(_spin_trylock_bh); | 373 | EXPORT_SYMBOL(_raw_spin_lock_nest_lock); |
374 | |||
373 | #endif | 375 | #endif |
374 | 376 | ||
375 | notrace int in_lock_functions(unsigned long addr) | 377 | notrace int in_lock_functions(unsigned long addr) |