13 #define LOCKDEP_STATE(__STATE) \
14 LOCK_USED_IN_##__STATE, \
15 LOCK_USED_IN_##__STATE##_READ, \
16 LOCK_ENABLED_##__STATE, \
17 LOCK_ENABLED_##__STATE##_READ,
27 #define __LOCKF(__STATE) LOCKF_##__STATE = (1 << LOCK_##__STATE),
30 #define LOCKDEP_STATE(__STATE) \
31 __LOCKF(USED_IN_##__STATE) \
32 __LOCKF(USED_IN_##__STATE##_READ) \
33 __LOCKF(ENABLED_##__STATE) \
34 __LOCKF(ENABLED_##__STATE##_READ)
40 #define LOCKF_ENABLED_IRQ (LOCKF_ENABLED_HARDIRQ | LOCKF_ENABLED_SOFTIRQ)
41 #define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
43 #define LOCKF_ENABLED_IRQ_READ \
44 (LOCKF_ENABLED_HARDIRQ_READ | LOCKF_ENABLED_SOFTIRQ_READ)
45 #define LOCKF_USED_IN_IRQ_READ \
46 (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
57 #define MAX_LOCKDEP_ENTRIES 16384UL
59 #define MAX_LOCKDEP_CHAINS_BITS 15
60 #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
62 #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
68 #define MAX_STACK_TRACE_ENTRIES 262144UL
73 #define LOCK_USAGE_CHARS (1+LOCK_USAGE_STATES/2)
96 #ifdef CONFIG_PROVE_LOCKING
97 extern unsigned long lockdep_count_forward_deps(
struct lock_class *);
98 extern unsigned long lockdep_count_backward_deps(
struct lock_class *);
100 static inline unsigned long
101 lockdep_count_forward_deps(
struct lock_class *
class)
105 static inline unsigned long
106 lockdep_count_backward_deps(
struct lock_class *
class)
112 #ifdef CONFIG_DEBUG_LOCKDEP
114 #include <asm/local.h>
120 struct lockdep_stats {
121 int chain_lookup_hits;
122 int chain_lookup_misses;
123 int hardirqs_on_events;
124 int hardirqs_off_events;
125 int redundant_hardirqs_on;
126 int redundant_hardirqs_off;
127 int softirqs_on_events;
128 int softirqs_off_events;
129 int redundant_softirqs_on;
130 int redundant_softirqs_off;
132 int nr_cyclic_checks;
133 int nr_cyclic_check_recursions;
134 int nr_find_usage_forwards_checks;
135 int nr_find_usage_forwards_recursions;
136 int nr_find_usage_backwards_checks;
137 int nr_find_usage_backwards_recursions;
142 #define __debug_atomic_inc(ptr) \
143 this_cpu_inc(lockdep_stats.ptr);
145 #define debug_atomic_inc(ptr) { \
146 WARN_ON_ONCE(!irqs_disabled()); \
147 __this_cpu_inc(lockdep_stats.ptr); \
150 #define debug_atomic_dec(ptr) { \
151 WARN_ON_ONCE(!irqs_disabled()); \
152 __this_cpu_dec(lockdep_stats.ptr); \
155 #define debug_atomic_read(ptr) ({ \
156 struct lockdep_stats *__cpu_lockdep_stats; \
157 unsigned long long __total = 0; \
159 for_each_possible_cpu(__cpu) { \
160 __cpu_lockdep_stats = &per_cpu(lockdep_stats, __cpu); \
161 __total += __cpu_lockdep_stats->ptr; \
166 # define __debug_atomic_inc(ptr) do { } while (0)
167 # define debug_atomic_inc(ptr) do { } while (0)
168 # define debug_atomic_dec(ptr) do { } while (0)
169 # define debug_atomic_read(ptr) 0