Lines Matching refs:hlock

192 static inline struct lock_class *hlock_class(struct held_lock *hlock)  in hlock_class()  argument
194 unsigned int class_idx = hlock->class_idx; in hlock_class()
313 static void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
321 holdtime = lockstat_clock() - hlock->holdtime_stamp; in lock_release_holdtime()
323 stats = get_lock_stats(hlock_class(hlock)); in lock_release_holdtime()
324 if (hlock->read) in lock_release_holdtime()
330 static inline void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
397 static inline u16 hlock_id(struct held_lock *hlock) in hlock_id() argument
401 return (hlock->class_idx | (hlock->read << MAX_LOCKDEP_KEYS_BITS)); in hlock_id()
726 static void print_lock(struct held_lock *hlock) in print_lock() argument
738 struct lock_class *lock = hlock_class(hlock); in print_lock()
745 printk(KERN_CONT "%px", hlock->instance); in print_lock()
747 printk(KERN_CONT ", at: %pS\n", (void *)hlock->acquire_ip); in print_lock()
1620 struct held_lock *hlock) in bfs_init_root() argument
1622 __bfs_init_root(lock, hlock_class(hlock)); in bfs_init_root()
1623 lock->only_xr = (hlock->read == 2); in bfs_init_root()
1634 struct held_lock *hlock) in bfs_init_rootb() argument
1636 __bfs_init_root(lock, hlock_class(hlock)); in bfs_init_rootb()
1637 lock->only_xr = (hlock->read != 0); in bfs_init_rootb()
1939 struct held_lock *hlock = (struct held_lock *)data; in hlock_equal() local
1941 return hlock_class(hlock) == entry->class && /* Found A -> .. -> B */ in hlock_equal()
1942 (hlock->read == 2 || /* A -> B is -(*R)-> */ in hlock_equal()
1966 struct held_lock *hlock = (struct held_lock *)data; in hlock_conflict() local
1968 return hlock_class(hlock) == entry->class && /* Found A -> .. -> B */ in hlock_conflict()
1969 (hlock->read == 0 || /* B -> A is -(E*)-> */ in hlock_conflict()
3152 struct held_lock *hlock; in check_prevs_add() local
3171 hlock = curr->held_locks + depth - 1; in check_prevs_add()
3173 if (hlock->check) { in check_prevs_add()
3174 int ret = check_prev_add(curr, hlock, next, distance, &trace); in check_prevs_add()
3184 if (!hlock->trylock) in check_prevs_add()
3460 struct held_lock *hlock) in get_first_held_lock() argument
3467 if (hlock_curr->irq_context != hlock->irq_context) in get_first_held_lock()
3492 struct held_lock *hlock; in print_chain_keys_held_locks() local
3500 hlock = curr->held_locks + i; in print_chain_keys_held_locks()
3501 chain_key = print_chain_key_iteration(hlock_id(hlock), chain_key); in print_chain_keys_held_locks()
3503 print_lock(hlock); in print_chain_keys_held_locks()
3556 struct held_lock *hlock, in check_no_collision() argument
3562 i = get_first_held_lock(curr, hlock); in check_no_collision()
3565 print_collision(curr, hlock, chain); in check_no_collision()
3573 print_collision(curr, hlock, chain); in check_no_collision()
3616 struct held_lock *hlock, in add_chain_cache() argument
3641 chain->irq_context = hlock->irq_context; in add_chain_cache()
3642 i = get_first_held_lock(curr, hlock); in add_chain_cache()
3665 chain_hlocks[chain->base + j] = hlock_id(hlock); in add_chain_cache()
3698 struct held_lock *hlock, in lookup_chain_cache_add() argument
3701 struct lock_class *class = hlock_class(hlock); in lookup_chain_cache_add()
3706 if (!check_no_collision(curr, hlock, chain)) in lookup_chain_cache_add()
3736 if (!add_chain_cache(curr, hlock, chain_key)) in lookup_chain_cache_add()
3743 struct held_lock *hlock, in validate_chain() argument
3756 if (!hlock->trylock && hlock->check && in validate_chain()
3757 lookup_chain_cache_add(curr, hlock, chain_key)) { in validate_chain()
3776 int ret = check_deadlock(curr, hlock); in validate_chain()
3789 if (!check_prevs_add(curr, hlock)) in validate_chain()
3804 struct held_lock *hlock, in validate_chain() argument
3820 struct held_lock *hlock, *prev_hlock = NULL; in check_chain_key() local
3825 hlock = curr->held_locks + i; in check_chain_key()
3826 if (chain_key != hlock->prev_chain_key) { in check_chain_key()
3835 (unsigned long long)hlock->prev_chain_key); in check_chain_key()
3843 if (DEBUG_LOCKS_WARN_ON(!test_bit(hlock->class_idx, lock_classes_in_use))) in check_chain_key()
3847 hlock->irq_context)) in check_chain_key()
3849 chain_key = iterate_chain_key(chain_key, hlock_id(hlock)); in check_chain_key()
3850 prev_hlock = hlock; in check_chain_key()
4179 struct held_lock *hlock; in mark_held_locks() local
4184 hlock = curr->held_locks + i; in mark_held_locks()
4186 if (hlock->read) in mark_held_locks()
4191 if (!hlock->check) in mark_held_locks()
4194 if (!mark_lock(curr, hlock, hlock_bit)) in mark_held_locks()
4464 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
4473 if (!hlock->trylock) { in mark_usage()
4474 if (hlock->read) { in mark_usage()
4476 if (!mark_lock(curr, hlock, in mark_usage()
4480 if (!mark_lock(curr, hlock, in mark_usage()
4485 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ)) in mark_usage()
4488 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ)) in mark_usage()
4492 if (!hlock->hardirqs_off) { in mark_usage()
4493 if (hlock->read) { in mark_usage()
4494 if (!mark_lock(curr, hlock, in mark_usage()
4498 if (!mark_lock(curr, hlock, in mark_usage()
4502 if (!mark_lock(curr, hlock, in mark_usage()
4506 if (!mark_lock(curr, hlock, in mark_usage()
4514 if (!mark_lock(curr, hlock, LOCK_USED)) in mark_usage()
4527 struct held_lock *hlock) in separate_irq_context() argument
4543 if (prev_hlock->irq_context != hlock->irq_context) in separate_irq_context()
4640 struct held_lock *hlock) in print_lock_invalid_wait_context() argument
4656 print_lock(hlock); in print_lock_invalid_wait_context()
4735 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
4746 struct held_lock *hlock) in separate_irq_context() argument
4829 struct held_lock *hlock, in print_lock_nested_lock_not_held() argument
4844 print_lock(hlock); in print_lock_nested_lock_not_held()
4847 pr_warn("%s\n", hlock->nest_lock->name); in print_lock_nested_lock_not_held()
4876 struct held_lock *hlock; in __lock_acquire() local
4924 hlock = curr->held_locks + depth - 1; in __lock_acquire()
4925 if (hlock->class_idx == class_idx && nest_lock) { in __lock_acquire()
4929 if (!hlock->references) in __lock_acquire()
4930 hlock->references++; in __lock_acquire()
4932 hlock->references += references; in __lock_acquire()
4935 if (DEBUG_LOCKS_WARN_ON(hlock->references < references)) in __lock_acquire()
4942 hlock = curr->held_locks + depth; in __lock_acquire()
4949 hlock->class_idx = class_idx; in __lock_acquire()
4950 hlock->acquire_ip = ip; in __lock_acquire()
4951 hlock->instance = lock; in __lock_acquire()
4952 hlock->nest_lock = nest_lock; in __lock_acquire()
4953 hlock->irq_context = task_irq_context(curr); in __lock_acquire()
4954 hlock->trylock = trylock; in __lock_acquire()
4955 hlock->read = read; in __lock_acquire()
4956 hlock->check = check; in __lock_acquire()
4957 hlock->hardirqs_off = !!hardirqs_off; in __lock_acquire()
4958 hlock->references = references; in __lock_acquire()
4960 hlock->waittime_stamp = 0; in __lock_acquire()
4961 hlock->holdtime_stamp = lockstat_clock(); in __lock_acquire()
4963 hlock->pin_count = pin_count; in __lock_acquire()
4965 if (check_wait_context(curr, hlock)) in __lock_acquire()
4969 if (!mark_usage(curr, hlock, check)) in __lock_acquire()
4998 hlock->prev_chain_key = chain_key; in __lock_acquire()
4999 if (separate_irq_context(curr, hlock)) { in __lock_acquire()
5003 chain_key = iterate_chain_key(chain_key, hlock_id(hlock)); in __lock_acquire()
5006 print_lock_nested_lock_not_held(curr, hlock, ip); in __lock_acquire()
5011 WARN_ON_ONCE(depth && !hlock_class(hlock - 1)->key); in __lock_acquire()
5012 WARN_ON_ONCE(!hlock_class(hlock)->key); in __lock_acquire()
5015 if (!validate_chain(curr, hlock, chain_head, chain_key)) in __lock_acquire()
5071 static noinstr int match_held_lock(const struct held_lock *hlock, in match_held_lock() argument
5074 if (hlock->instance == lock) in match_held_lock()
5077 if (hlock->references) { in match_held_lock()
5097 if (DEBUG_LOCKS_WARN_ON(!hlock->nest_lock)) in match_held_lock()
5100 if (hlock->class_idx == class - lock_classes) in match_held_lock()
5112 struct held_lock *ret, *hlock, *prev_hlock; in find_held_lock() local
5116 hlock = curr->held_locks + i; in find_held_lock()
5117 ret = hlock; in find_held_lock()
5118 if (match_held_lock(hlock, lock)) in find_held_lock()
5122 for (i--, prev_hlock = hlock--; in find_held_lock()
5124 i--, prev_hlock = hlock--) { in find_held_lock()
5128 if (prev_hlock->irq_context != hlock->irq_context) { in find_held_lock()
5132 if (match_held_lock(hlock, lock)) { in find_held_lock()
5133 ret = hlock; in find_held_lock()
5146 struct held_lock *hlock; in reacquire_held_locks() local
5152 for (hlock = curr->held_locks + idx; idx < depth; idx++, hlock++) { in reacquire_held_locks()
5153 switch (__lock_acquire(hlock->instance, in reacquire_held_locks()
5154 hlock_class(hlock)->subclass, in reacquire_held_locks()
5155 hlock->trylock, in reacquire_held_locks()
5156 hlock->read, hlock->check, in reacquire_held_locks()
5157 hlock->hardirqs_off, in reacquire_held_locks()
5158 hlock->nest_lock, hlock->acquire_ip, in reacquire_held_locks()
5159 hlock->references, hlock->pin_count)) { in reacquire_held_locks()
5182 struct held_lock *hlock; in __lock_set_class() local
5197 hlock = find_held_lock(curr, lock, depth, &i); in __lock_set_class()
5198 if (!hlock) { in __lock_set_class()
5207 hlock->class_idx = class - lock_classes; in __lock_set_class()
5210 curr->curr_chain_key = hlock->prev_chain_key; in __lock_set_class()
5228 struct held_lock *hlock; in __lock_downgrade() local
5242 hlock = find_held_lock(curr, lock, depth, &i); in __lock_downgrade()
5243 if (!hlock) { in __lock_downgrade()
5249 curr->curr_chain_key = hlock->prev_chain_key; in __lock_downgrade()
5251 WARN(hlock->read, "downgrading a read lock"); in __lock_downgrade()
5252 hlock->read = 1; in __lock_downgrade()
5253 hlock->acquire_ip = ip; in __lock_downgrade()
5282 struct held_lock *hlock; in __lock_release() local
5302 hlock = find_held_lock(curr, lock, depth, &i); in __lock_release()
5303 if (!hlock) { in __lock_release()
5308 if (hlock->instance == lock) in __lock_release()
5309 lock_release_holdtime(hlock); in __lock_release()
5311 WARN(hlock->pin_count, "releasing a pinned lock\n"); in __lock_release()
5313 if (hlock->references) { in __lock_release()
5314 hlock->references--; in __lock_release()
5315 if (hlock->references) { in __lock_release()
5332 curr->curr_chain_key = hlock->prev_chain_key; in __lock_release()
5366 struct held_lock *hlock = curr->held_locks + i; in __lock_is_held() local
5368 if (match_held_lock(hlock, lock)) { in __lock_is_held()
5369 if (read == -1 || hlock->read == read) in __lock_is_held()
5389 struct held_lock *hlock = curr->held_locks + i; in __lock_pin_lock() local
5391 if (match_held_lock(hlock, lock)) { in __lock_pin_lock()
5398 hlock->pin_count += cookie.val; in __lock_pin_lock()
5416 struct held_lock *hlock = curr->held_locks + i; in __lock_repin_lock() local
5418 if (match_held_lock(hlock, lock)) { in __lock_repin_lock()
5419 hlock->pin_count += cookie.val; in __lock_repin_lock()
5436 struct held_lock *hlock = curr->held_locks + i; in __lock_unpin_lock() local
5438 if (match_held_lock(hlock, lock)) { in __lock_unpin_lock()
5439 if (WARN(!hlock->pin_count, "unpinning an unpinned lock\n")) in __lock_unpin_lock()
5442 hlock->pin_count -= cookie.val; in __lock_unpin_lock()
5444 if (WARN((int)hlock->pin_count < 0, "pin count corrupted\n")) in __lock_unpin_lock()
5445 hlock->pin_count = 0; in __lock_unpin_lock()
5535 static void verify_lock_unused(struct lockdep_map *lock, struct held_lock *hlock, int subclass) in verify_lock_unused() argument
5549 if (!hlock->read) in verify_lock_unused()
5555 hlock->class_idx = class - lock_classes; in verify_lock_unused()
5557 print_usage_bug(current, hlock, LOCK_USED, LOCK_USAGE_STATES); in verify_lock_unused()
5604 struct held_lock hlock; in lock_acquire() local
5606 hlock.acquire_ip = ip; in lock_acquire()
5607 hlock.instance = lock; in lock_acquire()
5608 hlock.nest_lock = nest_lock; in lock_acquire()
5609 hlock.irq_context = 2; // XXX in lock_acquire()
5610 hlock.trylock = trylock; in lock_acquire()
5611 hlock.read = read; in lock_acquire()
5612 hlock.check = check; in lock_acquire()
5613 hlock.hardirqs_off = true; in lock_acquire()
5614 hlock.references = 0; in lock_acquire()
5616 verify_lock_unused(lock, &hlock, subclass); in lock_acquire()
5763 struct held_lock *hlock; in __lock_contended() local
5776 hlock = find_held_lock(curr, lock, depth, &i); in __lock_contended()
5777 if (!hlock) { in __lock_contended()
5782 if (hlock->instance != lock) in __lock_contended()
5785 hlock->waittime_stamp = lockstat_clock(); in __lock_contended()
5787 contention_point = lock_point(hlock_class(hlock)->contention_point, ip); in __lock_contended()
5788 contending_point = lock_point(hlock_class(hlock)->contending_point, in __lock_contended()
5791 stats = get_lock_stats(hlock_class(hlock)); in __lock_contended()
5797 stats->bounces[bounce_contended + !!hlock->read]++; in __lock_contended()
5804 struct held_lock *hlock; in __lock_acquired() local
5818 hlock = find_held_lock(curr, lock, depth, &i); in __lock_acquired()
5819 if (!hlock) { in __lock_acquired()
5824 if (hlock->instance != lock) in __lock_acquired()
5828 if (hlock->waittime_stamp) { in __lock_acquired()
5830 waittime = now - hlock->waittime_stamp; in __lock_acquired()
5831 hlock->holdtime_stamp = now; in __lock_acquired()
5834 stats = get_lock_stats(hlock_class(hlock)); in __lock_acquired()
5836 if (hlock->read) in __lock_acquired()
5842 stats->bounces[bounce_acquired + !!hlock->read]++; in __lock_acquired()
6358 const void *mem_to, struct held_lock *hlock) in print_freed_lock_bug() argument
6372 print_lock(hlock); in print_freed_lock_bug()
6394 struct held_lock *hlock; in debug_check_no_locks_freed() local
6403 hlock = curr->held_locks + i; in debug_check_no_locks_freed()
6405 if (not_in_range(mem_from, mem_len, hlock->instance, in debug_check_no_locks_freed()
6406 sizeof(*hlock->instance))) in debug_check_no_locks_freed()
6409 print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock); in debug_check_no_locks_freed()