Lines Matching refs:hlock
143 static inline struct lock_class *hlock_class(struct held_lock *hlock) in hlock_class() argument
145 if (!hlock->class_idx) { in hlock_class()
152 return lock_classes + hlock->class_idx - 1; in hlock_class()
254 static void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
262 holdtime = lockstat_clock() - hlock->holdtime_stamp; in lock_release_holdtime()
264 stats = get_lock_stats(hlock_class(hlock)); in lock_release_holdtime()
265 if (hlock->read) in lock_release_holdtime()
271 static inline void lock_release_holdtime(struct held_lock *hlock) in lock_release_holdtime() argument
537 static void print_lock(struct held_lock *hlock) in print_lock() argument
543 unsigned int class_idx = hlock->class_idx; in print_lock()
553 printk(KERN_CONT "%p", hlock->instance); in print_lock()
555 printk(KERN_CONT ", at: %pS\n", (void *)hlock->acquire_ip); in print_lock()
1942 struct held_lock *hlock; in check_prevs_add() local
1967 hlock = curr->held_locks + depth - 1; in check_prevs_add()
1973 if (hlock->read != 2 && hlock->check) { in check_prevs_add()
1974 int ret = check_prev_add(curr, hlock, next, distance, &trace, save_trace); in check_prevs_add()
1984 if (!hlock->trylock) in check_prevs_add()
2030 struct held_lock *hlock) in get_first_held_lock() argument
2037 if (hlock_curr->irq_context != hlock->irq_context) in get_first_held_lock()
2062 struct held_lock *hlock; in print_chain_keys_held_locks() local
2069 hlock = curr->held_locks + i; in print_chain_keys_held_locks()
2070 chain_key = print_chain_key_iteration(hlock->class_idx, chain_key); in print_chain_keys_held_locks()
2072 print_lock(hlock); in print_chain_keys_held_locks()
2125 struct held_lock *hlock, in check_no_collision() argument
2131 i = get_first_held_lock(curr, hlock); in check_no_collision()
2134 print_collision(curr, hlock, chain); in check_no_collision()
2142 print_collision(curr, hlock, chain); in check_no_collision()
2228 struct held_lock *hlock, in add_chain_cache() argument
2231 struct lock_class *class = hlock_class(hlock); in add_chain_cache()
2259 chain->irq_context = hlock->irq_context; in add_chain_cache()
2260 i = get_first_held_lock(curr, hlock); in add_chain_cache()
2328 struct held_lock *hlock, in lookup_chain_cache_add() argument
2331 struct lock_class *class = hlock_class(hlock); in lookup_chain_cache_add()
2336 if (!check_no_collision(curr, hlock, chain)) in lookup_chain_cache_add()
2366 if (!add_chain_cache(curr, hlock, chain_key)) in lookup_chain_cache_add()
2373 struct held_lock *hlock, int chain_head, u64 chain_key) in validate_chain() argument
2385 if (!hlock->trylock && hlock->check && in validate_chain()
2386 lookup_chain_cache_add(curr, hlock, chain_key)) { in validate_chain()
2399 int ret = check_deadlock(curr, hlock, lock, hlock->read); in validate_chain()
2409 hlock->read = 2; in validate_chain()
2415 if (!check_prevs_add(curr, hlock)) in validate_chain()
2430 struct lockdep_map *lock, struct held_lock *hlock, in validate_chain() argument
2444 struct held_lock *hlock, *prev_hlock = NULL; in check_chain_key() local
2449 hlock = curr->held_locks + i; in check_chain_key()
2450 if (chain_key != hlock->prev_chain_key) { in check_chain_key()
2459 (unsigned long long)hlock->prev_chain_key); in check_chain_key()
2465 if (DEBUG_LOCKS_WARN_ON(hlock->class_idx > MAX_LOCKDEP_KEYS)) in check_chain_key()
2469 hlock->irq_context)) in check_chain_key()
2471 chain_key = iterate_chain_key(chain_key, hlock->class_idx); in check_chain_key()
2472 prev_hlock = hlock; in check_chain_key()
2790 struct held_lock *hlock; in mark_held_locks() local
2794 hlock = curr->held_locks + i; in mark_held_locks()
2797 if (hlock->read) in mark_held_locks()
2802 if (!hlock->check) in mark_held_locks()
2805 if (!mark_lock(curr, hlock, usage_bit)) in mark_held_locks()
2984 static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock) in mark_irqflags() argument
2990 if (!hlock->trylock) { in mark_irqflags()
2991 if (hlock->read) { in mark_irqflags()
2993 if (!mark_lock(curr, hlock, in mark_irqflags()
2997 if (!mark_lock(curr, hlock, in mark_irqflags()
3002 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ)) in mark_irqflags()
3005 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ)) in mark_irqflags()
3009 if (!hlock->hardirqs_off) { in mark_irqflags()
3010 if (hlock->read) { in mark_irqflags()
3011 if (!mark_lock(curr, hlock, in mark_irqflags()
3015 if (!mark_lock(curr, hlock, in mark_irqflags()
3019 if (!mark_lock(curr, hlock, in mark_irqflags()
3023 if (!mark_lock(curr, hlock, in mark_irqflags()
3038 struct held_lock *hlock) in separate_irq_context() argument
3054 if (prev_hlock->irq_context != hlock->irq_context) in separate_irq_context()
3071 struct held_lock *hlock) in mark_irqflags() argument
3082 struct held_lock *hlock) in separate_irq_context() argument
3228 struct held_lock *hlock, in print_lock_nested_lock_not_held() argument
3243 print_lock(hlock); in print_lock_nested_lock_not_held()
3246 pr_warn("%s\n", hlock->nest_lock->name); in print_lock_nested_lock_not_held()
3273 struct held_lock *hlock; in __lock_acquire() local
3327 hlock = curr->held_locks + depth - 1; in __lock_acquire()
3328 if (hlock->class_idx == class_idx && nest_lock) { in __lock_acquire()
3329 if (hlock->references) { in __lock_acquire()
3333 if (DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1)) in __lock_acquire()
3336 hlock->references++; in __lock_acquire()
3338 hlock->references = 2; in __lock_acquire()
3345 hlock = curr->held_locks + depth; in __lock_acquire()
3352 hlock->class_idx = class_idx; in __lock_acquire()
3353 hlock->acquire_ip = ip; in __lock_acquire()
3354 hlock->instance = lock; in __lock_acquire()
3355 hlock->nest_lock = nest_lock; in __lock_acquire()
3356 hlock->irq_context = task_irq_context(curr); in __lock_acquire()
3357 hlock->trylock = trylock; in __lock_acquire()
3358 hlock->read = read; in __lock_acquire()
3359 hlock->check = check; in __lock_acquire()
3360 hlock->hardirqs_off = !!hardirqs_off; in __lock_acquire()
3361 hlock->references = references; in __lock_acquire()
3363 hlock->waittime_stamp = 0; in __lock_acquire()
3364 hlock->holdtime_stamp = lockstat_clock(); in __lock_acquire()
3366 hlock->pin_count = pin_count; in __lock_acquire()
3368 if (check && !mark_irqflags(curr, hlock)) in __lock_acquire()
3372 if (!mark_lock(curr, hlock, LOCK_USED)) in __lock_acquire()
3401 hlock->prev_chain_key = chain_key; in __lock_acquire()
3402 if (separate_irq_context(curr, hlock)) { in __lock_acquire()
3409 return print_lock_nested_lock_not_held(curr, hlock, ip); in __lock_acquire()
3411 if (!validate_chain(curr, lock, hlock, chain_head, chain_key)) in __lock_acquire()
3469 static int match_held_lock(const struct held_lock *hlock, in match_held_lock() argument
3472 if (hlock->instance == lock) in match_held_lock()
3475 if (hlock->references) { in match_held_lock()
3495 if (DEBUG_LOCKS_WARN_ON(!hlock->nest_lock)) in match_held_lock()
3498 if (hlock->class_idx == class - lock_classes + 1) in match_held_lock()
3510 struct held_lock *ret, *hlock, *prev_hlock; in find_held_lock() local
3514 hlock = curr->held_locks + i; in find_held_lock()
3515 ret = hlock; in find_held_lock()
3516 if (match_held_lock(hlock, lock)) in find_held_lock()
3520 for (i--, prev_hlock = hlock--; in find_held_lock()
3522 i--, prev_hlock = hlock--) { in find_held_lock()
3526 if (prev_hlock->irq_context != hlock->irq_context) { in find_held_lock()
3530 if (match_held_lock(hlock, lock)) { in find_held_lock()
3531 ret = hlock; in find_held_lock()
3544 struct held_lock *hlock; in reacquire_held_locks() local
3546 for (hlock = curr->held_locks + idx; idx < depth; idx++, hlock++) { in reacquire_held_locks()
3547 if (!__lock_acquire(hlock->instance, in reacquire_held_locks()
3548 hlock_class(hlock)->subclass, in reacquire_held_locks()
3549 hlock->trylock, in reacquire_held_locks()
3550 hlock->read, hlock->check, in reacquire_held_locks()
3551 hlock->hardirqs_off, in reacquire_held_locks()
3552 hlock->nest_lock, hlock->acquire_ip, in reacquire_held_locks()
3553 hlock->references, hlock->pin_count)) in reacquire_held_locks()
3565 struct held_lock *hlock; in __lock_set_class() local
3578 hlock = find_held_lock(curr, lock, depth, &i); in __lock_set_class()
3579 if (!hlock) in __lock_set_class()
3584 hlock->class_idx = class - lock_classes + 1; in __lock_set_class()
3587 curr->curr_chain_key = hlock->prev_chain_key; in __lock_set_class()
3604 struct held_lock *hlock; in __lock_downgrade() local
3616 hlock = find_held_lock(curr, lock, depth, &i); in __lock_downgrade()
3617 if (!hlock) in __lock_downgrade()
3621 curr->curr_chain_key = hlock->prev_chain_key; in __lock_downgrade()
3623 WARN(hlock->read, "downgrading a read lock"); in __lock_downgrade()
3624 hlock->read = 1; in __lock_downgrade()
3625 hlock->acquire_ip = ip; in __lock_downgrade()
3650 struct held_lock *hlock; in __lock_release() local
3669 hlock = find_held_lock(curr, lock, depth, &i); in __lock_release()
3670 if (!hlock) in __lock_release()
3673 if (hlock->instance == lock) in __lock_release()
3674 lock_release_holdtime(hlock); in __lock_release()
3676 WARN(hlock->pin_count, "releasing a pinned lock\n"); in __lock_release()
3678 if (hlock->references) { in __lock_release()
3679 hlock->references--; in __lock_release()
3680 if (hlock->references) { in __lock_release()
3697 curr->curr_chain_key = hlock->prev_chain_key; in __lock_release()
3718 struct held_lock *hlock = curr->held_locks + i; in __lock_is_held() local
3720 if (match_held_lock(hlock, lock)) { in __lock_is_held()
3721 if (read == -1 || hlock->read == read) in __lock_is_held()
3741 struct held_lock *hlock = curr->held_locks + i; in __lock_pin_lock() local
3743 if (match_held_lock(hlock, lock)) { in __lock_pin_lock()
3750 hlock->pin_count += cookie.val; in __lock_pin_lock()
3768 struct held_lock *hlock = curr->held_locks + i; in __lock_repin_lock() local
3770 if (match_held_lock(hlock, lock)) { in __lock_repin_lock()
3771 hlock->pin_count += cookie.val; in __lock_repin_lock()
3788 struct held_lock *hlock = curr->held_locks + i; in __lock_unpin_lock() local
3790 if (match_held_lock(hlock, lock)) { in __lock_unpin_lock()
3791 if (WARN(!hlock->pin_count, "unpinning an unpinned lock\n")) in __lock_unpin_lock()
3794 hlock->pin_count -= cookie.val; in __lock_unpin_lock()
3796 if (WARN((int)hlock->pin_count < 0, "pin count corrupted\n")) in __lock_unpin_lock()
3797 hlock->pin_count = 0; in __lock_unpin_lock()
4034 struct held_lock *hlock; in __lock_contended() local
4047 hlock = find_held_lock(curr, lock, depth, &i); in __lock_contended()
4048 if (!hlock) { in __lock_contended()
4053 if (hlock->instance != lock) in __lock_contended()
4056 hlock->waittime_stamp = lockstat_clock(); in __lock_contended()
4058 contention_point = lock_point(hlock_class(hlock)->contention_point, ip); in __lock_contended()
4059 contending_point = lock_point(hlock_class(hlock)->contending_point, in __lock_contended()
4062 stats = get_lock_stats(hlock_class(hlock)); in __lock_contended()
4068 stats->bounces[bounce_contended + !!hlock->read]++; in __lock_contended()
4075 struct held_lock *hlock; in __lock_acquired() local
4089 hlock = find_held_lock(curr, lock, depth, &i); in __lock_acquired()
4090 if (!hlock) { in __lock_acquired()
4095 if (hlock->instance != lock) in __lock_acquired()
4099 if (hlock->waittime_stamp) { in __lock_acquired()
4101 waittime = now - hlock->waittime_stamp; in __lock_acquired()
4102 hlock->holdtime_stamp = now; in __lock_acquired()
4107 stats = get_lock_stats(hlock_class(hlock)); in __lock_acquired()
4109 if (hlock->read) in __lock_acquired()
4115 stats->bounces[bounce_acquired + !!hlock->read]++; in __lock_acquired()
4345 const void *mem_to, struct held_lock *hlock) in print_freed_lock_bug() argument
4359 print_lock(hlock); in print_freed_lock_bug()
4381 struct held_lock *hlock; in debug_check_no_locks_freed() local
4390 hlock = curr->held_locks + i; in debug_check_no_locks_freed()
4392 if (not_in_range(mem_from, mem_len, hlock->instance, in debug_check_no_locks_freed()
4393 sizeof(*hlock->instance))) in debug_check_no_locks_freed()
4396 print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock); in debug_check_no_locks_freed()