diff options
| -rw-r--r-- | include/linux/lockdep.h | 3 | ||||
| -rw-r--r-- | kernel/lockdep.c | 21 | ||||
| -rw-r--r-- | kernel/lockdep_proc.c | 6 |
3 files changed, 19 insertions, 11 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 8f946f614f8e..3d3386b88b6a 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Runtime locking correctness validator | 2 | * Runtime locking correctness validator |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 4 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | ||
| 5 | * | 6 | * |
| 6 | * see Documentation/lockdep-design.txt for more details. | 7 | * see Documentation/lockdep-design.txt for more details. |
| 7 | */ | 8 | */ |
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index a8dc99d9fef7..cb64022851c8 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -5,7 +5,8 @@ | |||
| 5 | * | 5 | * |
| 6 | * Started by Ingo Molnar: | 6 | * Started by Ingo Molnar: |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | ||
| 9 | * | 10 | * |
| 10 | * this code maps all the lock dependencies as they occur in a live kernel | 11 | * this code maps all the lock dependencies as they occur in a live kernel |
| 11 | * and will warn about the following classes of locking bugs: | 12 | * and will warn about the following classes of locking bugs: |
| @@ -37,6 +38,7 @@ | |||
| 37 | #include <linux/debug_locks.h> | 38 | #include <linux/debug_locks.h> |
| 38 | #include <linux/irqflags.h> | 39 | #include <linux/irqflags.h> |
| 39 | #include <linux/utsname.h> | 40 | #include <linux/utsname.h> |
| 41 | #include <linux/hash.h> | ||
| 40 | 42 | ||
| 41 | #include <asm/sections.h> | 43 | #include <asm/sections.h> |
| 42 | 44 | ||
| @@ -238,8 +240,7 @@ LIST_HEAD(all_lock_classes); | |||
| 238 | */ | 240 | */ |
| 239 | #define CLASSHASH_BITS (MAX_LOCKDEP_KEYS_BITS - 1) | 241 | #define CLASSHASH_BITS (MAX_LOCKDEP_KEYS_BITS - 1) |
| 240 | #define CLASSHASH_SIZE (1UL << CLASSHASH_BITS) | 242 | #define CLASSHASH_SIZE (1UL << CLASSHASH_BITS) |
| 241 | #define CLASSHASH_MASK (CLASSHASH_SIZE - 1) | 243 | #define __classhashfn(key) hash_long((unsigned long)key, CLASSHASH_BITS) |
| 242 | #define __classhashfn(key) ((((unsigned long)key >> CLASSHASH_BITS) + (unsigned long)key) & CLASSHASH_MASK) | ||
| 243 | #define classhashentry(key) (classhash_table + __classhashfn((key))) | 244 | #define classhashentry(key) (classhash_table + __classhashfn((key))) |
| 244 | 245 | ||
| 245 | static struct list_head classhash_table[CLASSHASH_SIZE]; | 246 | static struct list_head classhash_table[CLASSHASH_SIZE]; |
| @@ -250,9 +251,7 @@ static struct list_head classhash_table[CLASSHASH_SIZE]; | |||
| 250 | */ | 251 | */ |
| 251 | #define CHAINHASH_BITS (MAX_LOCKDEP_CHAINS_BITS-1) | 252 | #define CHAINHASH_BITS (MAX_LOCKDEP_CHAINS_BITS-1) |
| 252 | #define CHAINHASH_SIZE (1UL << CHAINHASH_BITS) | 253 | #define CHAINHASH_SIZE (1UL << CHAINHASH_BITS) |
| 253 | #define CHAINHASH_MASK (CHAINHASH_SIZE - 1) | 254 | #define __chainhashfn(chain) hash_long(chain, CHAINHASH_BITS) |
| 254 | #define __chainhashfn(chain) \ | ||
| 255 | (((chain >> CHAINHASH_BITS) + chain) & CHAINHASH_MASK) | ||
| 256 | #define chainhashentry(chain) (chainhash_table + __chainhashfn((chain))) | 255 | #define chainhashentry(chain) (chainhash_table + __chainhashfn((chain))) |
| 257 | 256 | ||
| 258 | static struct list_head chainhash_table[CHAINHASH_SIZE]; | 257 | static struct list_head chainhash_table[CHAINHASH_SIZE]; |
| @@ -676,7 +675,8 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) | |||
| 676 | * (or spin_lock_init()) call - which acts as the key. For static | 675 | * (or spin_lock_init()) call - which acts as the key. For static |
| 677 | * locks we use the lock object itself as the key. | 676 | * locks we use the lock object itself as the key. |
| 678 | */ | 677 | */ |
| 679 | BUILD_BUG_ON(sizeof(struct lock_class_key) > sizeof(struct lock_class)); | 678 | BUILD_BUG_ON(sizeof(struct lock_class_key) > |
| 679 | sizeof(struct lockdep_map)); | ||
| 680 | 680 | ||
| 681 | key = lock->key->subkeys + subclass; | 681 | key = lock->key->subkeys + subclass; |
| 682 | 682 | ||
| @@ -686,9 +686,12 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) | |||
| 686 | * We can walk the hash lockfree, because the hash only | 686 | * We can walk the hash lockfree, because the hash only |
| 687 | * grows, and we are careful when adding entries to the end: | 687 | * grows, and we are careful when adding entries to the end: |
| 688 | */ | 688 | */ |
| 689 | list_for_each_entry(class, hash_head, hash_entry) | 689 | list_for_each_entry(class, hash_head, hash_entry) { |
| 690 | if (class->key == key) | 690 | if (class->key == key) { |
| 691 | WARN_ON_ONCE(class->name != lock->name); | ||
| 691 | return class; | 692 | return class; |
| 693 | } | ||
| 694 | } | ||
| 692 | 695 | ||
| 693 | return NULL; | 696 | return NULL; |
| 694 | } | 697 | } |
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c index e682926c9ad6..39163ed1bf0a 100644 --- a/kernel/lockdep_proc.c +++ b/kernel/lockdep_proc.c | |||
| @@ -5,7 +5,8 @@ | |||
| 5 | * | 5 | * |
| 6 | * Started by Ingo Molnar: | 6 | * Started by Ingo Molnar: |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | ||
| 9 | * | 10 | * |
| 10 | * Code for /proc/lockdep and /proc/lockdep_stats: | 11 | * Code for /proc/lockdep and /proc/lockdep_stats: |
| 11 | * | 12 | * |
| @@ -498,6 +499,9 @@ static void *ls_start(struct seq_file *m, loff_t *pos) | |||
| 498 | if (data->iter == data->stats) | 499 | if (data->iter == data->stats) |
| 499 | seq_header(m); | 500 | seq_header(m); |
| 500 | 501 | ||
| 502 | if (data->iter == data->iter_end) | ||
| 503 | data->iter = NULL; | ||
| 504 | |||
| 501 | return data->iter; | 505 | return data->iter; |
| 502 | } | 506 | } |
| 503 | 507 | ||
