aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking/lockdep.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2015-09-16 10:10:40 -0400
committerIngo Molnar <mingo@kernel.org>2015-09-23 03:48:53 -0400
commit21199f27b430576552b26210b3194a363d7f05cd (patch)
tree3fa021f09a7e2f777b18c35acc801222a466ae36 /kernel/locking/lockdep.c
parentbcee19f424a0d8c26ecf2607b73c690802658b29 (diff)
locking/lockdep: Fix hlock->pin_count reset on lock stack rebuilds
Various people reported hitting the "unpinning an unpinned lock" warning. As it turns out there are 2 places where we take a lock out of the middle of a stack, and in those cases it would fail to preserve the pin_count when rebuilding the lock stack. Reported-by: Sasha Levin <sasha.levin@oracle.com> Reported-by: Tim Spriggs <tspriggs@apple.com> Tested-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: davej@codemonkey.org.uk Link: http://lkml.kernel.org/r/20150916141040.GA11639@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking/lockdep.c')
-rw-r--r--kernel/locking/lockdep.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 8acfbf773e06..4e49cc4c9952 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3068,7 +3068,7 @@ static int __lock_is_held(struct lockdep_map *lock);
3068static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, 3068static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
3069 int trylock, int read, int check, int hardirqs_off, 3069 int trylock, int read, int check, int hardirqs_off,
3070 struct lockdep_map *nest_lock, unsigned long ip, 3070 struct lockdep_map *nest_lock, unsigned long ip,
3071 int references) 3071 int references, int pin_count)
3072{ 3072{
3073 struct task_struct *curr = current; 3073 struct task_struct *curr = current;
3074 struct lock_class *class = NULL; 3074 struct lock_class *class = NULL;
@@ -3157,7 +3157,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
3157 hlock->waittime_stamp = 0; 3157 hlock->waittime_stamp = 0;
3158 hlock->holdtime_stamp = lockstat_clock(); 3158 hlock->holdtime_stamp = lockstat_clock();
3159#endif 3159#endif
3160 hlock->pin_count = 0; 3160 hlock->pin_count = pin_count;
3161 3161
3162 if (check && !mark_irqflags(curr, hlock)) 3162 if (check && !mark_irqflags(curr, hlock))
3163 return 0; 3163 return 0;
@@ -3343,7 +3343,7 @@ found_it:
3343 hlock_class(hlock)->subclass, hlock->trylock, 3343 hlock_class(hlock)->subclass, hlock->trylock,
3344 hlock->read, hlock->check, hlock->hardirqs_off, 3344 hlock->read, hlock->check, hlock->hardirqs_off,
3345 hlock->nest_lock, hlock->acquire_ip, 3345 hlock->nest_lock, hlock->acquire_ip,
3346 hlock->references)) 3346 hlock->references, hlock->pin_count))
3347 return 0; 3347 return 0;
3348 } 3348 }
3349 3349
@@ -3433,7 +3433,7 @@ found_it:
3433 hlock_class(hlock)->subclass, hlock->trylock, 3433 hlock_class(hlock)->subclass, hlock->trylock,
3434 hlock->read, hlock->check, hlock->hardirqs_off, 3434 hlock->read, hlock->check, hlock->hardirqs_off,
3435 hlock->nest_lock, hlock->acquire_ip, 3435 hlock->nest_lock, hlock->acquire_ip,
3436 hlock->references)) 3436 hlock->references, hlock->pin_count))
3437 return 0; 3437 return 0;
3438 } 3438 }
3439 3439
@@ -3583,7 +3583,7 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
3583 current->lockdep_recursion = 1; 3583 current->lockdep_recursion = 1;
3584 trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip); 3584 trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
3585 __lock_acquire(lock, subclass, trylock, read, check, 3585 __lock_acquire(lock, subclass, trylock, read, check,
3586 irqs_disabled_flags(flags), nest_lock, ip, 0); 3586 irqs_disabled_flags(flags), nest_lock, ip, 0, 0);
3587 current->lockdep_recursion = 0; 3587 current->lockdep_recursion = 0;
3588 raw_local_irq_restore(flags); 3588 raw_local_irq_restore(flags);
3589} 3589}