Lines Matching refs:class

294 struct lock_class_stats lock_stats(struct lock_class *class)  in lock_stats()  argument
302 &per_cpu(cpu_lock_stats, cpu)[class - lock_classes]; in lock_stats()
323 void clear_lock_stats(struct lock_class *class) in clear_lock_stats() argument
329 &per_cpu(cpu_lock_stats, cpu)[class - lock_classes]; in clear_lock_stats()
333 memset(class->contention_point, 0, sizeof(class->contention_point)); in clear_lock_stats()
334 memset(class->contending_point, 0, sizeof(class->contending_point)); in clear_lock_stats()
337 static struct lock_class_stats *get_lock_stats(struct lock_class *class) in get_lock_stats() argument
339 return &this_cpu_ptr(cpu_lock_stats)[class - lock_classes]; in get_lock_stats()
495 static int class_filter(struct lock_class *class) in class_filter() argument
499 if (class->name_version == 1 && in class_filter()
500 !strcmp(class->name, "lockname")) in class_filter()
502 if (class->name_version == 1 && in class_filter()
503 !strcmp(class->name, "&struct->lockfield")) in class_filter()
511 static int verbose(struct lock_class *class) in verbose() argument
514 return class_filter(class); in verbose()
673 static char get_usage_char(struct lock_class *class, enum lock_usage_bit bit) in get_usage_char() argument
689 if (class->usage_mask & lock_flag(bit + LOCK_USAGE_DIR_MASK)) { in get_usage_char()
691 if (class->usage_mask & lock_flag(bit)) in get_usage_char()
693 } else if (class->usage_mask & lock_flag(bit)) in get_usage_char()
699 void get_usage_chars(struct lock_class *class, char usage[LOCK_USAGE_CHARS]) in get_usage_chars() argument
704 usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE); \ in get_usage_chars()
705 usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE##_READ); in get_usage_chars()
712 static void __print_lock_name(struct held_lock *hlock, struct lock_class *class) in __print_lock_name() argument
717 name = class->name; in __print_lock_name()
719 name = __get_key_name(class->key, str); in __print_lock_name()
723 if (class->name_version > 1) in __print_lock_name()
724 printk(KERN_CONT "#%d", class->name_version); in __print_lock_name()
725 if (class->subclass) in __print_lock_name()
726 printk(KERN_CONT "/%d", class->subclass); in __print_lock_name()
727 if (hlock && class->print_fn) in __print_lock_name()
728 class->print_fn(hlock->instance); in __print_lock_name()
732 static void print_lock_name(struct held_lock *hlock, struct lock_class *class) in print_lock_name() argument
736 get_usage_chars(class, usage); in print_lock_name()
739 __print_lock_name(hlock, class); in print_lock_name()
741 class->wait_type_outer ?: class->wait_type_inner, in print_lock_name()
742 class->wait_type_inner); in print_lock_name()
810 static int very_verbose(struct lock_class *class) in very_verbose() argument
813 return class_filter(class); in very_verbose()
864 struct lock_class *class; in count_matching_names() local
870 list_for_each_entry(class, &all_lock_classes, lock_entry) { in count_matching_names()
871 if (new_class->key - new_class->subclass == class->key) in count_matching_names()
872 return class->name_version; in count_matching_names()
873 if (class->name && !strcmp(class->name, new_class->name)) in count_matching_names()
874 count = max(count, class->name_version); in count_matching_names()
886 struct lock_class *class; in look_up_lock_class() local
926 hlist_for_each_entry_rcu_notrace(class, hash_head, hash_entry) { in look_up_lock_class()
927 if (class->key == key) { in look_up_lock_class()
932 WARN_ONCE(class->name != lock->name && in look_up_lock_class()
935 lock->name, lock->key, class->name); in look_up_lock_class()
936 return class; in look_up_lock_class()
1004 struct lock_class *class; in in_any_class_list() local
1008 class = &lock_classes[i]; in in_any_class_list()
1009 if (in_list(e, &class->locks_after) || in in_any_class_list()
1010 in_list(e, &class->locks_before)) in in_any_class_list()
1027 e->class && e->class->name ? e->class->name : in class_lock_list_valid()
1062 static bool in_any_zapped_class_list(struct lock_class *class) in in_any_zapped_class_list() argument
1068 if (in_list(&class->lock_entry, &pf->zapped)) in in_any_zapped_class_list()
1077 struct lock_class *class; in __check_data_structures() local
1085 class = &lock_classes[i]; in __check_data_structures()
1086 if (!in_list(&class->lock_entry, &all_lock_classes) && in __check_data_structures()
1087 !in_list(&class->lock_entry, &free_lock_classes) && in __check_data_structures()
1088 !in_any_zapped_class_list(class)) { in __check_data_structures()
1090 class, class->name ? : "(?)"); in __check_data_structures()
1097 class = &lock_classes[i]; in __check_data_structures()
1098 if (!class_lock_list_valid(class, &class->locks_before)) in __check_data_structures()
1100 if (!class_lock_list_valid(class, &class->locks_after)) in __check_data_structures()
1122 e->class->name ? : "(?)", in __check_data_structures()
1137 e->class && e->class->name ? e->class->name : in __check_data_structures()
1279 struct lock_class *class; in register_lock_class() local
1284 class = look_up_lock_class(lock, subclass); in register_lock_class()
1285 if (likely(class)) in register_lock_class()
1305 hlist_for_each_entry_rcu(class, hash_head, hash_entry) { in register_lock_class()
1306 if (class->key == key) in register_lock_class()
1313 class = list_first_entry_or_null(&free_lock_classes, typeof(*class), in register_lock_class()
1315 if (!class) { in register_lock_class()
1325 __set_bit(class - lock_classes, lock_classes_in_use); in register_lock_class()
1327 class->key = key; in register_lock_class()
1328 class->name = lock->name; in register_lock_class()
1329 class->subclass = subclass; in register_lock_class()
1330 WARN_ON_ONCE(!list_empty(&class->locks_before)); in register_lock_class()
1331 WARN_ON_ONCE(!list_empty(&class->locks_after)); in register_lock_class()
1332 class->name_version = count_matching_names(class); in register_lock_class()
1333 class->wait_type_inner = lock->wait_type_inner; in register_lock_class()
1334 class->wait_type_outer = lock->wait_type_outer; in register_lock_class()
1335 class->lock_type = lock->lock_type; in register_lock_class()
1340 hlist_add_head_rcu(&class->hash_entry, hash_head); in register_lock_class()
1345 list_move_tail(&class->lock_entry, &all_lock_classes); in register_lock_class()
1346 idx = class - lock_classes; in register_lock_class()
1350 if (verbose(class)) { in register_lock_class()
1353 printk("\nnew class %px: %s", class->key, class->name); in register_lock_class()
1354 if (class->name_version > 1) in register_lock_class()
1355 printk(KERN_CONT "#%d", class->name_version); in register_lock_class()
1368 lock->class_cache[0] = class; in register_lock_class()
1370 lock->class_cache[subclass] = class; in register_lock_class()
1376 if (DEBUG_LOCKS_WARN_ON(class->subclass != subclass)) in register_lock_class()
1379 return class; in register_lock_class()
1422 entry->class = this; in add_lock_to_list()
1514 lock->class->dep_gen_id = lockdep_dependency_gen_id; in mark_lock_accessed()
1525 return lock->class->dep_gen_id == lockdep_dependency_gen_id; in lock_accessed()
1554 void *lock_class = lock->class; in get_dep_list()
1645 struct lock_class *class) in __bfs_init_root() argument
1647 lock->class = class; in __bfs_init_root()
1737 if (!lock->class) in __bfs()
1865 print_lock_name(NULL, target->class); in print_circular_bug_entry()
1877 struct lock_class *parent = prt->class; in print_circular_lock_scenario()
1992 return hlock_class(hlock) == entry->class && /* Found A -> .. -> B */ in hlock_equal()
2019 return hlock_class(hlock) == entry->class && /* Found A -> .. -> B */ in hlock_conflict()
2089 unsigned long lockdep_count_forward_deps(struct lock_class *class) in lockdep_count_forward_deps() argument
2094 __bfs_init_root(&this, class); in lockdep_count_forward_deps()
2115 unsigned long lockdep_count_backward_deps(struct lock_class *class) in lockdep_count_backward_deps() argument
2120 __bfs_init_root(&this, class); in lockdep_count_backward_deps()
2239 *(unsigned long *)mask |= entry->class->usage_mask; in usage_accumulate()
2241 *(unsigned long *)mask |= (entry->class->usage_mask & LOCKF_IRQ); in usage_accumulate()
2258 return !!(entry->class->usage_mask & *(unsigned long *)mask); in usage_match()
2260 return !!((entry->class->usage_mask & LOCKF_IRQ) & *(unsigned long *)mask); in usage_match()
2265 if (entry->class->lock_type == LD_LOCK_NORMAL) in usage_skip()
2294 if (entry->class->lock_type == LD_LOCK_PERCPU && in usage_skip()
2295 DEBUG_LOCKS_WARN_ON(entry->class->wait_type_inner < LD_WAIT_CONFIG)) in usage_skip()
2343 static void print_lock_class_header(struct lock_class *class, int depth) in print_lock_class_header() argument
2348 print_lock_name(NULL, class); in print_lock_class_header()
2350 printk(KERN_CONT " ops: %lu", debug_class_ops_read(class)); in print_lock_class_header()
2355 if (class->usage_mask & (1 << bit)) { in print_lock_class_header()
2360 print_lock_trace(class->usage_traces[bit], len); in print_lock_class_header()
2366 depth, "", class->key, class->key); in print_lock_class_header()
2432 print_lock_class_header(entry->class, depth); in print_shortest_lock_dependencies()
2479 print_lock_class_header(entry->class, depth); in print_shortest_lock_dependencies_backwards()
2508 struct lock_class *safe_class = safe_entry->class; in print_irq_lock_scenario()
2509 struct lock_class *unsafe_class = unsafe_entry->class; in print_irq_lock_scenario()
2597 print_lock_name(NULL, backwards_entry->class); in print_bad_irq_dependency()
2600 print_lock_trace(backwards_entry->class->usage_traces[bit1], 1); in print_bad_irq_dependency()
2603 print_lock_name(NULL, forwards_entry->class); in print_bad_irq_dependency()
2607 print_lock_trace(forwards_entry->class->usage_traces[bit2], 1); in print_bad_irq_dependency()
2845 backward_mask = original_mask(target_entry1->class->usage_mask & LOCKF_ENABLED_IRQ_ALL); in check_irq_usage()
2859 ret = find_exclusive_match(target_entry->class->usage_mask, in check_irq_usage()
2860 target_entry1->class->usage_mask, in check_irq_usage()
2986 struct lock_class *class = hlock_class(prev); in print_deadlock_bug() local
3002 if (class->cmp_fn) { in print_deadlock_bug()
3004 class->cmp_fn(prev->instance, next->instance)); in print_deadlock_bug()
3028 struct lock_class *class; in check_deadlock() local
3049 class = hlock_class(prev); in check_deadlock()
3051 if (class->cmp_fn && in check_deadlock()
3052 class->cmp_fn(prev->instance, next->instance) < 0) in check_deadlock()
3117 struct lock_class *class = hlock_class(prev); in check_prev_add() local
3119 if (class->cmp_fn && in check_prev_add()
3120 class->cmp_fn(prev->instance, next->instance) < 0) in check_prev_add()
3150 if (entry->class == hlock_class(next)) { in check_prev_add()
3172 if (entry->class == hlock_class(prev)) { in check_prev_add()
3780 struct lock_class *class = hlock_class(hlock); in lookup_chain_cache_add() local
3788 if (very_verbose(class)) { in lookup_chain_cache_add()
3792 class->key, class->name); in lookup_chain_cache_add()
3798 if (very_verbose(class)) { in lookup_chain_cache_add()
3800 (unsigned long long)chain_key, class->key, class->name); in lookup_chain_cache_add()
3951 struct lock_class *class = hlock_class(lock); in print_usage_bug_scenario() local
3957 __print_lock_name(lock, class); in print_usage_bug_scenario()
3961 __print_lock_name(lock, class); in print_usage_bug_scenario()
4047 print_lock_name(NULL, other->class); in print_irq_inversion_bug()
4065 middle ? middle->class : root->class, other->class); in print_irq_inversion_bug()
4068 middle ? middle->class : other->class, root->class); in print_irq_inversion_bug()
4106 if (target_entry->class->usage_mask & lock_flag(bit)) { in check_usage_forwards()
4141 if (target_entry->class->usage_mask & lock_flag(bit)) { in check_usage_backwards()
4171 static int HARDIRQ_verbose(struct lock_class *class) in HARDIRQ_verbose() argument
4174 return class_filter(class); in HARDIRQ_verbose()
4179 static int SOFTIRQ_verbose(struct lock_class *class) in SOFTIRQ_verbose() argument
4182 return class_filter(class); in SOFTIRQ_verbose()
4187 static int (*state_verbose_f[])(struct lock_class *class) = {
4195 struct lock_class *class) in state_verbose() argument
4197 return state_verbose_f[bit >> LOCK_USAGE_DIR_MASK](class); in state_verbose()
4797 struct lock_class *class = hlock_class(prev); in check_wait_context() local
4798 u8 prev_inner = class->wait_type_inner; in check_wait_context()
4814 if (unlikely(class->lock_type == LD_LOCK_WAIT_OVERRIDE)) in check_wait_context()
4924 struct lock_class *class = lock->class_cache[0]; in lockdep_set_lock_cmp_fn() local
4930 if (!class) in lockdep_set_lock_cmp_fn()
4931 class = register_lock_class(lock, 0, 0); in lockdep_set_lock_cmp_fn()
4933 if (class) { in lockdep_set_lock_cmp_fn()
4934 WARN_ON(class->cmp_fn && class->cmp_fn != cmp_fn); in lockdep_set_lock_cmp_fn()
4935 WARN_ON(class->print_fn && class->print_fn != print_fn); in lockdep_set_lock_cmp_fn()
4937 class->cmp_fn = cmp_fn; in lockdep_set_lock_cmp_fn()
4938 class->print_fn = print_fn; in lockdep_set_lock_cmp_fn()
4994 struct lock_class *class = NULL; in __lock_acquire() local
5008 class = lock->class_cache[subclass]; in __lock_acquire()
5012 if (unlikely(!class)) { in __lock_acquire()
5013 class = register_lock_class(lock, subclass, 0); in __lock_acquire()
5014 if (!class) in __lock_acquire()
5018 debug_class_ops_inc(class); in __lock_acquire()
5020 if (very_verbose(class)) { in __lock_acquire()
5021 printk("\nacquire class [%px] %s", class->key, class->name); in __lock_acquire()
5022 if (class->name_version > 1) in __lock_acquire()
5023 printk(KERN_CONT "#%d", class->name_version); in __lock_acquire()
5040 class_idx = class - lock_classes; in __lock_acquire()
5067 if (DEBUG_LOCKS_WARN_ON(!class)) in __lock_acquire()
5203 const struct lock_class *class = lock->class_cache[0]; in match_held_lock() local
5205 if (!class) in match_held_lock()
5206 class = look_up_lock_class(lock, 0); in match_held_lock()
5214 if (!class) in match_held_lock()
5225 if (hlock->class_idx == class - lock_classes) in match_held_lock()
5308 struct lock_class *class; in __lock_set_class() local
5332 class = register_lock_class(lock, subclass, 0); in __lock_set_class()
5333 hlock->class_idx = class - lock_classes; in __lock_set_class()
5666 struct lock_class *class = look_up_lock_class(lock, subclass); in verify_lock_unused() local
5670 if (!class) in verify_lock_unused()
5680 if (!(class->usage_mask & mask)) in verify_lock_unused()
5683 hlock->class_idx = class - lock_classes; in verify_lock_unused()
6066 struct lock_class *class) in remove_class_from_lock_chain() argument
6072 if (chain_hlock_class_idx(chain_hlocks[i]) != class - lock_classes) in remove_class_from_lock_chain()
6101 struct lock_class *class) in remove_class_from_lock_chains() argument
6110 remove_class_from_lock_chain(pf, chain, class); in remove_class_from_lock_chains()
6118 static void zap_class(struct pending_free *pf, struct lock_class *class) in zap_class() argument
6123 WARN_ON_ONCE(!class->key); in zap_class()
6131 if (entry->class != class && entry->links_to != class) in zap_class()
6137 if (list_empty(&class->locks_after) && in zap_class()
6138 list_empty(&class->locks_before)) { in zap_class()
6139 list_move_tail(&class->lock_entry, &pf->zapped); in zap_class()
6140 hlist_del_rcu(&class->hash_entry); in zap_class()
6141 WRITE_ONCE(class->key, NULL); in zap_class()
6142 WRITE_ONCE(class->name, NULL); in zap_class()
6144 __clear_bit(class - lock_classes, lock_classes_in_use); in zap_class()
6145 if (class - lock_classes == max_lock_class_idx) in zap_class()
6149 class->name); in zap_class()
6152 remove_class_from_lock_chains(pf, class); in zap_class()
6156 static void reinit_class(struct lock_class *class) in reinit_class() argument
6158 WARN_ON_ONCE(!class->lock_entry.next); in reinit_class()
6159 WARN_ON_ONCE(!list_empty(&class->locks_after)); in reinit_class()
6160 WARN_ON_ONCE(!list_empty(&class->locks_before)); in reinit_class()
6161 memset_startat(class, 0, key); in reinit_class()
6162 WARN_ON_ONCE(!class->lock_entry.next); in reinit_class()
6163 WARN_ON_ONCE(!list_empty(&class->locks_after)); in reinit_class()
6164 WARN_ON_ONCE(!list_empty(&class->locks_before)); in reinit_class()
6210 struct lock_class *class; in __free_zapped_classes() local
6214 list_for_each_entry(class, &pf->zapped, lock_entry) in __free_zapped_classes()
6215 reinit_class(class); in __free_zapped_classes()
6260 struct lock_class *class; in __lockdep_free_key_range() local
6267 hlist_for_each_entry_rcu(class, head, hash_entry) { in __lockdep_free_key_range()
6268 if (!within(class->key, start, size) && in __lockdep_free_key_range()
6269 !within(class->name, start, size)) in __lockdep_free_key_range()
6271 zap_class(pf, class); in __lockdep_free_key_range()
6342 struct lock_class *class; in lock_class_cache_is_registered() local
6348 hlist_for_each_entry_rcu(class, head, hash_entry) { in lock_class_cache_is_registered()
6350 if (lock->class_cache[j] == class) in lock_class_cache_is_registered()
6361 struct lock_class *class; in __lockdep_reset_lock() local
6371 class = look_up_lock_class(lock, j); in __lockdep_reset_lock()
6372 if (class) in __lockdep_reset_lock()
6373 zap_class(pf, class); in __lockdep_reset_lock()