Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47514
b: refs/heads/master
c: 381a229
h: refs/heads/master
v: v3
  • Loading branch information
Jarek Poplawski authored and Linus Torvalds committed Feb 11, 2007
1 parent 3f2c1d6 commit e4078a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 898552c9d807fe59f3ecaf9c300c109358375c12
refs/heads/master: 381a229209aa6f7f72375797b7bcfcfe2ae6fcbb
23 changes: 19 additions & 4 deletions trunk/kernel/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ static int graph_lock(void)

static inline int graph_unlock(void)
{
if (debug_locks && !__raw_spin_is_locked(&lockdep_lock))
return DEBUG_LOCKS_WARN_ON(1);

__raw_spin_unlock(&lockdep_lock);
return 0;
}
Expand Down Expand Up @@ -712,6 +715,9 @@ find_usage_backwards(struct lock_class *source, unsigned int depth)
struct lock_list *entry;
int ret;

if (!__raw_spin_is_locked(&lockdep_lock))
return DEBUG_LOCKS_WARN_ON(1);

if (depth > max_recursion_depth)
max_recursion_depth = depth;
if (depth >= RECURSION_LIMIT)
Expand Down Expand Up @@ -1293,7 +1299,8 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
if (!subclass || force)
lock->class_cache = class;

DEBUG_LOCKS_WARN_ON(class->subclass != subclass);
if (DEBUG_LOCKS_WARN_ON(class->subclass != subclass))
return NULL;

return class;
}
Expand All @@ -1308,7 +1315,8 @@ static inline int lookup_chain_cache(u64 chain_key, struct lock_class *class)
struct list_head *hash_head = chainhashentry(chain_key);
struct lock_chain *chain;

DEBUG_LOCKS_WARN_ON(!irqs_disabled());
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
return 0;
/*
* We can walk it lock-free, because entries only get added
* to the hash:
Expand Down Expand Up @@ -1394,7 +1402,9 @@ static void check_chain_key(struct task_struct *curr)
return;
}
id = hlock->class - lock_classes;
DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS);
if (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS))
return;

if (prev_hlock && (prev_hlock->irq_context !=
hlock->irq_context))
chain_key = 0;
Expand Down Expand Up @@ -2205,7 +2215,11 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
if (!check_prevs_add(curr, hlock))
return 0;
graph_unlock();
}
} else
/* after lookup_chain_cache(): */
if (unlikely(!debug_locks))
return 0;

curr->lockdep_depth++;
check_chain_key(curr);
if (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {
Expand All @@ -2214,6 +2228,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
printk("turning off the locking correctness validator.\n");
return 0;
}

if (unlikely(curr->lockdep_depth > max_lockdep_depth))
max_lockdep_depth = curr->lockdep_depth;

Expand Down

0 comments on commit e4078a0

Please sign in to comment.