Lines Matching refs:hash
398 struct hlist_head *hash; member
575 memset(stat->hash, 0, in ftrace_profile_reset()
642 if (stat->hash) { in ftrace_profile_init_cpu()
654 stat->hash = kcalloc(size, sizeof(struct hlist_head), GFP_KERNEL); in ftrace_profile_init_cpu()
656 if (!stat->hash) in ftrace_profile_init_cpu()
661 kfree(stat->hash); in ftrace_profile_init_cpu()
662 stat->hash = NULL; in ftrace_profile_init_cpu()
692 hhd = &stat->hash[key]; in ftrace_find_profiled_func()
711 hlist_add_head_rcu(&rec->node, &stat->hash[key]); in ftrace_add_profile()
764 if (!stat->hash || !ftrace_profile_enabled) in function_profile_call()
814 if (!stat->hash || !ftrace_profile_enabled) in profile_graph_return()
1099 ftrace_hash_key(struct ftrace_hash *hash, unsigned long ip) in ftrace_hash_key() argument
1101 if (hash->size_bits > 0) in ftrace_hash_key()
1102 return hash_long(ip, hash->size_bits); in ftrace_hash_key()
1109 __ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip) in __ftrace_lookup_ip() argument
1115 key = ftrace_hash_key(hash, ip); in __ftrace_lookup_ip()
1116 hhd = &hash->buckets[key]; in __ftrace_lookup_ip()
1136 ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip) in ftrace_lookup_ip() argument
1138 if (ftrace_hash_empty(hash)) in ftrace_lookup_ip()
1141 return __ftrace_lookup_ip(hash, ip); in ftrace_lookup_ip()
1144 static void __add_hash_entry(struct ftrace_hash *hash, in __add_hash_entry() argument
1150 key = ftrace_hash_key(hash, entry->ip); in __add_hash_entry()
1151 hhd = &hash->buckets[key]; in __add_hash_entry()
1153 hash->count++; in __add_hash_entry()
1156 static int add_hash_entry(struct ftrace_hash *hash, unsigned long ip) in add_hash_entry() argument
1165 __add_hash_entry(hash, entry); in add_hash_entry()
1171 free_hash_entry(struct ftrace_hash *hash, in free_hash_entry() argument
1176 hash->count--; in free_hash_entry()
1180 remove_hash_entry(struct ftrace_hash *hash, in remove_hash_entry() argument
1184 hash->count--; in remove_hash_entry()
1187 static void ftrace_hash_clear(struct ftrace_hash *hash) in ftrace_hash_clear() argument
1192 int size = 1 << hash->size_bits; in ftrace_hash_clear()
1195 if (!hash->count) in ftrace_hash_clear()
1199 hhd = &hash->buckets[i]; in ftrace_hash_clear()
1201 free_hash_entry(hash, entry); in ftrace_hash_clear()
1203 FTRACE_WARN_ON(hash->count); in ftrace_hash_clear()
1228 static void free_ftrace_hash(struct ftrace_hash *hash) in free_ftrace_hash() argument
1230 if (!hash || hash == EMPTY_HASH) in free_ftrace_hash()
1232 ftrace_hash_clear(hash); in free_ftrace_hash()
1233 kfree(hash->buckets); in free_ftrace_hash()
1234 kfree(hash); in free_ftrace_hash()
1239 struct ftrace_hash *hash; in __free_ftrace_hash_rcu() local
1241 hash = container_of(rcu, struct ftrace_hash, rcu); in __free_ftrace_hash_rcu()
1242 free_ftrace_hash(hash); in __free_ftrace_hash_rcu()
1245 static void free_ftrace_hash_rcu(struct ftrace_hash *hash) in free_ftrace_hash_rcu() argument
1247 if (!hash || hash == EMPTY_HASH) in free_ftrace_hash_rcu()
1249 call_rcu(&hash->rcu, __free_ftrace_hash_rcu); in free_ftrace_hash_rcu()
1261 struct ftrace_hash *hash; in alloc_ftrace_hash() local
1264 hash = kzalloc(sizeof(*hash), GFP_KERNEL); in alloc_ftrace_hash()
1265 if (!hash) in alloc_ftrace_hash()
1269 hash->buckets = kcalloc(size, sizeof(*hash->buckets), GFP_KERNEL); in alloc_ftrace_hash()
1271 if (!hash->buckets) { in alloc_ftrace_hash()
1272 kfree(hash); in alloc_ftrace_hash()
1276 hash->size_bits = size_bits; in alloc_ftrace_hash()
1278 return hash; in alloc_ftrace_hash()
1311 alloc_and_copy_ftrace_hash(int size_bits, struct ftrace_hash *hash) in alloc_and_copy_ftrace_hash() argument
1323 if (hash) in alloc_and_copy_ftrace_hash()
1324 new_hash->flags = hash->flags; in alloc_and_copy_ftrace_hash()
1327 if (ftrace_hash_empty(hash)) in alloc_and_copy_ftrace_hash()
1330 size = 1 << hash->size_bits; in alloc_and_copy_ftrace_hash()
1332 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in alloc_and_copy_ftrace_hash()
1339 FTRACE_WARN_ON(new_hash->count != hash->count); in alloc_and_copy_ftrace_hash()
1445 struct ftrace_ops_hash *hash) in hash_contains_ip() argument
1453 return (ftrace_hash_empty(hash->filter_hash) || in hash_contains_ip()
1454 __ftrace_lookup_ip(hash->filter_hash, ip)) && in hash_contains_ip()
1455 (ftrace_hash_empty(hash->notrace_hash) || in hash_contains_ip()
1456 !__ftrace_lookup_ip(hash->notrace_hash, ip)); in hash_contains_ip()
1474 struct ftrace_ops_hash hash; in ftrace_ops_test() local
1487 rcu_assign_pointer(hash.filter_hash, ops->func_hash->filter_hash); in ftrace_ops_test()
1488 rcu_assign_pointer(hash.notrace_hash, ops->func_hash->notrace_hash); in ftrace_ops_test()
1490 if (hash_contains_ip(ip, &hash)) in ftrace_ops_test()
1635 struct ftrace_hash *hash; in __ftrace_hash_rec_update() local
1659 hash = ops->func_hash->filter_hash; in __ftrace_hash_rec_update()
1661 if (ftrace_hash_empty(hash)) in __ftrace_hash_rec_update()
1665 hash = ops->func_hash->notrace_hash; in __ftrace_hash_rec_update()
1671 if (ftrace_hash_empty(hash)) in __ftrace_hash_rec_update()
1691 in_hash = !!ftrace_lookup_ip(hash, rec->ip); in __ftrace_hash_rec_update()
1794 if (!all && count == hash->count) in __ftrace_hash_rec_update()
1931 struct ftrace_hash *hash = ops->func_hash->filter_hash; in ftrace_hash_ipmodify_enable() local
1933 if (ftrace_hash_empty(hash)) in ftrace_hash_ipmodify_enable()
1934 hash = NULL; in ftrace_hash_ipmodify_enable()
1936 return __ftrace_hash_update_ipmodify(ops, EMPTY_HASH, hash); in ftrace_hash_ipmodify_enable()
1942 struct ftrace_hash *hash = ops->func_hash->filter_hash; in ftrace_hash_ipmodify_disable() local
1944 if (ftrace_hash_empty(hash)) in ftrace_hash_ipmodify_disable()
1945 hash = NULL; in ftrace_hash_ipmodify_disable()
1947 __ftrace_hash_update_ipmodify(ops, hash, EMPTY_HASH); in ftrace_hash_ipmodify_disable()
3285 struct ftrace_hash *hash; member
3300 struct ftrace_hash *hash; in t_probe_next() local
3324 hash = iter->probe->ops.func_hash->filter_hash; in t_probe_next()
3330 if (!hash || hash == EMPTY_HASH) in t_probe_next()
3333 size = 1 << hash->size_bits; in t_probe_next()
3341 hash = iter->probe->ops.func_hash->filter_hash; in t_probe_next()
3342 size = 1 << hash->size_bits; in t_probe_next()
3346 hhd = &hash->buckets[iter->pidx]; in t_probe_next()
3519 !ftrace_lookup_ip(iter->hash, rec->ip)) || in t_func_next()
3598 ftrace_hash_empty(iter->hash)) { in t_start()
3789 struct ftrace_hash *hash; in ftrace_regex_open() local
3816 hash = ops->func_hash->notrace_hash; in ftrace_regex_open()
3819 hash = ops->func_hash->filter_hash; in ftrace_regex_open()
3829 iter->hash = alloc_ftrace_hash(size_bits); in ftrace_regex_open()
3832 iter->hash = alloc_and_copy_ftrace_hash(size_bits, hash); in ftrace_regex_open()
3835 if (!iter->hash) { in ftrace_regex_open()
3840 iter->hash = hash; in ftrace_regex_open()
3853 free_ftrace_hash(iter->hash); in ftrace_regex_open()
3946 enter_record(struct ftrace_hash *hash, struct dyn_ftrace *rec, int clear_filter) in enter_record() argument
3951 entry = ftrace_lookup_ip(hash, rec->ip); in enter_record()
3957 free_hash_entry(hash, entry); in enter_record()
3963 ret = add_hash_entry(hash, rec->ip); in enter_record()
3969 add_rec_by_index(struct ftrace_hash *hash, struct ftrace_glob *func_g, in add_rec_by_index() argument
3987 enter_record(hash, rec, clear_filter); in add_rec_by_index()
4032 match_records(struct ftrace_hash *hash, char *func, int len, char *mod) in match_records() argument
4062 found = add_rec_by_index(hash, &func_g, clear_filter); in match_records()
4072 ret = enter_record(hash, rec, clear_filter); in match_records()
4087 ftrace_match_records(struct ftrace_hash *hash, char *buff, int len) in ftrace_match_records() argument
4089 return match_records(hash, buff, len, NULL); in ftrace_match_records()
4125 struct ftrace_hash *hash, in ftrace_hash_move_and_update_ops() argument
4135 ret = ftrace_hash_move(ops, enable, orig_hash, hash); in ftrace_hash_move_and_update_ops()
4305 ftrace_mod_callback(struct trace_array *tr, struct ftrace_hash *hash, in ftrace_mod_callback() argument
4323 ret = match_records(hash, func, strlen(func), module); in ftrace_mod_callback()
4369 struct ftrace_hash hash; member
4379 struct ftrace_hash *hash; in allocate_ftrace_func_mapper() local
4386 hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); in allocate_ftrace_func_mapper()
4387 return (struct ftrace_func_mapper *)hash; in allocate_ftrace_func_mapper()
4407 entry = ftrace_lookup_ip(&mapper->hash, ip); in ftrace_func_mapper_find_ip()
4429 entry = ftrace_lookup_ip(&mapper->hash, ip); in ftrace_func_mapper_add_ip()
4440 __add_hash_entry(&mapper->hash, &map->entry); in ftrace_func_mapper_add_ip()
4462 entry = ftrace_lookup_ip(&mapper->hash, ip); in ftrace_func_mapper_remove_ip()
4469 remove_hash_entry(&mapper->hash, entry); in ftrace_func_mapper_remove_ip()
4494 if (free_func && mapper->hash.count) { in free_ftrace_func_mapper()
4495 size = 1 << mapper->hash.size_bits; in free_ftrace_func_mapper()
4497 hhd = &mapper->hash.buckets[i]; in free_ftrace_func_mapper()
4504 free_ftrace_hash(&mapper->hash); in free_ftrace_func_mapper()
4550 struct ftrace_hash *hash; in register_ftrace_function_probe() local
4595 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); in register_ftrace_function_probe()
4597 if (!hash) { in register_ftrace_function_probe()
4602 ret = ftrace_match_records(hash, glob, strlen(glob)); in register_ftrace_function_probe()
4611 size = 1 << hash->size_bits; in register_ftrace_function_probe()
4613 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in register_ftrace_function_probe()
4646 hash, 1); in register_ftrace_function_probe()
4663 free_ftrace_hash(hash); in register_ftrace_function_probe()
4675 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in register_ftrace_function_probe()
4694 struct ftrace_hash *hash = NULL; in unregister_ftrace_function_probe_func() local
4746 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); in unregister_ftrace_function_probe_func()
4747 if (!hash) in unregister_ftrace_function_probe_func()
4752 size = 1 << hash->size_bits; in unregister_ftrace_function_probe_func()
4754 hlist_for_each_entry_safe(entry, tmp, &hash->buckets[i], hlist) { in unregister_ftrace_function_probe_func()
4763 remove_hash_entry(hash, entry); in unregister_ftrace_function_probe_func()
4780 if (ftrace_hash_empty(hash)) in unregister_ftrace_function_probe_func()
4784 hash, 1); in unregister_ftrace_function_probe_func()
4787 if (ftrace_enabled && !ftrace_hash_empty(hash)) in unregister_ftrace_function_probe_func()
4802 free_ftrace_hash(hash); in unregister_ftrace_function_probe_func()
4873 struct ftrace_hash *hash = iter->hash; in ftrace_process_regex() local
4882 ret = ftrace_match_records(hash, func, len); in ftrace_process_regex()
4897 ret = p->func(tr, hash, func, command, next, enable); in ftrace_process_regex()
4961 ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) in ftrace_match_addr() argument
4969 entry = ftrace_lookup_ip(hash, ip); in ftrace_match_addr()
4972 free_hash_entry(hash, entry); in ftrace_match_addr()
4976 return add_hash_entry(hash, ip); in ftrace_match_addr()
4984 struct ftrace_hash *hash; in ftrace_set_hash() local
4998 hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); in ftrace_set_hash()
5000 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); in ftrace_set_hash()
5002 if (!hash) { in ftrace_set_hash()
5007 if (buf && !ftrace_match_records(hash, buf, len)) { in ftrace_set_hash()
5012 ret = ftrace_match_addr(hash, ip, remove); in ftrace_set_hash()
5018 ret = ftrace_hash_move_and_update_ops(ops, orig_hash, hash, enable); in ftrace_set_hash()
5024 free_ftrace_hash(hash); in ftrace_set_hash()
5220 struct ftrace_hash *hash; in unregister_ftrace_direct() local
5229 hash = direct_ops.func_hash->filter_hash; in unregister_ftrace_direct()
5230 if (hash->count == 1) in unregister_ftrace_direct()
5419 static void remove_direct_functions_hash(struct ftrace_hash *hash, unsigned long addr) in remove_direct_functions_hash() argument
5424 size = 1 << hash->size_bits; in remove_direct_functions_hash()
5426 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in remove_direct_functions_hash()
5460 struct ftrace_hash *hash, *free_hash = NULL; in register_ftrace_direct_multi() local
5471 hash = ops->func_hash->filter_hash; in register_ftrace_direct_multi()
5472 if (ftrace_hash_empty(hash)) in register_ftrace_direct_multi()
5478 size = 1 << hash->size_bits; in register_ftrace_direct_multi()
5480 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in register_ftrace_direct_multi()
5489 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in register_ftrace_direct_multi()
5505 remove_direct_functions_hash(hash, addr); in register_ftrace_direct_multi()
5533 struct ftrace_hash *hash = ops->func_hash->filter_hash; in unregister_ftrace_direct_multi() local
5543 remove_direct_functions_hash(hash, addr); in unregister_ftrace_direct_multi()
5570 struct ftrace_hash *hash; in modify_ftrace_direct_multi() local
5600 hash = ops->func_hash->filter_hash; in modify_ftrace_direct_multi()
5601 size = 1 << hash->size_bits; in modify_ftrace_direct_multi()
5603 hlist_for_each_entry(iter, &hash->buckets[i], hlist) { in modify_ftrace_direct_multi()
5761 static int ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer);
5790 struct ftrace_hash *hash; in set_ftrace_early_graph() local
5792 hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); in set_ftrace_early_graph()
5793 if (MEM_FAIL(!hash, "Failed to allocate hash\n")) in set_ftrace_early_graph()
5799 ret = ftrace_graph_set_hash(hash, func); in set_ftrace_early_graph()
5806 ftrace_graph_hash = hash; in set_ftrace_early_graph()
5808 ftrace_graph_notrace_hash = hash; in set_ftrace_early_graph()
5871 iter->hash->flags |= FTRACE_HASH_FL_MOD; in ftrace_regex_release()
5877 iter->hash, filter_hash); in ftrace_regex_release()
5881 iter->hash = NULL; in ftrace_regex_release()
5885 free_ftrace_hash(iter->hash); in ftrace_regex_release()
5938 struct ftrace_hash *hash; member
5955 if (*pos >= fgd->hash->count) in __g_next()
5967 for (i = idx; i < 1 << fgd->hash->size_bits; i++) { in __g_next()
5968 head = &fgd->hash->buckets[i]; in __g_next()
5992 fgd->hash = rcu_dereference_protected(ftrace_graph_hash, in g_start()
5995 fgd->hash = rcu_dereference_protected(ftrace_graph_notrace_hash, in g_start()
5999 if (ftrace_hash_empty(fgd->hash) && !*pos) in g_start()
6062 fgd->hash); in __ftrace_graph_open()
6093 fgd->hash = NULL; in __ftrace_graph_open()
6113 fgd->hash = rcu_dereference_protected(ftrace_graph_hash, in ftrace_graph_open()
6141 fgd->hash = rcu_dereference_protected(ftrace_graph_notrace_hash, in ftrace_graph_notrace_open()
6225 ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer) in ftrace_graph_set_hash() argument
6253 entry = ftrace_lookup_ip(hash, rec->ip); in ftrace_graph_set_hash()
6260 if (add_hash_entry(hash, rec->ip) < 0) in ftrace_graph_set_hash()
6264 free_hash_entry(hash, entry); in ftrace_graph_set_hash()
6567 clear_mod_from_hash(struct ftrace_page *pg, struct ftrace_hash *hash) in clear_mod_from_hash() argument
6573 if (ftrace_hash_empty(hash)) in clear_mod_from_hash()
6578 entry = __ftrace_lookup_ip(hash, rec->ip); in clear_mod_from_hash()
6946 clear_func_from_hash(struct ftrace_init_func *func, struct ftrace_hash *hash) in clear_func_from_hash() argument
6950 entry = ftrace_lookup_ip(hash, func->ip); in clear_func_from_hash()