diff options
-rw-r--r-- | include/linux/lockdep.h | 49 | ||||
-rw-r--r-- | kernel/lockdep_internals.h | 46 | ||||
-rw-r--r-- | kernel/lockdep_states.h | 6 |
3 files changed, 56 insertions, 45 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 6d729c9d1d27..5a58ea3e91e9 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -20,51 +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_USED_IN_RECLAIM_FS, | ||
31 | LOCK_ENABLED_SOFTIRQ, | ||
32 | LOCK_ENABLED_HARDIRQ, | ||
33 | LOCK_ENABLED_RECLAIM_FS, | ||
34 | LOCK_USED_IN_HARDIRQ_READ, | ||
35 | LOCK_USED_IN_SOFTIRQ_READ, | ||
36 | LOCK_USED_IN_RECLAIM_FS_READ, | ||
37 | LOCK_ENABLED_SOFTIRQ_READ, | ||
38 | LOCK_ENABLED_HARDIRQ_READ, | ||
39 | LOCK_ENABLED_RECLAIM_FS_READ, | ||
40 | LOCK_USAGE_STATES | ||
41 | }; | ||
42 | |||
43 | /* | ||
44 | * Usage-state bitmasks: | ||
45 | */ | ||
46 | #define LOCKF_USED (1 << LOCK_USED) | ||
47 | #define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ) | ||
48 | #define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ) | ||
49 | #define LOCKF_USED_IN_RECLAIM_FS (1 << LOCK_USED_IN_RECLAIM_FS) | ||
50 | #define LOCKF_ENABLED_HARDIRQ (1 << LOCK_ENABLED_HARDIRQ) | ||
51 | #define LOCKF_ENABLED_SOFTIRQ (1 << LOCK_ENABLED_SOFTIRQ) | ||
52 | #define LOCKF_ENABLED_RECLAIM_FS (1 << LOCK_ENABLED_RECLAIM_FS) | ||
53 | |||
54 | #define LOCKF_ENABLED_IRQ (LOCKF_ENABLED_HARDIRQ | LOCKF_ENABLED_SOFTIRQ) | ||
55 | #define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ) | ||
56 | |||
57 | #define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ) | ||
58 | #define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ) | ||
59 | #define LOCKF_USED_IN_RECLAIM_FS_READ (1 << LOCK_USED_IN_RECLAIM_FS_READ) | ||
60 | #define LOCKF_ENABLED_HARDIRQ_READ (1 << LOCK_ENABLED_HARDIRQ_READ) | ||
61 | #define LOCKF_ENABLED_SOFTIRQ_READ (1 << LOCK_ENABLED_SOFTIRQ_READ) | ||
62 | #define LOCKF_ENABLED_RECLAIM_FS_READ (1 << LOCK_ENABLED_RECLAIM_FS_READ) | ||
63 | |||
64 | #define LOCKF_ENABLED_IRQ_READ \ | ||
65 | (LOCKF_ENABLED_HARDIRQ_READ | LOCKF_ENABLED_SOFTIRQ_READ) | ||
66 | #define LOCKF_USED_IN_IRQ_READ \ | ||
67 | (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ) | ||
68 | 27 | ||
69 | #define MAX_LOCKDEP_SUBCLASSES 8UL | 28 | #define MAX_LOCKDEP_SUBCLASSES 8UL |
70 | 29 | ||
@@ -105,7 +64,7 @@ struct lock_class { | |||
105 | * IRQ/softirq usage tracking bits: | 64 | * IRQ/softirq usage tracking bits: |
106 | */ | 65 | */ |
107 | unsigned long usage_mask; | 66 | unsigned long usage_mask; |
108 | struct stack_trace usage_traces[LOCK_USAGE_STATES]; | 67 | struct stack_trace usage_traces[XXX_LOCK_USAGE_STATES]; |
109 | 68 | ||
110 | /* | 69 | /* |
111 | * These fields represent a directed graph of lock dependencies, | 70 | * These fields represent a directed graph of lock dependencies, |
diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h index e887b783244f..1352409cfef1 100644 --- a/kernel/lockdep_internals.h +++ b/kernel/lockdep_internals.h | |||
@@ -7,6 +7,52 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Lock-class usage-state bits: | ||
11 | */ | ||
12 | enum lock_usage_bit { | ||
13 | LOCK_USED = 0, | ||
14 | LOCK_USED_IN_HARDIRQ, | ||
15 | LOCK_USED_IN_SOFTIRQ, | ||
16 | LOCK_USED_IN_RECLAIM_FS, | ||
17 | LOCK_ENABLED_SOFTIRQ, | ||
18 | LOCK_ENABLED_HARDIRQ, | ||
19 | LOCK_ENABLED_RECLAIM_FS, | ||
20 | LOCK_USED_IN_HARDIRQ_READ, | ||
21 | LOCK_USED_IN_SOFTIRQ_READ, | ||
22 | LOCK_USED_IN_RECLAIM_FS_READ, | ||
23 | LOCK_ENABLED_SOFTIRQ_READ, | ||
24 | LOCK_ENABLED_HARDIRQ_READ, | ||
25 | LOCK_ENABLED_RECLAIM_FS_READ, | ||
26 | LOCK_USAGE_STATES | ||
27 | }; | ||
28 | |||
29 | /* | ||
30 | * Usage-state bitmasks: | ||
31 | */ | ||
32 | #define LOCKF_USED (1 << LOCK_USED) | ||
33 | #define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ) | ||
34 | #define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ) | ||
35 | #define LOCKF_USED_IN_RECLAIM_FS (1 << LOCK_USED_IN_RECLAIM_FS) | ||
36 | #define LOCKF_ENABLED_HARDIRQ (1 << LOCK_ENABLED_HARDIRQ) | ||
37 | #define LOCKF_ENABLED_SOFTIRQ (1 << LOCK_ENABLED_SOFTIRQ) | ||
38 | #define LOCKF_ENABLED_RECLAIM_FS (1 << LOCK_ENABLED_RECLAIM_FS) | ||
39 | |||
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) | ||
42 | |||
43 | #define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ) | ||
44 | #define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ) | ||
45 | #define LOCKF_USED_IN_RECLAIM_FS_READ (1 << LOCK_USED_IN_RECLAIM_FS_READ) | ||
46 | #define LOCKF_ENABLED_HARDIRQ_READ (1 << LOCK_ENABLED_HARDIRQ_READ) | ||
47 | #define LOCKF_ENABLED_SOFTIRQ_READ (1 << LOCK_ENABLED_SOFTIRQ_READ) | ||
48 | #define LOCKF_ENABLED_RECLAIM_FS_READ (1 << LOCK_ENABLED_RECLAIM_FS_READ) | ||
49 | |||
50 | #define LOCKF_ENABLED_IRQ_READ \ | ||
51 | (LOCKF_ENABLED_HARDIRQ_READ | LOCKF_ENABLED_SOFTIRQ_READ) | ||
52 | #define LOCKF_USED_IN_IRQ_READ \ | ||
53 | (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ) | ||
54 | |||
55 | /* | ||
10 | * MAX_LOCKDEP_ENTRIES is the maximum number of lock dependencies | 56 | * MAX_LOCKDEP_ENTRIES is the maximum number of lock dependencies |
11 | * we track. | 57 | * we track. |
12 | * | 58 | * |
diff --git a/kernel/lockdep_states.h b/kernel/lockdep_states.h index 937039ef2dd0..995b0cc2b84c 100644 --- a/kernel/lockdep_states.h +++ b/kernel/lockdep_states.h | |||
@@ -1,3 +1,9 @@ | |||
1 | /* | ||
2 | * Lockdep states, | ||
3 | * | ||
4 | * please update XXX_LOCK_USAGE_STATES in include/linux/lockdep.h whenever | ||
5 | * you add one, or come up with a nice dynamic solution. | ||
6 | */ | ||
1 | LOCKDEP_STATE(HARDIRQ) | 7 | LOCKDEP_STATE(HARDIRQ) |
2 | LOCKDEP_STATE(SOFTIRQ) | 8 | LOCKDEP_STATE(SOFTIRQ) |
3 | LOCKDEP_STATE(RECLAIM_FS) | 9 | LOCKDEP_STATE(RECLAIM_FS) |