Lines Matching refs:hlock
226 static inline struct lock_class *hlock_class(struct held_lock *hlock) in hlock_class() argument
228 unsigned int class_idx = hlock->class_idx; in hlock_class()
347 static void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
355 holdtime = lockstat_clock() - hlock->holdtime_stamp; in lock_release_holdtime()
357 stats = get_lock_stats(hlock_class(hlock)); in lock_release_holdtime()
358 if (hlock->read) in lock_release_holdtime()
364 static inline void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
431 static inline u16 hlock_id(struct held_lock *hlock) in hlock_id() argument
435 return (hlock->class_idx | (hlock->read << MAX_LOCKDEP_KEYS_BITS)); in hlock_id()
719 static void __print_lock_name(struct held_lock *hlock, struct lock_class *class) in __print_lock_name() argument
734 if (hlock && class->print_fn) in __print_lock_name()
735 class->print_fn(hlock->instance); in __print_lock_name()
739 static void print_lock_name(struct held_lock *hlock, struct lock_class *class) in print_lock_name() argument
746 __print_lock_name(hlock, class); in print_lock_name()
764 static void print_lock(struct held_lock *hlock) in print_lock() argument
776 struct lock_class *lock = hlock_class(hlock); in print_lock()
783 printk(KERN_CONT "%px", hlock->instance); in print_lock()
784 print_lock_name(hlock, lock); in print_lock()
785 printk(KERN_CONT ", at: %pS\n", (void *)hlock->acquire_ip); in print_lock()
1678 struct held_lock *hlock) in bfs_init_root() argument
1680 __bfs_init_root(lock, hlock_class(hlock)); in bfs_init_root()
1681 lock->only_xr = (hlock->read == 2); in bfs_init_root()
1692 struct held_lock *hlock) in bfs_init_rootb() argument
1694 __bfs_init_root(lock, hlock_class(hlock)); in bfs_init_rootb()
1695 lock->only_xr = (hlock->read != 0); in bfs_init_rootb()
2007 struct held_lock *hlock = (struct held_lock *)data; in hlock_equal() local
2009 return hlock_class(hlock) == entry->class && /* Found A -> .. -> B */ in hlock_equal()
2010 (hlock->read == 2 || /* A -> B is -(*R)-> */ in hlock_equal()
2034 struct held_lock *hlock = (struct held_lock *)data; in hlock_conflict() local
2036 return hlock_class(hlock) == entry->class && /* Found A -> .. -> B */ in hlock_conflict()
2037 (hlock->read == 0 || /* B -> A is -(E*)-> */ in hlock_conflict()
3263 struct held_lock *hlock; in check_prevs_add() local
3282 hlock = curr->held_locks + depth - 1; in check_prevs_add()
3284 if (hlock->check) { in check_prevs_add()
3285 int ret = check_prev_add(curr, hlock, next, distance, &trace); in check_prevs_add()
3295 if (!hlock->trylock) in check_prevs_add()
3572 struct held_lock *hlock) in get_first_held_lock() argument
3579 if (hlock_curr->irq_context != hlock->irq_context) in get_first_held_lock()
3604 struct held_lock *hlock; in print_chain_keys_held_locks() local
3612 hlock = curr->held_locks + i; in print_chain_keys_held_locks()
3613 chain_key = print_chain_key_iteration(hlock_id(hlock), chain_key); in print_chain_keys_held_locks()
3615 print_lock(hlock); in print_chain_keys_held_locks()
3672 struct held_lock *hlock, in check_no_collision() argument
3678 i = get_first_held_lock(curr, hlock); in check_no_collision()
3681 print_collision(curr, hlock, chain); in check_no_collision()
3689 print_collision(curr, hlock, chain); in check_no_collision()
3732 struct held_lock *hlock, in add_chain_cache() argument
3759 chain->irq_context = hlock->irq_context; in add_chain_cache()
3760 i = get_first_held_lock(curr, hlock); in add_chain_cache()
3785 chain_hlocks[chain->base + j] = hlock_id(hlock); in add_chain_cache()
3818 struct held_lock *hlock, in lookup_chain_cache_add() argument
3821 struct lock_class *class = hlock_class(hlock); in lookup_chain_cache_add()
3826 if (!check_no_collision(curr, hlock, chain)) in lookup_chain_cache_add()
3856 if (!add_chain_cache(curr, hlock, chain_key)) in lookup_chain_cache_add()
3863 struct held_lock *hlock, in validate_chain() argument
3876 if (!hlock->trylock && hlock->check && in validate_chain()
3877 lookup_chain_cache_add(curr, hlock, chain_key)) { in validate_chain()
3896 int ret = check_deadlock(curr, hlock); in validate_chain()
3909 if (!check_prevs_add(curr, hlock)) in validate_chain()
3924 struct held_lock *hlock, in validate_chain() argument
3940 struct held_lock *hlock, *prev_hlock = NULL; in check_chain_key() local
3945 hlock = curr->held_locks + i; in check_chain_key()
3946 if (chain_key != hlock->prev_chain_key) { in check_chain_key()
3955 (unsigned long long)hlock->prev_chain_key); in check_chain_key()
3963 if (DEBUG_LOCKS_WARN_ON(!test_bit(hlock->class_idx, lock_classes_in_use))) in check_chain_key()
3967 hlock->irq_context)) in check_chain_key()
3969 chain_key = iterate_chain_key(chain_key, hlock_id(hlock)); in check_chain_key()
3970 prev_hlock = hlock; in check_chain_key()
4311 struct held_lock *hlock; in mark_held_locks() local
4316 hlock = curr->held_locks + i; in mark_held_locks()
4318 if (hlock->read) in mark_held_locks()
4323 if (!hlock->check) in mark_held_locks()
4326 if (!mark_lock(curr, hlock, hlock_bit)) in mark_held_locks()
4619 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
4628 if (!hlock->trylock) { in mark_usage()
4629 if (hlock->read) { in mark_usage()
4631 if (!mark_lock(curr, hlock, in mark_usage()
4635 if (!mark_lock(curr, hlock, in mark_usage()
4640 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ)) in mark_usage()
4643 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ)) in mark_usage()
4653 if (!hlock->hardirqs_off && !hlock->sync) { in mark_usage()
4654 if (hlock->read) { in mark_usage()
4655 if (!mark_lock(curr, hlock, in mark_usage()
4659 if (!mark_lock(curr, hlock, in mark_usage()
4663 if (!mark_lock(curr, hlock, in mark_usage()
4667 if (!mark_lock(curr, hlock, in mark_usage()
4675 if (!mark_lock(curr, hlock, LOCK_USED)) in mark_usage()
4688 struct held_lock *hlock) in separate_irq_context() argument
4704 if (prev_hlock->irq_context != hlock->irq_context) in separate_irq_context()
4803 struct held_lock *hlock) in print_lock_invalid_wait_context() argument
4821 print_lock(hlock); in print_lock_invalid_wait_context()
4911 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
4922 struct held_lock *hlock) in separate_irq_context() argument
5035 struct held_lock *hlock) in print_lock_nested_lock_not_held() argument
5051 print_lock(hlock); in print_lock_nested_lock_not_held()
5054 pr_warn("%s\n", hlock->nest_lock->name); in print_lock_nested_lock_not_held()
5085 struct held_lock *hlock; in __lock_acquire() local
5143 hlock = curr->held_locks + depth - 1; in __lock_acquire()
5144 if (hlock->class_idx == class_idx && nest_lock) { in __lock_acquire()
5148 if (!hlock->references) in __lock_acquire()
5149 hlock->references++; in __lock_acquire()
5151 hlock->references += references; in __lock_acquire()
5154 if (DEBUG_LOCKS_WARN_ON(hlock->references < references)) in __lock_acquire()
5161 hlock = curr->held_locks + depth; in __lock_acquire()
5168 hlock->class_idx = class_idx; in __lock_acquire()
5169 hlock->acquire_ip = ip; in __lock_acquire()
5170 hlock->instance = lock; in __lock_acquire()
5171 hlock->nest_lock = nest_lock; in __lock_acquire()
5172 hlock->irq_context = task_irq_context(curr); in __lock_acquire()
5173 hlock->trylock = trylock; in __lock_acquire()
5174 hlock->read = read; in __lock_acquire()
5175 hlock->check = check; in __lock_acquire()
5176 hlock->sync = !!sync; in __lock_acquire()
5177 hlock->hardirqs_off = !!hardirqs_off; in __lock_acquire()
5178 hlock->references = references; in __lock_acquire()
5180 hlock->waittime_stamp = 0; in __lock_acquire()
5181 hlock->holdtime_stamp = lockstat_clock(); in __lock_acquire()
5183 hlock->pin_count = pin_count; in __lock_acquire()
5185 if (check_wait_context(curr, hlock)) in __lock_acquire()
5189 if (!mark_usage(curr, hlock, check)) in __lock_acquire()
5218 hlock->prev_chain_key = chain_key; in __lock_acquire()
5219 if (separate_irq_context(curr, hlock)) { in __lock_acquire()
5223 chain_key = iterate_chain_key(chain_key, hlock_id(hlock)); in __lock_acquire()
5226 print_lock_nested_lock_not_held(curr, hlock); in __lock_acquire()
5231 WARN_ON_ONCE(depth && !hlock_class(hlock - 1)->key); in __lock_acquire()
5232 WARN_ON_ONCE(!hlock_class(hlock)->key); in __lock_acquire()
5235 if (!validate_chain(curr, hlock, chain_head, chain_key)) in __lock_acquire()
5239 if (hlock->sync) in __lock_acquire()
5301 static noinstr int match_held_lock(const struct held_lock *hlock, in match_held_lock() argument
5304 if (hlock->instance == lock) in match_held_lock()
5307 if (hlock->references) { in match_held_lock()
5327 if (DEBUG_LOCKS_WARN_ON(!hlock->nest_lock)) in match_held_lock()
5330 if (hlock->class_idx == class - lock_classes) in match_held_lock()
5342 struct held_lock *ret, *hlock, *prev_hlock; in find_held_lock() local
5346 hlock = curr->held_locks + i; in find_held_lock()
5347 ret = hlock; in find_held_lock()
5348 if (match_held_lock(hlock, lock)) in find_held_lock()
5352 for (i--, prev_hlock = hlock--; in find_held_lock()
5354 i--, prev_hlock = hlock--) { in find_held_lock()
5358 if (prev_hlock->irq_context != hlock->irq_context) { in find_held_lock()
5362 if (match_held_lock(hlock, lock)) { in find_held_lock()
5363 ret = hlock; in find_held_lock()
5376 struct held_lock *hlock; in reacquire_held_locks() local
5382 for (hlock = curr->held_locks + idx; idx < depth; idx++, hlock++) { in reacquire_held_locks()
5383 switch (__lock_acquire(hlock->instance, in reacquire_held_locks()
5384 hlock_class(hlock)->subclass, in reacquire_held_locks()
5385 hlock->trylock, in reacquire_held_locks()
5386 hlock->read, hlock->check, in reacquire_held_locks()
5387 hlock->hardirqs_off, in reacquire_held_locks()
5388 hlock->nest_lock, hlock->acquire_ip, in reacquire_held_locks()
5389 hlock->references, hlock->pin_count, 0)) { in reacquire_held_locks()
5412 struct held_lock *hlock; in __lock_set_class() local
5427 hlock = find_held_lock(curr, lock, depth, &i); in __lock_set_class()
5428 if (!hlock) { in __lock_set_class()
5438 hlock->class_idx = class - lock_classes; in __lock_set_class()
5441 curr->curr_chain_key = hlock->prev_chain_key; in __lock_set_class()
5459 struct held_lock *hlock; in __lock_downgrade() local
5473 hlock = find_held_lock(curr, lock, depth, &i); in __lock_downgrade()
5474 if (!hlock) { in __lock_downgrade()
5480 curr->curr_chain_key = hlock->prev_chain_key; in __lock_downgrade()
5482 WARN(hlock->read, "downgrading a read lock"); in __lock_downgrade()
5483 hlock->read = 1; in __lock_downgrade()
5484 hlock->acquire_ip = ip; in __lock_downgrade()
5513 struct held_lock *hlock; in __lock_release() local
5533 hlock = find_held_lock(curr, lock, depth, &i); in __lock_release()
5534 if (!hlock) { in __lock_release()
5539 if (hlock->instance == lock) in __lock_release()
5540 lock_release_holdtime(hlock); in __lock_release()
5542 WARN(hlock->pin_count, "releasing a pinned lock\n"); in __lock_release()
5544 if (hlock->references) { in __lock_release()
5545 hlock->references--; in __lock_release()
5546 if (hlock->references) { in __lock_release()
5563 curr->curr_chain_key = hlock->prev_chain_key; in __lock_release()
5597 struct held_lock *hlock = curr->held_locks + i; in __lock_is_held() local
5599 if (match_held_lock(hlock, lock)) { in __lock_is_held()
5600 if (read == -1 || !!hlock->read == read) in __lock_is_held()
5620 struct held_lock *hlock = curr->held_locks + i; in __lock_pin_lock() local
5622 if (match_held_lock(hlock, lock)) { in __lock_pin_lock()
5629 hlock->pin_count += cookie.val; in __lock_pin_lock()
5647 struct held_lock *hlock = curr->held_locks + i; in __lock_repin_lock() local
5649 if (match_held_lock(hlock, lock)) { in __lock_repin_lock()
5650 hlock->pin_count += cookie.val; in __lock_repin_lock()
5667 struct held_lock *hlock = curr->held_locks + i; in __lock_unpin_lock() local
5669 if (match_held_lock(hlock, lock)) { in __lock_unpin_lock()
5670 if (WARN(!hlock->pin_count, "unpinning an unpinned lock\n")) in __lock_unpin_lock()
5673 hlock->pin_count -= cookie.val; in __lock_unpin_lock()
5675 if (WARN((int)hlock->pin_count < 0, "pin count corrupted\n")) in __lock_unpin_lock()
5676 hlock->pin_count = 0; in __lock_unpin_lock()
5768 static void verify_lock_unused(struct lockdep_map *lock, struct held_lock *hlock, int subclass) in verify_lock_unused() argument
5782 if (!hlock->read) in verify_lock_unused()
5788 hlock->class_idx = class - lock_classes; in verify_lock_unused()
5790 print_usage_bug(current, hlock, LOCK_USED, LOCK_USAGE_STATES); in verify_lock_unused()
5845 struct held_lock hlock; in lock_acquire() local
5847 hlock.acquire_ip = ip; in lock_acquire()
5848 hlock.instance = lock; in lock_acquire()
5849 hlock.nest_lock = nest_lock; in lock_acquire()
5850 hlock.irq_context = 2; // XXX in lock_acquire()
5851 hlock.trylock = trylock; in lock_acquire()
5852 hlock.read = read; in lock_acquire()
5853 hlock.check = check; in lock_acquire()
5854 hlock.hardirqs_off = true; in lock_acquire()
5855 hlock.references = 0; in lock_acquire()
5857 verify_lock_unused(lock, &hlock, subclass); in lock_acquire()
6037 struct held_lock *hlock; in __lock_contended() local
6053 hlock = find_held_lock(curr, lock, depth, &i); in __lock_contended()
6054 if (!hlock) { in __lock_contended()
6059 if (hlock->instance != lock) in __lock_contended()
6062 hlock->waittime_stamp = lockstat_clock(); in __lock_contended()
6064 contention_point = lock_point(hlock_class(hlock)->contention_point, ip); in __lock_contended()
6065 contending_point = lock_point(hlock_class(hlock)->contending_point, in __lock_contended()
6068 stats = get_lock_stats(hlock_class(hlock)); in __lock_contended()
6074 stats->bounces[bounce_contended + !!hlock->read]++; in __lock_contended()
6081 struct held_lock *hlock; in __lock_acquired() local
6098 hlock = find_held_lock(curr, lock, depth, &i); in __lock_acquired()
6099 if (!hlock) { in __lock_acquired()
6104 if (hlock->instance != lock) in __lock_acquired()
6108 if (hlock->waittime_stamp) { in __lock_acquired()
6110 waittime = now - hlock->waittime_stamp; in __lock_acquired()
6111 hlock->holdtime_stamp = now; in __lock_acquired()
6114 stats = get_lock_stats(hlock_class(hlock)); in __lock_acquired()
6116 if (hlock->read) in __lock_acquired()
6122 stats->bounces[bounce_acquired + !!hlock->read]++; in __lock_acquired()
6662 const void *mem_to, struct held_lock *hlock) in print_freed_lock_bug() argument
6678 print_lock(hlock); in print_freed_lock_bug()
6702 struct held_lock *hlock; in debug_check_no_locks_freed() local
6711 hlock = curr->held_locks + i; in debug_check_no_locks_freed()
6713 if (not_in_range(mem_from, mem_len, hlock->instance, in debug_check_no_locks_freed()
6714 sizeof(*hlock->instance))) in debug_check_no_locks_freed()
6717 print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock); in debug_check_no_locks_freed()