diff options
| -rw-r--r-- | kernel/lockdep.c | 61 |
1 files changed, 23 insertions, 38 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index e0a027d58dab..2d95f9db2598 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -2091,22 +2091,34 @@ mark_lock_irq_used_in(struct task_struct *curr, struct held_lock *this, | |||
| 2091 | } | 2091 | } |
| 2092 | 2092 | ||
| 2093 | static int | 2093 | static int |
| 2094 | mark_lock_irq_used_in_read(struct task_struct *curr, struct held_lock *this, | 2094 | mark_lock_irq_read(struct task_struct *curr, struct held_lock *this, |
| 2095 | int new_bit) | 2095 | int new_bit) |
| 2096 | { | 2096 | { |
| 2097 | const char *name = state_name(new_bit); | 2097 | const char *name = state_name(new_bit); |
| 2098 | const char *rname = state_rname(new_bit); | 2098 | const char *rname = state_rname(new_bit); |
| 2099 | 2099 | ||
| 2100 | int excl_bit = exclusive_bit(new_bit); | 2100 | int excl_bit = exclusive_bit(new_bit); |
| 2101 | int dir = new_bit & 2; | ||
| 2101 | 2102 | ||
| 2102 | if (!valid_state(curr, this, new_bit, excl_bit)) | 2103 | if (!valid_state(curr, this, new_bit, excl_bit)) |
| 2103 | return 0; | 2104 | return 0; |
| 2104 | /* | 2105 | |
| 2105 | * just marked it hardirq-read-safe, check that this lock | 2106 | if (!dir) { |
| 2106 | * took no hardirq-unsafe lock in the past: | 2107 | /* |
| 2107 | */ | 2108 | * just marked it hardirq-read-safe, check that this lock |
| 2108 | if (!check_usage_forwards(curr, this, excl_bit, name)) | 2109 | * took no hardirq-unsafe lock in the past: |
| 2109 | return 0; | 2110 | */ |
| 2111 | if (!check_usage_forwards(curr, this, excl_bit, name)) | ||
| 2112 | return 0; | ||
| 2113 | } else if (STRICT_READ_CHECKS) { | ||
| 2114 | /* | ||
| 2115 | * just marked it hardirq-read-unsafe, check that no | ||
| 2116 | * hardirq-safe lock in the system ever took it in the past: | ||
| 2117 | */ | ||
| 2118 | if (!check_usage_backwards(curr, this, excl_bit, name)) | ||
| 2119 | return 0; | ||
| 2120 | } | ||
| 2121 | |||
| 2110 | if (state_verbose(new_bit, hlock_class(this))) | 2122 | if (state_verbose(new_bit, hlock_class(this))) |
| 2111 | return 2; | 2123 | return 2; |
| 2112 | 2124 | ||
| @@ -2147,31 +2159,6 @@ mark_lock_irq_enabled(struct task_struct *curr, struct held_lock *this, | |||
| 2147 | return 1; | 2159 | return 1; |
| 2148 | } | 2160 | } |
| 2149 | 2161 | ||
| 2150 | static int | ||
| 2151 | mark_lock_irq_enabled_read(struct task_struct *curr, struct held_lock *this, | ||
| 2152 | int new_bit) | ||
| 2153 | { | ||
| 2154 | const char *name = state_name(new_bit); | ||
| 2155 | const char *rname = state_rname(new_bit); | ||
| 2156 | |||
| 2157 | int excl_bit = exclusive_bit(new_bit); | ||
| 2158 | |||
| 2159 | if (!valid_state(curr, this, new_bit, excl_bit)) | ||
| 2160 | return 0; | ||
| 2161 | #if STRICT_READ_CHECKS | ||
| 2162 | /* | ||
| 2163 | * just marked it hardirq-read-unsafe, check that no | ||
| 2164 | * hardirq-safe lock in the system ever took it in the past: | ||
| 2165 | */ | ||
| 2166 | if (!check_usage_backwards(curr, this, excl_bit, name)) | ||
| 2167 | return 0; | ||
| 2168 | #endif | ||
| 2169 | if (verbose(hlock_class(this))) | ||
| 2170 | return 2; | ||
| 2171 | |||
| 2172 | return 1; | ||
| 2173 | } | ||
| 2174 | |||
| 2175 | static int mark_lock_irq(struct task_struct *curr, struct held_lock *this, | 2162 | static int mark_lock_irq(struct task_struct *curr, struct held_lock *this, |
| 2176 | enum lock_usage_bit new_bit) | 2163 | enum lock_usage_bit new_bit) |
| 2177 | { | 2164 | { |
| @@ -2186,18 +2173,16 @@ static int mark_lock_irq(struct task_struct *curr, struct held_lock *this, | |||
| 2186 | case LOCK_USED_IN_HARDIRQ_READ: | 2173 | case LOCK_USED_IN_HARDIRQ_READ: |
| 2187 | case LOCK_USED_IN_SOFTIRQ_READ: | 2174 | case LOCK_USED_IN_SOFTIRQ_READ: |
| 2188 | case LOCK_USED_IN_RECLAIM_FS_READ: | 2175 | case LOCK_USED_IN_RECLAIM_FS_READ: |
| 2189 | return mark_lock_irq_used_in_read(curr, this, new_bit); | 2176 | case LOCK_ENABLED_HARDIRQ_READ: |
| 2177 | case LOCK_ENABLED_SOFTIRQ_READ: | ||
| 2178 | case LOCK_ENABLED_RECLAIM_FS_READ: | ||
| 2179 | return mark_lock_irq_read(curr, this, new_bit); | ||
| 2190 | 2180 | ||
| 2191 | case LOCK_ENABLED_HARDIRQ: | 2181 | case LOCK_ENABLED_HARDIRQ: |
| 2192 | case LOCK_ENABLED_SOFTIRQ: | 2182 | case LOCK_ENABLED_SOFTIRQ: |
| 2193 | case LOCK_ENABLED_RECLAIM_FS: | 2183 | case LOCK_ENABLED_RECLAIM_FS: |
| 2194 | return mark_lock_irq_enabled(curr, this, new_bit); | 2184 | return mark_lock_irq_enabled(curr, this, new_bit); |
| 2195 | 2185 | ||
| 2196 | case LOCK_ENABLED_HARDIRQ_READ: | ||
| 2197 | case LOCK_ENABLED_SOFTIRQ_READ: | ||
| 2198 | case LOCK_ENABLED_RECLAIM_FS_READ: | ||
| 2199 | return mark_lock_irq_enabled_read(curr, this, new_bit); | ||
| 2200 | |||
| 2201 | default: | 2186 | default: |
| 2202 | WARN_ON(1); | 2187 | WARN_ON(1); |
| 2203 | break; | 2188 | break; |
