diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-05-12 03:18:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-05-12 03:18:13 -0400 |
commit | eb60b3e5e8dfdd590e586a6fc22daf2f63a7b7e6 (patch) | |
tree | 1b06e2c1beca8f970685eb13096c7a12480526c6 /kernel/locking/lockdep.c | |
parent | 58fe9c4621b7219e724c0b7af053112f974a08c3 (diff) | |
parent | 53d3bc773eaa7ab1cf63585e76af7ee869d5e709 (diff) |
Merge branch 'sched/urgent' into sched/core to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking/lockdep.c')
-rw-r--r-- | kernel/locking/lockdep.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index d7f94f4c811d..68bc6a654ca3 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c | |||
@@ -2177,15 +2177,37 @@ cache_hit: | |||
2177 | chain->irq_context = hlock->irq_context; | 2177 | chain->irq_context = hlock->irq_context; |
2178 | i = get_first_held_lock(curr, hlock); | 2178 | i = get_first_held_lock(curr, hlock); |
2179 | chain->depth = curr->lockdep_depth + 1 - i; | 2179 | chain->depth = curr->lockdep_depth + 1 - i; |
2180 | |||
2181 | BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks)); | ||
2182 | BUILD_BUG_ON((1UL << 6) <= ARRAY_SIZE(curr->held_locks)); | ||
2183 | BUILD_BUG_ON((1UL << 8*sizeof(chain_hlocks[0])) <= ARRAY_SIZE(lock_classes)); | ||
2184 | |||
2180 | if (likely(nr_chain_hlocks + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS)) { | 2185 | if (likely(nr_chain_hlocks + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS)) { |
2181 | chain->base = nr_chain_hlocks; | 2186 | chain->base = nr_chain_hlocks; |
2182 | nr_chain_hlocks += chain->depth; | ||
2183 | for (j = 0; j < chain->depth - 1; j++, i++) { | 2187 | for (j = 0; j < chain->depth - 1; j++, i++) { |
2184 | int lock_id = curr->held_locks[i].class_idx - 1; | 2188 | int lock_id = curr->held_locks[i].class_idx - 1; |
2185 | chain_hlocks[chain->base + j] = lock_id; | 2189 | chain_hlocks[chain->base + j] = lock_id; |
2186 | } | 2190 | } |
2187 | chain_hlocks[chain->base + j] = class - lock_classes; | 2191 | chain_hlocks[chain->base + j] = class - lock_classes; |
2188 | } | 2192 | } |
2193 | |||
2194 | if (nr_chain_hlocks < MAX_LOCKDEP_CHAIN_HLOCKS) | ||
2195 | nr_chain_hlocks += chain->depth; | ||
2196 | |||
2197 | #ifdef CONFIG_DEBUG_LOCKDEP | ||
2198 | /* | ||
2199 | * Important for check_no_collision(). | ||
2200 | */ | ||
2201 | if (unlikely(nr_chain_hlocks > MAX_LOCKDEP_CHAIN_HLOCKS)) { | ||
2202 | if (debug_locks_off_graph_unlock()) | ||
2203 | return 0; | ||
2204 | |||
2205 | print_lockdep_off("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!"); | ||
2206 | dump_stack(); | ||
2207 | return 0; | ||
2208 | } | ||
2209 | #endif | ||
2210 | |||
2189 | hlist_add_head_rcu(&chain->entry, hash_head); | 2211 | hlist_add_head_rcu(&chain->entry, hash_head); |
2190 | debug_atomic_inc(chain_lookup_misses); | 2212 | debug_atomic_inc(chain_lookup_misses); |
2191 | inc_chains(); | 2213 | inc_chains(); |
@@ -2933,6 +2955,11 @@ static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock) | |||
2933 | return 1; | 2955 | return 1; |
2934 | } | 2956 | } |
2935 | 2957 | ||
2958 | static inline unsigned int task_irq_context(struct task_struct *task) | ||
2959 | { | ||
2960 | return 2 * !!task->hardirq_context + !!task->softirq_context; | ||
2961 | } | ||
2962 | |||
2936 | static int separate_irq_context(struct task_struct *curr, | 2963 | static int separate_irq_context(struct task_struct *curr, |
2937 | struct held_lock *hlock) | 2964 | struct held_lock *hlock) |
2938 | { | 2965 | { |
@@ -2941,8 +2968,6 @@ static int separate_irq_context(struct task_struct *curr, | |||
2941 | /* | 2968 | /* |
2942 | * Keep track of points where we cross into an interrupt context: | 2969 | * Keep track of points where we cross into an interrupt context: |
2943 | */ | 2970 | */ |
2944 | hlock->irq_context = 2*(curr->hardirq_context ? 1 : 0) + | ||
2945 | curr->softirq_context; | ||
2946 | if (depth) { | 2971 | if (depth) { |
2947 | struct held_lock *prev_hlock; | 2972 | struct held_lock *prev_hlock; |
2948 | 2973 | ||
@@ -2974,6 +2999,11 @@ static inline int mark_irqflags(struct task_struct *curr, | |||
2974 | return 1; | 2999 | return 1; |
2975 | } | 3000 | } |
2976 | 3001 | ||
3002 | static inline unsigned int task_irq_context(struct task_struct *task) | ||
3003 | { | ||
3004 | return 0; | ||
3005 | } | ||
3006 | |||
2977 | static inline int separate_irq_context(struct task_struct *curr, | 3007 | static inline int separate_irq_context(struct task_struct *curr, |
2978 | struct held_lock *hlock) | 3008 | struct held_lock *hlock) |
2979 | { | 3009 | { |
@@ -3242,6 +3272,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
3242 | hlock->acquire_ip = ip; | 3272 | hlock->acquire_ip = ip; |
3243 | hlock->instance = lock; | 3273 | hlock->instance = lock; |
3244 | hlock->nest_lock = nest_lock; | 3274 | hlock->nest_lock = nest_lock; |
3275 | hlock->irq_context = task_irq_context(curr); | ||
3245 | hlock->trylock = trylock; | 3276 | hlock->trylock = trylock; |
3246 | hlock->read = read; | 3277 | hlock->read = read; |
3247 | hlock->check = check; | 3278 | hlock->check = check; |