diff options
| -rw-r--r-- | kernel/lockdep.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 938dc500f1aa..b896f23e00cf 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -1115,61 +1115,59 @@ static noinline int print_bfs_bug(int ret) | |||
| 1115 | return 0; | 1115 | return 0; |
| 1116 | } | 1116 | } |
| 1117 | 1117 | ||
| 1118 | unsigned long __lockdep_count_forward_deps(struct lock_class *class, | 1118 | static int noop_count(struct lock_list *entry, void *data) |
| 1119 | unsigned int depth) | ||
| 1120 | { | 1119 | { |
| 1121 | struct lock_list *entry; | 1120 | (*(unsigned long *)data)++; |
| 1122 | unsigned long ret = 1; | 1121 | return 0; |
| 1122 | } | ||
| 1123 | 1123 | ||
| 1124 | if (lockdep_dependency_visit(class, depth)) | 1124 | unsigned long __lockdep_count_forward_deps(struct lock_list *this) |
| 1125 | return 0; | 1125 | { |
| 1126 | unsigned long count = 0; | ||
| 1127 | struct lock_list *uninitialized_var(target_entry); | ||
| 1126 | 1128 | ||
| 1127 | /* | 1129 | __bfs_forwards(this, (void *)&count, noop_count, &target_entry); |
| 1128 | * Recurse this class's dependency list: | ||
| 1129 | */ | ||
| 1130 | list_for_each_entry(entry, &class->locks_after, entry) | ||
| 1131 | ret += __lockdep_count_forward_deps(entry->class, depth + 1); | ||
| 1132 | 1130 | ||
| 1133 | return ret; | 1131 | return count; |
| 1134 | } | 1132 | } |
| 1135 | |||
| 1136 | unsigned long lockdep_count_forward_deps(struct lock_class *class) | 1133 | unsigned long lockdep_count_forward_deps(struct lock_class *class) |
| 1137 | { | 1134 | { |
| 1138 | unsigned long ret, flags; | 1135 | unsigned long ret, flags; |
| 1136 | struct lock_list this; | ||
| 1137 | |||
| 1138 | this.parent = NULL; | ||
| 1139 | this.class = class; | ||
| 1139 | 1140 | ||
| 1140 | local_irq_save(flags); | 1141 | local_irq_save(flags); |
| 1141 | __raw_spin_lock(&lockdep_lock); | 1142 | __raw_spin_lock(&lockdep_lock); |
| 1142 | ret = __lockdep_count_forward_deps(class, 0); | 1143 | ret = __lockdep_count_forward_deps(&this); |
| 1143 | __raw_spin_unlock(&lockdep_lock); | 1144 | __raw_spin_unlock(&lockdep_lock); |
| 1144 | local_irq_restore(flags); | 1145 | local_irq_restore(flags); |
| 1145 | 1146 | ||
| 1146 | return ret; | 1147 | return ret; |
| 1147 | } | 1148 | } |
| 1148 | 1149 | ||
| 1149 | unsigned long __lockdep_count_backward_deps(struct lock_class *class, | 1150 | unsigned long __lockdep_count_backward_deps(struct lock_list *this) |
| 1150 | unsigned int depth) | ||
| 1151 | { | 1151 | { |
| 1152 | struct lock_list *entry; | 1152 | unsigned long count = 0; |
| 1153 | unsigned long ret = 1; | 1153 | struct lock_list *uninitialized_var(target_entry); |
| 1154 | 1154 | ||
| 1155 | if (lockdep_dependency_visit(class, depth)) | 1155 | __bfs_backwards(this, (void *)&count, noop_count, &target_entry); |
| 1156 | return 0; | ||
| 1157 | /* | ||
| 1158 | * Recurse this class's dependency list: | ||
| 1159 | */ | ||
| 1160 | list_for_each_entry(entry, &class->locks_before, entry) | ||
| 1161 | ret += __lockdep_count_backward_deps(entry->class, depth + 1); | ||
| 1162 | 1156 | ||
| 1163 | return ret; | 1157 | return count; |
| 1164 | } | 1158 | } |
| 1165 | 1159 | ||
| 1166 | unsigned long lockdep_count_backward_deps(struct lock_class *class) | 1160 | unsigned long lockdep_count_backward_deps(struct lock_class *class) |
| 1167 | { | 1161 | { |
| 1168 | unsigned long ret, flags; | 1162 | unsigned long ret, flags; |
| 1163 | struct lock_list this; | ||
| 1164 | |||
| 1165 | this.parent = NULL; | ||
| 1166 | this.class = class; | ||
| 1169 | 1167 | ||
| 1170 | local_irq_save(flags); | 1168 | local_irq_save(flags); |
| 1171 | __raw_spin_lock(&lockdep_lock); | 1169 | __raw_spin_lock(&lockdep_lock); |
| 1172 | ret = __lockdep_count_backward_deps(class, 0); | 1170 | ret = __lockdep_count_backward_deps(&this); |
| 1173 | __raw_spin_unlock(&lockdep_lock); | 1171 | __raw_spin_unlock(&lockdep_lock); |
| 1174 | local_irq_restore(flags); | 1172 | local_irq_restore(flags); |
| 1175 | 1173 | ||
