blob: c3600a091a2874952e97c149f21080ede90ded95 [file] [log] [blame]
Ingo Molnarfbb9ce952006-07-03 00:24:50 -07001/*
2 * kernel/lockdep_internals.h
3 *
4 * Runtime locking correctness validator
5 *
6 * lockdep subsystem internal functions and variables.
7 */
8
9/*
10 * MAX_LOCKDEP_ENTRIES is the maximum number of lock dependencies
11 * we track.
12 *
13 * We use the per-lock dependency maps in two ways: we grow it by adding
14 * every to-be-taken lock to all currently held lock's own dependency
15 * table (if it's not there yet), and we check it for lock order
16 * conflicts and deadlocks.
17 */
18#define MAX_LOCKDEP_ENTRIES 8192UL
19
20#define MAX_LOCKDEP_KEYS_BITS 11
21#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
22
Ingo Molnar50cc6702006-12-06 20:39:30 -080023#define MAX_LOCKDEP_CHAINS_BITS 14
Ingo Molnarfbb9ce952006-07-03 00:24:50 -070024#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
25
Huang, Ying443cd502008-06-20 16:39:21 +080026#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
27
Ingo Molnarfbb9ce952006-07-03 00:24:50 -070028/*
29 * Stack-trace: tightly packed array of stack backtrace
30 * addresses. Protected by the hash_lock.
31 */
Ingo Molnar9bb25bf2006-09-12 20:35:50 -070032#define MAX_STACK_TRACE_ENTRIES 262144UL
Ingo Molnarfbb9ce952006-07-03 00:24:50 -070033
34extern struct list_head all_lock_classes;
Huang, Ying443cd502008-06-20 16:39:21 +080035extern struct lock_chain lock_chains[];
Ingo Molnarfbb9ce952006-07-03 00:24:50 -070036
37extern void
38get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3, char *c4);
39
40extern const char * __get_key_name(struct lockdep_subclass_key *key, char *str);
41
Huang, Ying443cd502008-06-20 16:39:21 +080042struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i);
43
Ingo Molnarfbb9ce952006-07-03 00:24:50 -070044extern unsigned long nr_lock_classes;
45extern unsigned long nr_list_entries;
46extern unsigned long nr_lock_chains;
Huang, Yingcd1a28e2008-06-23 11:20:54 +080047extern int nr_chain_hlocks;
Ingo Molnarfbb9ce952006-07-03 00:24:50 -070048extern unsigned long nr_stack_trace_entries;
49
50extern unsigned int nr_hardirq_chains;
51extern unsigned int nr_softirq_chains;
52extern unsigned int nr_process_chains;
53extern unsigned int max_lockdep_depth;
54extern unsigned int max_recursion_depth;
55
56#ifdef CONFIG_DEBUG_LOCKDEP
57/*
58 * Various lockdep statistics:
59 */
60extern atomic_t chain_lookup_hits;
61extern atomic_t chain_lookup_misses;
62extern atomic_t hardirqs_on_events;
63extern atomic_t hardirqs_off_events;
64extern atomic_t redundant_hardirqs_on;
65extern atomic_t redundant_hardirqs_off;
66extern atomic_t softirqs_on_events;
67extern atomic_t softirqs_off_events;
68extern atomic_t redundant_softirqs_on;
69extern atomic_t redundant_softirqs_off;
70extern atomic_t nr_unused_locks;
71extern atomic_t nr_cyclic_checks;
72extern atomic_t nr_cyclic_check_recursions;
73extern atomic_t nr_find_usage_forwards_checks;
74extern atomic_t nr_find_usage_forwards_recursions;
75extern atomic_t nr_find_usage_backwards_checks;
76extern atomic_t nr_find_usage_backwards_recursions;
77# define debug_atomic_inc(ptr) atomic_inc(ptr)
78# define debug_atomic_dec(ptr) atomic_dec(ptr)
79# define debug_atomic_read(ptr) atomic_read(ptr)
80#else
81# define debug_atomic_inc(ptr) do { } while (0)
82# define debug_atomic_dec(ptr) do { } while (0)
83# define debug_atomic_read(ptr) 0
84#endif