diff options
-rw-r--r-- | kernel/lockdep.c | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 306d0b823bdb..e0a027d58dab 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -1975,7 +1975,7 @@ void print_irqtrace_events(struct task_struct *curr) | |||
1975 | print_ip_sym(curr->softirq_disable_ip); | 1975 | print_ip_sym(curr->softirq_disable_ip); |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | static int hardirq_verbose(struct lock_class *class) | 1978 | static int HARDIRQ_verbose(struct lock_class *class) |
1979 | { | 1979 | { |
1980 | #if HARDIRQ_VERBOSE | 1980 | #if HARDIRQ_VERBOSE |
1981 | return class_filter(class); | 1981 | return class_filter(class); |
@@ -1983,7 +1983,7 @@ static int hardirq_verbose(struct lock_class *class) | |||
1983 | return 0; | 1983 | return 0; |
1984 | } | 1984 | } |
1985 | 1985 | ||
1986 | static int softirq_verbose(struct lock_class *class) | 1986 | static int SOFTIRQ_verbose(struct lock_class *class) |
1987 | { | 1987 | { |
1988 | #if SOFTIRQ_VERBOSE | 1988 | #if SOFTIRQ_VERBOSE |
1989 | return class_filter(class); | 1989 | return class_filter(class); |
@@ -1991,7 +1991,7 @@ static int softirq_verbose(struct lock_class *class) | |||
1991 | return 0; | 1991 | return 0; |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | static int reclaim_verbose(struct lock_class *class) | 1994 | static int RECLAIM_FS_verbose(struct lock_class *class) |
1995 | { | 1995 | { |
1996 | #if RECLAIM_VERBOSE | 1996 | #if RECLAIM_VERBOSE |
1997 | return class_filter(class); | 1997 | return class_filter(class); |
@@ -2025,6 +2025,19 @@ static inline const char *state_rname(enum lock_usage_bit bit) | |||
2025 | return state_rnames[bit >> 2]; | 2025 | return state_rnames[bit >> 2]; |
2026 | } | 2026 | } |
2027 | 2027 | ||
2028 | static int (*state_verbose_f[])(struct lock_class *class) = { | ||
2029 | #define LOCKDEP_STATE(__STATE) \ | ||
2030 | __STATE##_verbose, | ||
2031 | #include "lockdep_states.h" | ||
2032 | #undef LOCKDEP_STATE | ||
2033 | }; | ||
2034 | |||
2035 | static inline int state_verbose(enum lock_usage_bit bit, | ||
2036 | struct lock_class *class) | ||
2037 | { | ||
2038 | return state_verbose_f[bit >> 2](class); | ||
2039 | } | ||
2040 | |||
2028 | static int exclusive_bit(int new_bit) | 2041 | static int exclusive_bit(int new_bit) |
2029 | { | 2042 | { |
2030 | /* | 2043 | /* |
@@ -2046,8 +2059,7 @@ static int exclusive_bit(int new_bit) | |||
2046 | 2059 | ||
2047 | static int | 2060 | static int |
2048 | mark_lock_irq_used_in(struct task_struct *curr, struct held_lock *this, | 2061 | mark_lock_irq_used_in(struct task_struct *curr, struct held_lock *this, |
2049 | int new_bit, | 2062 | int new_bit) |
2050 | int (*verbose)(struct lock_class *class)) | ||
2051 | { | 2063 | { |
2052 | const char *name = state_name(new_bit); | 2064 | const char *name = state_name(new_bit); |
2053 | const char *rname = state_rname(new_bit); | 2065 | const char *rname = state_rname(new_bit); |
@@ -2072,7 +2084,7 @@ mark_lock_irq_used_in(struct task_struct *curr, struct held_lock *this, | |||
2072 | if (!check_usage_forwards(curr, this, excl_bit + 1, rname)) | 2084 | if (!check_usage_forwards(curr, this, excl_bit + 1, rname)) |
2073 | return 0; | 2085 | return 0; |
2074 | #endif | 2086 | #endif |
2075 | if (verbose(hlock_class(this))) | 2087 | if (state_verbose(new_bit, hlock_class(this))) |
2076 | return 2; | 2088 | return 2; |
2077 | 2089 | ||
2078 | return 1; | 2090 | return 1; |
@@ -2080,8 +2092,7 @@ mark_lock_irq_used_in(struct task_struct *curr, struct held_lock *this, | |||
2080 | 2092 | ||
2081 | static int | 2093 | static int |
2082 | mark_lock_irq_used_in_read(struct task_struct *curr, struct held_lock *this, | 2094 | mark_lock_irq_used_in_read(struct task_struct *curr, struct held_lock *this, |
2083 | int new_bit, | 2095 | int new_bit) |
2084 | int (*verbose)(struct lock_class *class)) | ||
2085 | { | 2096 | { |
2086 | const char *name = state_name(new_bit); | 2097 | const char *name = state_name(new_bit); |
2087 | const char *rname = state_rname(new_bit); | 2098 | const char *rname = state_rname(new_bit); |
@@ -2096,7 +2107,7 @@ mark_lock_irq_used_in_read(struct task_struct *curr, struct held_lock *this, | |||
2096 | */ | 2107 | */ |
2097 | if (!check_usage_forwards(curr, this, excl_bit, name)) | 2108 | if (!check_usage_forwards(curr, this, excl_bit, name)) |
2098 | return 0; | 2109 | return 0; |
2099 | if (verbose(hlock_class(this))) | 2110 | if (state_verbose(new_bit, hlock_class(this))) |
2100 | return 2; | 2111 | return 2; |
2101 | 2112 | ||
2102 | return 1; | 2113 | return 1; |
@@ -2104,8 +2115,7 @@ mark_lock_irq_used_in_read(struct task_struct *curr, struct held_lock *this, | |||
2104 | 2115 | ||
2105 | static int | 2116 | static int |
2106 | mark_lock_irq_enabled(struct task_struct *curr, struct held_lock *this, | 2117 | mark_lock_irq_enabled(struct task_struct *curr, struct held_lock *this, |
2107 | int new_bit, | 2118 | int new_bit) |
2108 | int (*verbose)(struct lock_class *class)) | ||
2109 | { | 2119 | { |
2110 | const char *name = state_name(new_bit); | 2120 | const char *name = state_name(new_bit); |
2111 | const char *rname = state_rname(new_bit); | 2121 | const char *rname = state_rname(new_bit); |
@@ -2131,7 +2141,7 @@ mark_lock_irq_enabled(struct task_struct *curr, struct held_lock *this, | |||
2131 | if (!check_usage_backwards(curr, this, excl_bit + 1, rname)) | 2141 | if (!check_usage_backwards(curr, this, excl_bit + 1, rname)) |
2132 | return 0; | 2142 | return 0; |
2133 | #endif | 2143 | #endif |
2134 | if (verbose(hlock_class(this))) | 2144 | if (state_verbose(new_bit, hlock_class(this))) |
2135 | return 2; | 2145 | return 2; |
2136 | 2146 | ||
2137 | return 1; | 2147 | return 1; |
@@ -2139,8 +2149,7 @@ mark_lock_irq_enabled(struct task_struct *curr, struct held_lock *this, | |||
2139 | 2149 | ||
2140 | static int | 2150 | static int |
2141 | mark_lock_irq_enabled_read(struct task_struct *curr, struct held_lock *this, | 2151 | mark_lock_irq_enabled_read(struct task_struct *curr, struct held_lock *this, |
2142 | int new_bit, | 2152 | int new_bit) |
2143 | int (*verbose)(struct lock_class *class)) | ||
2144 | { | 2153 | { |
2145 | const char *name = state_name(new_bit); | 2154 | const char *name = state_name(new_bit); |
2146 | const char *rname = state_rname(new_bit); | 2155 | const char *rname = state_rname(new_bit); |
@@ -2170,44 +2179,24 @@ static int mark_lock_irq(struct task_struct *curr, struct held_lock *this, | |||
2170 | 2179 | ||
2171 | switch(new_bit) { | 2180 | switch(new_bit) { |
2172 | case LOCK_USED_IN_HARDIRQ: | 2181 | case LOCK_USED_IN_HARDIRQ: |
2173 | return mark_lock_irq_used_in(curr, this, new_bit, | ||
2174 | hardirq_verbose); | ||
2175 | case LOCK_USED_IN_SOFTIRQ: | 2182 | case LOCK_USED_IN_SOFTIRQ: |
2176 | return mark_lock_irq_used_in(curr, this, new_bit, | ||
2177 | softirq_verbose); | ||
2178 | case LOCK_USED_IN_RECLAIM_FS: | 2183 | case LOCK_USED_IN_RECLAIM_FS: |
2179 | return mark_lock_irq_used_in(curr, this, new_bit, | 2184 | return mark_lock_irq_used_in(curr, this, new_bit); |
2180 | reclaim_verbose); | ||
2181 | 2185 | ||
2182 | case LOCK_USED_IN_HARDIRQ_READ: | 2186 | case LOCK_USED_IN_HARDIRQ_READ: |
2183 | return mark_lock_irq_used_in_read(curr, this, new_bit, | ||
2184 | hardirq_verbose); | ||
2185 | case LOCK_USED_IN_SOFTIRQ_READ: | 2187 | case LOCK_USED_IN_SOFTIRQ_READ: |
2186 | return mark_lock_irq_used_in_read(curr, this, new_bit, | ||
2187 | softirq_verbose); | ||
2188 | case LOCK_USED_IN_RECLAIM_FS_READ: | 2188 | case LOCK_USED_IN_RECLAIM_FS_READ: |
2189 | return mark_lock_irq_used_in_read(curr, this, new_bit, | 2189 | return mark_lock_irq_used_in_read(curr, this, new_bit); |
2190 | reclaim_verbose); | ||
2191 | 2190 | ||
2192 | case LOCK_ENABLED_HARDIRQ: | 2191 | case LOCK_ENABLED_HARDIRQ: |
2193 | return mark_lock_irq_enabled(curr, this, new_bit, | ||
2194 | hardirq_verbose); | ||
2195 | case LOCK_ENABLED_SOFTIRQ: | 2192 | case LOCK_ENABLED_SOFTIRQ: |
2196 | return mark_lock_irq_enabled(curr, this, new_bit, | ||
2197 | softirq_verbose); | ||
2198 | case LOCK_ENABLED_RECLAIM_FS: | 2193 | case LOCK_ENABLED_RECLAIM_FS: |
2199 | return mark_lock_irq_enabled(curr, this, new_bit, | 2194 | return mark_lock_irq_enabled(curr, this, new_bit); |
2200 | reclaim_verbose); | ||
2201 | 2195 | ||
2202 | case LOCK_ENABLED_HARDIRQ_READ: | 2196 | case LOCK_ENABLED_HARDIRQ_READ: |
2203 | return mark_lock_irq_enabled_read(curr, this, new_bit, | ||
2204 | hardirq_verbose); | ||
2205 | case LOCK_ENABLED_SOFTIRQ_READ: | 2197 | case LOCK_ENABLED_SOFTIRQ_READ: |
2206 | return mark_lock_irq_enabled_read(curr, this, new_bit, | ||
2207 | softirq_verbose); | ||
2208 | case LOCK_ENABLED_RECLAIM_FS_READ: | 2198 | case LOCK_ENABLED_RECLAIM_FS_READ: |
2209 | return mark_lock_irq_enabled_read(curr, this, new_bit, | 2199 | return mark_lock_irq_enabled_read(curr, this, new_bit); |
2210 | reclaim_verbose); | ||
2211 | 2200 | ||
2212 | default: | 2201 | default: |
2213 | WARN_ON(1); | 2202 | WARN_ON(1); |