mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[PATCH] lockdep: better lock debugging
Generic lock debugging:
- generalized lock debugging framework. For example, a bug in one lock
subsystem turns off debugging in all lock subsystems.
- got rid of the caller address passing (__IP__/__IP_DECL__/etc.) from
the mutex/rtmutex debugging code: it caused way too much prototype
hackery, and lockdep will give the same information anyway.
- ability to do silent tests
- check lock freeing in vfree too.
- more finegrained debugging options, to allow distributions to
turn off more expensive debugging features.
There's no separate 'held mutexes' list anymore - but there's a 'held locks'
stack within lockdep, which unifies deadlock detection across all lock
classes. (this is independent of the lockdep validation stuff - lockdep first
checks whether we are holding a lock already)
Here are the current debugging options:
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
which do:
config DEBUG_MUTEXES
bool "Mutex debugging, basic checks"
config DEBUG_LOCK_ALLOC
bool "Detect incorrect freeing of live mutexes"
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Arjan van de Ven <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
fb7e42413a
commit
9a11b49a80
25 changed files with 265 additions and 567 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include <linux/capability.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/debug_locks.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/profile.h>
|
||||
|
|
@ -3142,12 +3143,13 @@ void fastcall add_preempt_count(int val)
|
|||
/*
|
||||
* Underflow?
|
||||
*/
|
||||
BUG_ON((preempt_count() < 0));
|
||||
if (DEBUG_LOCKS_WARN_ON((preempt_count() < 0)))
|
||||
return;
|
||||
preempt_count() += val;
|
||||
/*
|
||||
* Spinlock count overflowing soon?
|
||||
*/
|
||||
BUG_ON((preempt_count() & PREEMPT_MASK) >= PREEMPT_MASK-10);
|
||||
DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >= PREEMPT_MASK-10);
|
||||
}
|
||||
EXPORT_SYMBOL(add_preempt_count);
|
||||
|
||||
|
|
@ -3156,11 +3158,15 @@ void fastcall sub_preempt_count(int val)
|
|||
/*
|
||||
* Underflow?
|
||||
*/
|
||||
BUG_ON(val > preempt_count());
|
||||
if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
|
||||
return;
|
||||
/*
|
||||
* Is the spinlock portion underflowing?
|
||||
*/
|
||||
BUG_ON((val < PREEMPT_MASK) && !(preempt_count() & PREEMPT_MASK));
|
||||
if (DEBUG_LOCKS_WARN_ON((val < PREEMPT_MASK) &&
|
||||
!(preempt_count() & PREEMPT_MASK)))
|
||||
return;
|
||||
|
||||
preempt_count() -= val;
|
||||
}
|
||||
EXPORT_SYMBOL(sub_preempt_count);
|
||||
|
|
@ -4690,7 +4696,7 @@ void show_state(void)
|
|||
} while_each_thread(g, p);
|
||||
|
||||
read_unlock(&tasklist_lock);
|
||||
mutex_debug_show_all_locks();
|
||||
debug_show_all_locks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue