aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
authorHuang, Ying <ying.huang@intel.com>2008-06-22 23:20:54 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-23 19:28:20 -0400
commitcd1a28e8457e6ebf72c48d84d4e736307e86436e (patch)
tree09371914495f7e3803016516ba887b593ea64a9b /kernel/lockdep.c
parent443cd507ce7f78c6f8742b72736585c031d5a921 (diff)
lockdep: add lock_class information to lock_chain and output it
It is based on x86/master branch of git-x86 tree, and has been tested on x86_64 platform. ChangeLog: v2: - Enclosing proc file system related code into CONFIG_PROVE_LOCKING. - Fix nr_chain_hlocks update code. Signed-off-by: Huang Ying <ying.huang@intel.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index a796f1f38ac5..7553a28b99cd 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -1459,7 +1459,7 @@ out_bug:
1459 1459
1460unsigned long nr_lock_chains; 1460unsigned long nr_lock_chains;
1461struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS]; 1461struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS];
1462atomic_t nr_chain_hlocks; 1462int nr_chain_hlocks;
1463static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS]; 1463static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
1464 1464
1465struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i) 1465struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i)
@@ -1481,7 +1481,7 @@ static inline int lookup_chain_cache(struct task_struct *curr,
1481 struct list_head *hash_head = chainhashentry(chain_key); 1481 struct list_head *hash_head = chainhashentry(chain_key);
1482 struct lock_chain *chain; 1482 struct lock_chain *chain;
1483 struct held_lock *hlock_curr, *hlock_next; 1483 struct held_lock *hlock_curr, *hlock_next;
1484 int i, j, n; 1484 int i, j, n, cn;
1485 1485
1486 if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) 1486 if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
1487 return 0; 1487 return 0;
@@ -1540,9 +1540,15 @@ cache_hit:
1540 } 1540 }
1541 i++; 1541 i++;
1542 chain->depth = curr->lockdep_depth + 1 - i; 1542 chain->depth = curr->lockdep_depth + 1 - i;
1543 n = atomic_add_return(chain->depth, &nr_chain_hlocks); 1543 cn = nr_chain_hlocks;
1544 if (unlikely(n < MAX_LOCKDEP_CHAIN_HLOCKS)) { 1544 while (cn + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS) {
1545 chain->base = n - chain->depth; 1545 n = cmpxchg(&nr_chain_hlocks, cn, cn + chain->depth);
1546 if (n == cn)
1547 break;
1548 cn = n;
1549 }
1550 if (likely(cn + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS)) {
1551 chain->base = cn;
1546 for (j = 0; j < chain->depth - 1; j++, i++) { 1552 for (j = 0; j < chain->depth - 1; j++, i++) {
1547 int lock_id = curr->held_locks[i].class - lock_classes; 1553 int lock_id = curr->held_locks[i].class - lock_classes;
1548 chain_hlocks[chain->base + j] = lock_id; 1554 chain_hlocks[chain->base + j] = lock_id;