Lines Matching refs:hlock
156 static inline struct lock_class *hlock_class(struct held_lock *hlock) in hlock_class() argument
158 unsigned int class_idx = hlock->class_idx; in hlock_class()
277 static void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
285 holdtime = lockstat_clock() - hlock->holdtime_stamp; in lock_release_holdtime()
287 stats = get_lock_stats(hlock_class(hlock)); in lock_release_holdtime()
288 if (hlock->read) in lock_release_holdtime()
294 static inline void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
671 static void print_lock(struct held_lock *hlock) in print_lock() argument
683 struct lock_class *lock = hlock_class(hlock); in print_lock()
690 printk(KERN_CONT "%px", hlock->instance); in print_lock()
692 printk(KERN_CONT ", at: %pS\n", (void *)hlock->acquire_ip); in print_lock()
2675 struct held_lock *hlock; in check_prevs_add() local
2694 hlock = curr->held_locks + depth - 1; in check_prevs_add()
2700 if (hlock->read != 2 && hlock->check) { in check_prevs_add()
2701 int ret = check_prev_add(curr, hlock, next, distance, in check_prevs_add()
2712 if (!hlock->trylock) in check_prevs_add()
2758 struct held_lock *hlock) in get_first_held_lock() argument
2765 if (hlock_curr->irq_context != hlock->irq_context) in get_first_held_lock()
2790 struct held_lock *hlock; in print_chain_keys_held_locks() local
2798 hlock = curr->held_locks + i; in print_chain_keys_held_locks()
2799 chain_key = print_chain_key_iteration(hlock->class_idx, chain_key); in print_chain_keys_held_locks()
2801 print_lock(hlock); in print_chain_keys_held_locks()
2854 struct held_lock *hlock, in check_no_collision() argument
2860 i = get_first_held_lock(curr, hlock); in check_no_collision()
2863 print_collision(curr, hlock, chain); in check_no_collision()
2871 print_collision(curr, hlock, chain); in check_no_collision()
2914 struct held_lock *hlock, in add_chain_cache() argument
2917 struct lock_class *class = hlock_class(hlock); in add_chain_cache()
2940 chain->irq_context = hlock->irq_context; in add_chain_cache()
2941 i = get_first_held_lock(curr, hlock); in add_chain_cache()
2997 struct held_lock *hlock, in lookup_chain_cache_add() argument
3000 struct lock_class *class = hlock_class(hlock); in lookup_chain_cache_add()
3005 if (!check_no_collision(curr, hlock, chain)) in lookup_chain_cache_add()
3035 if (!add_chain_cache(curr, hlock, chain_key)) in lookup_chain_cache_add()
3042 struct held_lock *hlock, in validate_chain() argument
3055 if (!hlock->trylock && hlock->check && in validate_chain()
3056 lookup_chain_cache_add(curr, hlock, chain_key)) { in validate_chain()
3075 int ret = check_deadlock(curr, hlock); in validate_chain()
3085 hlock->read = 2; in validate_chain()
3091 if (!check_prevs_add(curr, hlock)) in validate_chain()
3106 struct held_lock *hlock, in validate_chain() argument
3120 struct held_lock *hlock, *prev_hlock = NULL; in check_chain_key() local
3125 hlock = curr->held_locks + i; in check_chain_key()
3126 if (chain_key != hlock->prev_chain_key) { in check_chain_key()
3135 (unsigned long long)hlock->prev_chain_key); in check_chain_key()
3143 if (DEBUG_LOCKS_WARN_ON(!test_bit(hlock->class_idx, lock_classes_in_use))) in check_chain_key()
3147 hlock->irq_context)) in check_chain_key()
3149 chain_key = iterate_chain_key(chain_key, hlock->class_idx); in check_chain_key()
3150 prev_hlock = hlock; in check_chain_key()
3465 struct held_lock *hlock; in mark_held_locks() local
3470 hlock = curr->held_locks + i; in mark_held_locks()
3472 if (hlock->read) in mark_held_locks()
3477 if (!hlock->check) in mark_held_locks()
3480 if (!mark_lock(curr, hlock, hlock_bit)) in mark_held_locks()
3662 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
3671 if (!hlock->trylock) { in mark_usage()
3672 if (hlock->read) { in mark_usage()
3674 if (!mark_lock(curr, hlock, in mark_usage()
3678 if (!mark_lock(curr, hlock, in mark_usage()
3683 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ)) in mark_usage()
3686 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ)) in mark_usage()
3690 if (!hlock->hardirqs_off) { in mark_usage()
3691 if (hlock->read) { in mark_usage()
3692 if (!mark_lock(curr, hlock, in mark_usage()
3696 if (!mark_lock(curr, hlock, in mark_usage()
3700 if (!mark_lock(curr, hlock, in mark_usage()
3704 if (!mark_lock(curr, hlock, in mark_usage()
3712 if (!mark_lock(curr, hlock, LOCK_USED)) in mark_usage()
3725 struct held_lock *hlock) in separate_irq_context() argument
3741 if (prev_hlock->irq_context != hlock->irq_context) in separate_irq_context()
3810 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
3821 struct held_lock *hlock) in separate_irq_context() argument
3893 struct held_lock *hlock, in print_lock_nested_lock_not_held() argument
3908 print_lock(hlock); in print_lock_nested_lock_not_held()
3911 pr_warn("%s\n", hlock->nest_lock->name); in print_lock_nested_lock_not_held()
3940 struct held_lock *hlock; in __lock_acquire() local
3988 hlock = curr->held_locks + depth - 1; in __lock_acquire()
3989 if (hlock->class_idx == class_idx && nest_lock) { in __lock_acquire()
3993 if (!hlock->references) in __lock_acquire()
3994 hlock->references++; in __lock_acquire()
3996 hlock->references += references; in __lock_acquire()
3999 if (DEBUG_LOCKS_WARN_ON(hlock->references < references)) in __lock_acquire()
4006 hlock = curr->held_locks + depth; in __lock_acquire()
4013 hlock->class_idx = class_idx; in __lock_acquire()
4014 hlock->acquire_ip = ip; in __lock_acquire()
4015 hlock->instance = lock; in __lock_acquire()
4016 hlock->nest_lock = nest_lock; in __lock_acquire()
4017 hlock->irq_context = task_irq_context(curr); in __lock_acquire()
4018 hlock->trylock = trylock; in __lock_acquire()
4019 hlock->read = read; in __lock_acquire()
4020 hlock->check = check; in __lock_acquire()
4021 hlock->hardirqs_off = !!hardirqs_off; in __lock_acquire()
4022 hlock->references = references; in __lock_acquire()
4024 hlock->waittime_stamp = 0; in __lock_acquire()
4025 hlock->holdtime_stamp = lockstat_clock(); in __lock_acquire()
4027 hlock->pin_count = pin_count; in __lock_acquire()
4030 if (!mark_usage(curr, hlock, check)) in __lock_acquire()
4059 hlock->prev_chain_key = chain_key; in __lock_acquire()
4060 if (separate_irq_context(curr, hlock)) { in __lock_acquire()
4067 print_lock_nested_lock_not_held(curr, hlock, ip); in __lock_acquire()
4072 WARN_ON_ONCE(depth && !hlock_class(hlock - 1)->key); in __lock_acquire()
4073 WARN_ON_ONCE(!hlock_class(hlock)->key); in __lock_acquire()
4076 if (!validate_chain(curr, hlock, chain_head, chain_key)) in __lock_acquire()
4132 static int match_held_lock(const struct held_lock *hlock, in match_held_lock() argument
4135 if (hlock->instance == lock) in match_held_lock()
4138 if (hlock->references) { in match_held_lock()
4158 if (DEBUG_LOCKS_WARN_ON(!hlock->nest_lock)) in match_held_lock()
4161 if (hlock->class_idx == class - lock_classes) in match_held_lock()
4173 struct held_lock *ret, *hlock, *prev_hlock; in find_held_lock() local
4177 hlock = curr->held_locks + i; in find_held_lock()
4178 ret = hlock; in find_held_lock()
4179 if (match_held_lock(hlock, lock)) in find_held_lock()
4183 for (i--, prev_hlock = hlock--; in find_held_lock()
4185 i--, prev_hlock = hlock--) { in find_held_lock()
4189 if (prev_hlock->irq_context != hlock->irq_context) { in find_held_lock()
4193 if (match_held_lock(hlock, lock)) { in find_held_lock()
4194 ret = hlock; in find_held_lock()
4207 struct held_lock *hlock; in reacquire_held_locks() local
4213 for (hlock = curr->held_locks + idx; idx < depth; idx++, hlock++) { in reacquire_held_locks()
4214 switch (__lock_acquire(hlock->instance, in reacquire_held_locks()
4215 hlock_class(hlock)->subclass, in reacquire_held_locks()
4216 hlock->trylock, in reacquire_held_locks()
4217 hlock->read, hlock->check, in reacquire_held_locks()
4218 hlock->hardirqs_off, in reacquire_held_locks()
4219 hlock->nest_lock, hlock->acquire_ip, in reacquire_held_locks()
4220 hlock->references, hlock->pin_count)) { in reacquire_held_locks()
4243 struct held_lock *hlock; in __lock_set_class() local
4258 hlock = find_held_lock(curr, lock, depth, &i); in __lock_set_class()
4259 if (!hlock) { in __lock_set_class()
4266 hlock->class_idx = class - lock_classes; in __lock_set_class()
4269 curr->curr_chain_key = hlock->prev_chain_key; in __lock_set_class()
4287 struct held_lock *hlock; in __lock_downgrade() local
4301 hlock = find_held_lock(curr, lock, depth, &i); in __lock_downgrade()
4302 if (!hlock) { in __lock_downgrade()
4308 curr->curr_chain_key = hlock->prev_chain_key; in __lock_downgrade()
4310 WARN(hlock->read, "downgrading a read lock"); in __lock_downgrade()
4311 hlock->read = 1; in __lock_downgrade()
4312 hlock->acquire_ip = ip; in __lock_downgrade()
4343 struct held_lock *hlock; in __lock_release() local
4363 hlock = find_held_lock(curr, lock, depth, &i); in __lock_release()
4364 if (!hlock) { in __lock_release()
4369 if (hlock->instance == lock) in __lock_release()
4370 lock_release_holdtime(hlock); in __lock_release()
4372 WARN(hlock->pin_count, "releasing a pinned lock\n"); in __lock_release()
4374 if (hlock->references) { in __lock_release()
4375 hlock->references--; in __lock_release()
4376 if (hlock->references) { in __lock_release()
4393 curr->curr_chain_key = hlock->prev_chain_key; in __lock_release()
4427 struct held_lock *hlock = curr->held_locks + i; in __lock_is_held() local
4429 if (match_held_lock(hlock, lock)) { in __lock_is_held()
4430 if (read == -1 || hlock->read == read) in __lock_is_held()
4450 struct held_lock *hlock = curr->held_locks + i; in __lock_pin_lock() local
4452 if (match_held_lock(hlock, lock)) { in __lock_pin_lock()
4459 hlock->pin_count += cookie.val; in __lock_pin_lock()
4477 struct held_lock *hlock = curr->held_locks + i; in __lock_repin_lock() local
4479 if (match_held_lock(hlock, lock)) { in __lock_repin_lock()
4480 hlock->pin_count += cookie.val; in __lock_repin_lock()
4497 struct held_lock *hlock = curr->held_locks + i; in __lock_unpin_lock() local
4499 if (match_held_lock(hlock, lock)) { in __lock_unpin_lock()
4500 if (WARN(!hlock->pin_count, "unpinning an unpinned lock\n")) in __lock_unpin_lock()
4503 hlock->pin_count -= cookie.val; in __lock_unpin_lock()
4505 if (WARN((int)hlock->pin_count < 0, "pin count corrupted\n")) in __lock_unpin_lock()
4506 hlock->pin_count = 0; in __lock_unpin_lock()
4741 struct held_lock *hlock; in __lock_contended() local
4754 hlock = find_held_lock(curr, lock, depth, &i); in __lock_contended()
4755 if (!hlock) { in __lock_contended()
4760 if (hlock->instance != lock) in __lock_contended()
4763 hlock->waittime_stamp = lockstat_clock(); in __lock_contended()
4765 contention_point = lock_point(hlock_class(hlock)->contention_point, ip); in __lock_contended()
4766 contending_point = lock_point(hlock_class(hlock)->contending_point, in __lock_contended()
4769 stats = get_lock_stats(hlock_class(hlock)); in __lock_contended()
4775 stats->bounces[bounce_contended + !!hlock->read]++; in __lock_contended()
4782 struct held_lock *hlock; in __lock_acquired() local
4796 hlock = find_held_lock(curr, lock, depth, &i); in __lock_acquired()
4797 if (!hlock) { in __lock_acquired()
4802 if (hlock->instance != lock) in __lock_acquired()
4806 if (hlock->waittime_stamp) { in __lock_acquired()
4808 waittime = now - hlock->waittime_stamp; in __lock_acquired()
4809 hlock->holdtime_stamp = now; in __lock_acquired()
4814 stats = get_lock_stats(hlock_class(hlock)); in __lock_acquired()
4816 if (hlock->read) in __lock_acquired()
4822 stats->bounces[bounce_acquired + !!hlock->read]++; in __lock_acquired()
5371 const void *mem_to, struct held_lock *hlock) in print_freed_lock_bug() argument
5385 print_lock(hlock); in print_freed_lock_bug()
5407 struct held_lock *hlock; in debug_check_no_locks_freed() local
5416 hlock = curr->held_locks + i; in debug_check_no_locks_freed()
5418 if (not_in_range(mem_from, mem_len, hlock->instance, in debug_check_no_locks_freed()
5419 sizeof(*hlock->instance))) in debug_check_no_locks_freed()
5422 print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock); in debug_check_no_locks_freed()