diff options
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r-- | include/linux/lockdep.h | 67 |
1 files changed, 29 insertions, 38 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 23bf02fb124f..da5a5a1f4cd2 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -20,43 +20,10 @@ struct lockdep_map; | |||
20 | #include <linux/stacktrace.h> | 20 | #include <linux/stacktrace.h> |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Lock-class usage-state bits: | 23 | * We'd rather not expose kernel/lockdep_states.h this wide, but we do need |
24 | * the total number of states... :-( | ||
24 | */ | 25 | */ |
25 | enum lock_usage_bit | 26 | #define XXX_LOCK_USAGE_STATES (1+3*4) |
26 | { | ||
27 | LOCK_USED = 0, | ||
28 | LOCK_USED_IN_HARDIRQ, | ||
29 | LOCK_USED_IN_SOFTIRQ, | ||
30 | LOCK_ENABLED_SOFTIRQS, | ||
31 | LOCK_ENABLED_HARDIRQS, | ||
32 | LOCK_USED_IN_HARDIRQ_READ, | ||
33 | LOCK_USED_IN_SOFTIRQ_READ, | ||
34 | LOCK_ENABLED_SOFTIRQS_READ, | ||
35 | LOCK_ENABLED_HARDIRQS_READ, | ||
36 | LOCK_USAGE_STATES | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * Usage-state bitmasks: | ||
41 | */ | ||
42 | #define LOCKF_USED (1 << LOCK_USED) | ||
43 | #define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ) | ||
44 | #define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ) | ||
45 | #define LOCKF_ENABLED_HARDIRQS (1 << LOCK_ENABLED_HARDIRQS) | ||
46 | #define LOCKF_ENABLED_SOFTIRQS (1 << LOCK_ENABLED_SOFTIRQS) | ||
47 | |||
48 | #define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS) | ||
49 | #define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ) | ||
50 | |||
51 | #define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ) | ||
52 | #define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ) | ||
53 | #define LOCKF_ENABLED_HARDIRQS_READ (1 << LOCK_ENABLED_HARDIRQS_READ) | ||
54 | #define LOCKF_ENABLED_SOFTIRQS_READ (1 << LOCK_ENABLED_SOFTIRQS_READ) | ||
55 | |||
56 | #define LOCKF_ENABLED_IRQS_READ \ | ||
57 | (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ) | ||
58 | #define LOCKF_USED_IN_IRQ_READ \ | ||
59 | (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ) | ||
60 | 27 | ||
61 | #define MAX_LOCKDEP_SUBCLASSES 8UL | 28 | #define MAX_LOCKDEP_SUBCLASSES 8UL |
62 | 29 | ||
@@ -97,7 +64,7 @@ struct lock_class { | |||
97 | * IRQ/softirq usage tracking bits: | 64 | * IRQ/softirq usage tracking bits: |
98 | */ | 65 | */ |
99 | unsigned long usage_mask; | 66 | unsigned long usage_mask; |
100 | struct stack_trace usage_traces[LOCK_USAGE_STATES]; | 67 | struct stack_trace usage_traces[XXX_LOCK_USAGE_STATES]; |
101 | 68 | ||
102 | /* | 69 | /* |
103 | * These fields represent a directed graph of lock dependencies, | 70 | * These fields represent a directed graph of lock dependencies, |
@@ -324,7 +291,11 @@ static inline void lock_set_subclass(struct lockdep_map *lock, | |||
324 | lock_set_class(lock, lock->name, lock->key, subclass, ip); | 291 | lock_set_class(lock, lock->name, lock->key, subclass, ip); |
325 | } | 292 | } |
326 | 293 | ||
327 | # define INIT_LOCKDEP .lockdep_recursion = 0, | 294 | extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask); |
295 | extern void lockdep_clear_current_reclaim_state(void); | ||
296 | extern void lockdep_trace_alloc(gfp_t mask); | ||
297 | |||
298 | # define INIT_LOCKDEP .lockdep_recursion = 0, .lockdep_reclaim_gfp = 0, | ||
328 | 299 | ||
329 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) | 300 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) |
330 | 301 | ||
@@ -342,6 +313,9 @@ static inline void lockdep_on(void) | |||
342 | # define lock_release(l, n, i) do { } while (0) | 313 | # define lock_release(l, n, i) do { } while (0) |
343 | # define lock_set_class(l, n, k, s, i) do { } while (0) | 314 | # define lock_set_class(l, n, k, s, i) do { } while (0) |
344 | # define lock_set_subclass(l, s, i) do { } while (0) | 315 | # define lock_set_subclass(l, s, i) do { } while (0) |
316 | # define lockdep_set_current_reclaim_state(g) do { } while (0) | ||
317 | # define lockdep_clear_current_reclaim_state() do { } while (0) | ||
318 | # define lockdep_trace_alloc(g) do { } while (0) | ||
345 | # define lockdep_init() do { } while (0) | 319 | # define lockdep_init() do { } while (0) |
346 | # define lockdep_info() do { } while (0) | 320 | # define lockdep_info() do { } while (0) |
347 | # define lockdep_init_map(lock, name, key, sub) \ | 321 | # define lockdep_init_map(lock, name, key, sub) \ |
@@ -390,6 +364,23 @@ do { \ | |||
390 | 364 | ||
391 | #endif /* CONFIG_LOCK_STAT */ | 365 | #endif /* CONFIG_LOCK_STAT */ |
392 | 366 | ||
367 | #ifdef CONFIG_LOCKDEP | ||
368 | |||
369 | /* | ||
370 | * On lockdep we dont want the hand-coded irq-enable of | ||
371 | * _raw_*_lock_flags() code, because lockdep assumes | ||
372 | * that interrupts are not re-enabled during lock-acquire: | ||
373 | */ | ||
374 | #define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \ | ||
375 | LOCK_CONTENDED((_lock), (try), (lock)) | ||
376 | |||
377 | #else /* CONFIG_LOCKDEP */ | ||
378 | |||
379 | #define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \ | ||
380 | lockfl((_lock), (flags)) | ||
381 | |||
382 | #endif /* CONFIG_LOCKDEP */ | ||
383 | |||
393 | #ifdef CONFIG_GENERIC_HARDIRQS | 384 | #ifdef CONFIG_GENERIC_HARDIRQS |
394 | extern void early_init_irq_lock_class(void); | 385 | extern void early_init_irq_lock_class(void); |
395 | #else | 386 | #else |