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
672 static void print_lock(struct held_lock *hlock) in print_lock() argument
684 struct lock_class *lock = hlock_class(hlock); in print_lock()
691 printk(KERN_CONT "%px", hlock->instance); in print_lock()
693 printk(KERN_CONT ", at: %pS\n", (void *)hlock->acquire_ip); in print_lock()
2555 struct held_lock *hlock; in check_prevs_add() local
2574 hlock = curr->held_locks + depth - 1; in check_prevs_add()
2580 if (hlock->read != 2 && hlock->check) { in check_prevs_add()
2581 int ret = check_prev_add(curr, hlock, next, distance, in check_prevs_add()
2592 if (!hlock->trylock) in check_prevs_add()
2638 struct held_lock *hlock) in get_first_held_lock() argument
2645 if (hlock_curr->irq_context != hlock->irq_context) in get_first_held_lock()
2670 struct held_lock *hlock; in print_chain_keys_held_locks() local
2678 hlock = curr->held_locks + i; in print_chain_keys_held_locks()
2679 chain_key = print_chain_key_iteration(hlock->class_idx, chain_key); in print_chain_keys_held_locks()
2681 print_lock(hlock); in print_chain_keys_held_locks()
2734 struct held_lock *hlock, in check_no_collision() argument
2740 i = get_first_held_lock(curr, hlock); in check_no_collision()
2743 print_collision(curr, hlock, chain); in check_no_collision()
2751 print_collision(curr, hlock, chain); in check_no_collision()
2794 struct held_lock *hlock, in add_chain_cache() argument
2797 struct lock_class *class = hlock_class(hlock); in add_chain_cache()
2820 chain->irq_context = hlock->irq_context; in add_chain_cache()
2821 i = get_first_held_lock(curr, hlock); in add_chain_cache()
2877 struct held_lock *hlock, in lookup_chain_cache_add() argument
2880 struct lock_class *class = hlock_class(hlock); in lookup_chain_cache_add()
2885 if (!check_no_collision(curr, hlock, chain)) in lookup_chain_cache_add()
2915 if (!add_chain_cache(curr, hlock, chain_key)) in lookup_chain_cache_add()
2922 struct held_lock *hlock, in validate_chain() argument
2935 if (!hlock->trylock && hlock->check && in validate_chain()
2936 lookup_chain_cache_add(curr, hlock, chain_key)) { in validate_chain()
2955 int ret = check_deadlock(curr, hlock); in validate_chain()
2965 hlock->read = 2; in validate_chain()
2971 if (!check_prevs_add(curr, hlock)) in validate_chain()
2986 struct held_lock *hlock, in validate_chain() argument
3000 struct held_lock *hlock, *prev_hlock = NULL; in check_chain_key() local
3005 hlock = curr->held_locks + i; in check_chain_key()
3006 if (chain_key != hlock->prev_chain_key) { in check_chain_key()
3015 (unsigned long long)hlock->prev_chain_key); in check_chain_key()
3023 if (DEBUG_LOCKS_WARN_ON(!test_bit(hlock->class_idx, lock_classes_in_use))) in check_chain_key()
3027 hlock->irq_context)) in check_chain_key()
3029 chain_key = iterate_chain_key(chain_key, hlock->class_idx); in check_chain_key()
3030 prev_hlock = hlock; in check_chain_key()
3345 struct held_lock *hlock; in mark_held_locks() local
3350 hlock = curr->held_locks + i; in mark_held_locks()
3352 if (hlock->read) in mark_held_locks()
3357 if (!hlock->check) in mark_held_locks()
3360 if (!mark_lock(curr, hlock, hlock_bit)) in mark_held_locks()
3542 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
3551 if (!hlock->trylock) { in mark_usage()
3552 if (hlock->read) { in mark_usage()
3554 if (!mark_lock(curr, hlock, in mark_usage()
3558 if (!mark_lock(curr, hlock, in mark_usage()
3563 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ)) in mark_usage()
3566 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ)) in mark_usage()
3570 if (!hlock->hardirqs_off) { in mark_usage()
3571 if (hlock->read) { in mark_usage()
3572 if (!mark_lock(curr, hlock, in mark_usage()
3576 if (!mark_lock(curr, hlock, in mark_usage()
3580 if (!mark_lock(curr, hlock, in mark_usage()
3584 if (!mark_lock(curr, hlock, in mark_usage()
3592 if (!mark_lock(curr, hlock, LOCK_USED)) in mark_usage()
3604 struct held_lock *hlock) in separate_irq_context() argument
3620 if (prev_hlock->irq_context != hlock->irq_context) in separate_irq_context()
3689 mark_usage(struct task_struct *curr, struct held_lock *hlock, int check) in mark_usage() argument
3700 struct held_lock *hlock) in separate_irq_context() argument
3772 struct held_lock *hlock, in print_lock_nested_lock_not_held() argument
3787 print_lock(hlock); in print_lock_nested_lock_not_held()
3790 pr_warn("%s\n", hlock->nest_lock->name); in print_lock_nested_lock_not_held()
3819 struct held_lock *hlock; in __lock_acquire() local
3867 hlock = curr->held_locks + depth - 1; in __lock_acquire()
3868 if (hlock->class_idx == class_idx && nest_lock) { in __lock_acquire()
3872 if (!hlock->references) in __lock_acquire()
3873 hlock->references++; in __lock_acquire()
3875 hlock->references += references; in __lock_acquire()
3878 if (DEBUG_LOCKS_WARN_ON(hlock->references < references)) in __lock_acquire()
3885 hlock = curr->held_locks + depth; in __lock_acquire()
3892 hlock->class_idx = class_idx; in __lock_acquire()
3893 hlock->acquire_ip = ip; in __lock_acquire()
3894 hlock->instance = lock; in __lock_acquire()
3895 hlock->nest_lock = nest_lock; in __lock_acquire()
3896 hlock->irq_context = task_irq_context(curr); in __lock_acquire()
3897 hlock->trylock = trylock; in __lock_acquire()
3898 hlock->read = read; in __lock_acquire()
3899 hlock->check = check; in __lock_acquire()
3900 hlock->hardirqs_off = !!hardirqs_off; in __lock_acquire()
3901 hlock->references = references; in __lock_acquire()
3903 hlock->waittime_stamp = 0; in __lock_acquire()
3904 hlock->holdtime_stamp = lockstat_clock(); in __lock_acquire()
3906 hlock->pin_count = pin_count; in __lock_acquire()
3909 if (!mark_usage(curr, hlock, check)) in __lock_acquire()
3938 hlock->prev_chain_key = chain_key; in __lock_acquire()
3939 if (separate_irq_context(curr, hlock)) { in __lock_acquire()
3946 print_lock_nested_lock_not_held(curr, hlock, ip); in __lock_acquire()
3951 WARN_ON_ONCE(depth && !hlock_class(hlock - 1)->key); in __lock_acquire()
3952 WARN_ON_ONCE(!hlock_class(hlock)->key); in __lock_acquire()
3955 if (!validate_chain(curr, hlock, chain_head, chain_key)) in __lock_acquire()
4011 static int match_held_lock(const struct held_lock *hlock, in match_held_lock() argument
4014 if (hlock->instance == lock) in match_held_lock()
4017 if (hlock->references) { in match_held_lock()
4037 if (DEBUG_LOCKS_WARN_ON(!hlock->nest_lock)) in match_held_lock()
4040 if (hlock->class_idx == class - lock_classes) in match_held_lock()
4052 struct held_lock *ret, *hlock, *prev_hlock; in find_held_lock() local
4056 hlock = curr->held_locks + i; in find_held_lock()
4057 ret = hlock; in find_held_lock()
4058 if (match_held_lock(hlock, lock)) in find_held_lock()
4062 for (i--, prev_hlock = hlock--; in find_held_lock()
4064 i--, prev_hlock = hlock--) { in find_held_lock()
4068 if (prev_hlock->irq_context != hlock->irq_context) { in find_held_lock()
4072 if (match_held_lock(hlock, lock)) { in find_held_lock()
4073 ret = hlock; in find_held_lock()
4086 struct held_lock *hlock; in reacquire_held_locks() local
4092 for (hlock = curr->held_locks + idx; idx < depth; idx++, hlock++) { in reacquire_held_locks()
4093 switch (__lock_acquire(hlock->instance, in reacquire_held_locks()
4094 hlock_class(hlock)->subclass, in reacquire_held_locks()
4095 hlock->trylock, in reacquire_held_locks()
4096 hlock->read, hlock->check, in reacquire_held_locks()
4097 hlock->hardirqs_off, in reacquire_held_locks()
4098 hlock->nest_lock, hlock->acquire_ip, in reacquire_held_locks()
4099 hlock->references, hlock->pin_count)) { in reacquire_held_locks()
4122 struct held_lock *hlock; in __lock_set_class() local
4137 hlock = find_held_lock(curr, lock, depth, &i); in __lock_set_class()
4138 if (!hlock) { in __lock_set_class()
4145 hlock->class_idx = class - lock_classes; in __lock_set_class()
4148 curr->curr_chain_key = hlock->prev_chain_key; in __lock_set_class()
4166 struct held_lock *hlock; in __lock_downgrade() local
4180 hlock = find_held_lock(curr, lock, depth, &i); in __lock_downgrade()
4181 if (!hlock) { in __lock_downgrade()
4187 curr->curr_chain_key = hlock->prev_chain_key; in __lock_downgrade()
4189 WARN(hlock->read, "downgrading a read lock"); in __lock_downgrade()
4190 hlock->read = 1; in __lock_downgrade()
4191 hlock->acquire_ip = ip; in __lock_downgrade()
4222 struct held_lock *hlock; in __lock_release() local
4242 hlock = find_held_lock(curr, lock, depth, &i); in __lock_release()
4243 if (!hlock) { in __lock_release()
4248 if (hlock->instance == lock) in __lock_release()
4249 lock_release_holdtime(hlock); in __lock_release()
4251 WARN(hlock->pin_count, "releasing a pinned lock\n"); in __lock_release()
4253 if (hlock->references) { in __lock_release()
4254 hlock->references--; in __lock_release()
4255 if (hlock->references) { in __lock_release()
4272 curr->curr_chain_key = hlock->prev_chain_key; in __lock_release()
4306 struct held_lock *hlock = curr->held_locks + i; in __lock_is_held() local
4308 if (match_held_lock(hlock, lock)) { in __lock_is_held()
4309 if (read == -1 || hlock->read == read) in __lock_is_held()
4329 struct held_lock *hlock = curr->held_locks + i; in __lock_pin_lock() local
4331 if (match_held_lock(hlock, lock)) { in __lock_pin_lock()
4338 hlock->pin_count += cookie.val; in __lock_pin_lock()
4356 struct held_lock *hlock = curr->held_locks + i; in __lock_repin_lock() local
4358 if (match_held_lock(hlock, lock)) { in __lock_repin_lock()
4359 hlock->pin_count += cookie.val; in __lock_repin_lock()
4376 struct held_lock *hlock = curr->held_locks + i; in __lock_unpin_lock() local
4378 if (match_held_lock(hlock, lock)) { in __lock_unpin_lock()
4379 if (WARN(!hlock->pin_count, "unpinning an unpinned lock\n")) in __lock_unpin_lock()
4382 hlock->pin_count -= cookie.val; in __lock_unpin_lock()
4384 if (WARN((int)hlock->pin_count < 0, "pin count corrupted\n")) in __lock_unpin_lock()
4385 hlock->pin_count = 0; in __lock_unpin_lock()
4620 struct held_lock *hlock; in __lock_contended() local
4633 hlock = find_held_lock(curr, lock, depth, &i); in __lock_contended()
4634 if (!hlock) { in __lock_contended()
4639 if (hlock->instance != lock) in __lock_contended()
4642 hlock->waittime_stamp = lockstat_clock(); in __lock_contended()
4644 contention_point = lock_point(hlock_class(hlock)->contention_point, ip); in __lock_contended()
4645 contending_point = lock_point(hlock_class(hlock)->contending_point, in __lock_contended()
4648 stats = get_lock_stats(hlock_class(hlock)); in __lock_contended()
4654 stats->bounces[bounce_contended + !!hlock->read]++; in __lock_contended()
4661 struct held_lock *hlock; in __lock_acquired() local
4675 hlock = find_held_lock(curr, lock, depth, &i); in __lock_acquired()
4676 if (!hlock) { in __lock_acquired()
4681 if (hlock->instance != lock) in __lock_acquired()
4685 if (hlock->waittime_stamp) { in __lock_acquired()
4687 waittime = now - hlock->waittime_stamp; in __lock_acquired()
4688 hlock->holdtime_stamp = now; in __lock_acquired()
4693 stats = get_lock_stats(hlock_class(hlock)); in __lock_acquired()
4695 if (hlock->read) in __lock_acquired()
4701 stats->bounces[bounce_acquired + !!hlock->read]++; in __lock_acquired()
5247 const void *mem_to, struct held_lock *hlock) in print_freed_lock_bug() argument
5261 print_lock(hlock); in print_freed_lock_bug()
5283 struct held_lock *hlock; in debug_check_no_locks_freed() local
5292 hlock = curr->held_locks + i; in debug_check_no_locks_freed()
5294 if (not_in_range(mem_from, mem_len, hlock->instance, in debug_check_no_locks_freed()
5295 sizeof(*hlock->instance))) in debug_check_no_locks_freed()
5298 print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock); in debug_check_no_locks_freed()