aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 93dc70d18cdf..5dcca26a8263 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -42,7 +42,7 @@
42#include <linux/hash.h> 42#include <linux/hash.h>
43#include <linux/ftrace.h> 43#include <linux/ftrace.h>
44#include <linux/stringify.h> 44#include <linux/stringify.h>
45 45#include <linux/bitops.h>
46#include <asm/sections.h> 46#include <asm/sections.h>
47 47
48#include "lockdep_internals.h" 48#include "lockdep_internals.h"
@@ -118,7 +118,7 @@ static inline int debug_locks_off_graph_unlock(void)
118static int lockdep_initialized; 118static int lockdep_initialized;
119 119
120unsigned long nr_list_entries; 120unsigned long nr_list_entries;
121static struct lock_list list_entries[MAX_LOCKDEP_ENTRIES]; 121struct lock_list list_entries[MAX_LOCKDEP_ENTRIES];
122 122
123/* 123/*
124 * All data structures here are protected by the global debug_lock. 124 * All data structures here are protected by the global debug_lock.
@@ -897,30 +897,38 @@ static int add_lock_to_list(struct lock_class *class, struct lock_class *this,
897 return 1; 897 return 1;
898} 898}
899 899
900unsigned long bfs_accessed[BITS_TO_LONGS(MAX_LOCKDEP_ENTRIES)];
900static struct circular_queue lock_cq; 901static struct circular_queue lock_cq;
902
901static int __search_shortest_path(struct lock_list *source_entry, 903static int __search_shortest_path(struct lock_list *source_entry,
902 struct lock_class *target, 904 struct lock_class *target,
903 struct lock_list **target_entry, 905 struct lock_list **target_entry,
904 int forward) 906 int forward)
905{ 907{
906 struct lock_list *entry; 908 struct lock_list *entry;
909 struct list_head *head;
907 struct circular_queue *cq = &lock_cq; 910 struct circular_queue *cq = &lock_cq;
908 int ret = 1; 911 int ret = 1;
909 912
910 __cq_init(cq);
911
912 mark_lock_accessed(source_entry, NULL);
913 if (source_entry->class == target) { 913 if (source_entry->class == target) {
914 *target_entry = source_entry; 914 *target_entry = source_entry;
915 ret = 0; 915 ret = 0;
916 goto exit; 916 goto exit;
917 } 917 }
918 918
919 if (forward)
920 head = &source_entry->class->locks_after;
921 else
922 head = &source_entry->class->locks_before;
923
924 if (list_empty(head))
925 goto exit;
926
927 __cq_init(cq);
919 __cq_enqueue(cq, (unsigned long)source_entry); 928 __cq_enqueue(cq, (unsigned long)source_entry);
920 929
921 while (!__cq_empty(cq)) { 930 while (!__cq_empty(cq)) {
922 struct lock_list *lock; 931 struct lock_list *lock;
923 struct list_head *head;
924 932
925 __cq_dequeue(cq, (unsigned long *)&lock); 933 __cq_dequeue(cq, (unsigned long *)&lock);
926 934
@@ -1040,6 +1048,7 @@ static noinline int print_circular_bug(void)
1040 return 0; 1048 return 0;
1041 1049
1042 this.class = hlock_class(check_source); 1050 this.class = hlock_class(check_source);
1051 this.parent = NULL;
1043 if (!save_trace(&this.trace)) 1052 if (!save_trace(&this.trace))
1044 return 0; 1053 return 0;
1045 1054
@@ -1580,10 +1589,10 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
1580 */ 1589 */
1581 check_source = next; 1590 check_source = next;
1582 check_target = prev; 1591 check_target = prev;
1592
1583 if (check_noncircular(hlock_class(next), 0) == 2) 1593 if (check_noncircular(hlock_class(next), 0) == 2)
1584 return print_circular_bug(); 1594 return print_circular_bug();
1585 1595
1586
1587 if (!check_prev_add_irq(curr, prev, next)) 1596 if (!check_prev_add_irq(curr, prev, next))
1588 return 0; 1597 return 0;
1589 1598