Lines Matching refs:hash
407 struct hlist_head *hash; member
584 memset(stat->hash, 0, in ftrace_profile_reset()
651 if (stat->hash) { in ftrace_profile_init_cpu()
663 stat->hash = kcalloc(size, sizeof(struct hlist_head), GFP_KERNEL); in ftrace_profile_init_cpu()
665 if (!stat->hash) in ftrace_profile_init_cpu()
670 kfree(stat->hash); in ftrace_profile_init_cpu()
671 stat->hash = NULL; in ftrace_profile_init_cpu()
701 hhd = &stat->hash[key]; in ftrace_find_profiled_func()
720 hlist_add_head_rcu(&rec->node, &stat->hash[key]); in ftrace_add_profile()
773 if (!stat->hash || !ftrace_profile_enabled) in function_profile_call()
823 if (!stat->hash || !ftrace_profile_enabled) in profile_graph_return()
1116 ftrace_hash_key(struct ftrace_hash *hash, unsigned long ip) in ftrace_hash_key() argument
1118 if (hash->size_bits > 0) in ftrace_hash_key()
1119 return hash_long(ip, hash->size_bits); in ftrace_hash_key()
1126 __ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip) in __ftrace_lookup_ip() argument
1132 key = ftrace_hash_key(hash, ip); in __ftrace_lookup_ip()
1133 hhd = &hash->buckets[key]; in __ftrace_lookup_ip()
1153 ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip) in ftrace_lookup_ip() argument
1155 if (ftrace_hash_empty(hash)) in ftrace_lookup_ip()
1158 return __ftrace_lookup_ip(hash, ip); in ftrace_lookup_ip()
1161 static void __add_hash_entry(struct ftrace_hash *hash, in __add_hash_entry() argument
1167 key = ftrace_hash_key(hash, entry->ip); in __add_hash_entry()
1168 hhd = &hash->buckets[key]; in __add_hash_entry()
1170 hash->count++; in __add_hash_entry()
1173 static int add_hash_entry(struct ftrace_hash *hash, unsigned long ip) in add_hash_entry() argument
1182 __add_hash_entry(hash, entry); in add_hash_entry()
1188 free_hash_entry(struct ftrace_hash *hash, in free_hash_entry() argument
1193 hash->count--; in free_hash_entry()
1197 remove_hash_entry(struct ftrace_hash *hash, in remove_hash_entry() argument
1201 hash->count--; in remove_hash_entry()
1204 static void ftrace_hash_clear(struct ftrace_hash *hash) in ftrace_hash_clear() argument
1209 int size = 1 << hash->size_bits; in ftrace_hash_clear()
1212 if (!hash->count) in ftrace_hash_clear()
1216 hhd = &hash->buckets[i]; in ftrace_hash_clear()
1218 free_hash_entry(hash, entry); in ftrace_hash_clear()
1220 FTRACE_WARN_ON(hash->count); in ftrace_hash_clear()
1245 static void free_ftrace_hash(struct ftrace_hash *hash) in free_ftrace_hash() argument
1247 if (!hash || hash == EMPTY_HASH) in free_ftrace_hash()
1249 ftrace_hash_clear(hash); in free_ftrace_hash()
1250 kfree(hash->buckets); in free_ftrace_hash()
1251 kfree(hash); in free_ftrace_hash()
1256 struct ftrace_hash *hash; in __free_ftrace_hash_rcu() local
1258 hash = container_of(rcu, struct ftrace_hash, rcu); in __free_ftrace_hash_rcu()
1259 free_ftrace_hash(hash); in __free_ftrace_hash_rcu()
1262 static void free_ftrace_hash_rcu(struct ftrace_hash *hash) in free_ftrace_hash_rcu() argument
1264 if (!hash || hash == EMPTY_HASH) in free_ftrace_hash_rcu()
1266 call_rcu(&hash->rcu, __free_ftrace_hash_rcu); in free_ftrace_hash_rcu()
1278 struct ftrace_hash *hash; in alloc_ftrace_hash() local
1281 hash = kzalloc(sizeof(*hash), GFP_KERNEL); in alloc_ftrace_hash()
1282 if (!hash) in alloc_ftrace_hash()
1286 hash->buckets = kcalloc(size, sizeof(*hash->buckets), GFP_KERNEL); in alloc_ftrace_hash()
1288 if (!hash->buckets) { in alloc_ftrace_hash()
1289 kfree(hash); in alloc_ftrace_hash()
1293 hash->size_bits = size_bits; in alloc_ftrace_hash()
1295 return hash; in alloc_ftrace_hash()
1328 alloc_and_copy_ftrace_hash(int size_bits, struct ftrace_hash *hash) in alloc_and_copy_ftrace_hash() argument
1340 if (hash) in alloc_and_copy_ftrace_hash()
1341 new_hash->flags = hash->flags; in alloc_and_copy_ftrace_hash()
1344 if (ftrace_hash_empty(hash)) in alloc_and_copy_ftrace_hash()
1347 size = 1 << hash->size_bits; in alloc_and_copy_ftrace_hash()
1349 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in alloc_and_copy_ftrace_hash()
1356 FTRACE_WARN_ON(new_hash->count != hash->count); in alloc_and_copy_ftrace_hash()
1457 struct ftrace_ops_hash *hash) in hash_contains_ip() argument
1465 return (ftrace_hash_empty(hash->filter_hash) || in hash_contains_ip()
1466 __ftrace_lookup_ip(hash->filter_hash, ip)) && in hash_contains_ip()
1467 (ftrace_hash_empty(hash->notrace_hash) || in hash_contains_ip()
1468 !__ftrace_lookup_ip(hash->notrace_hash, ip)); in hash_contains_ip()
1486 struct ftrace_ops_hash hash; in ftrace_ops_test() local
1499 rcu_assign_pointer(hash.filter_hash, ops->func_hash->filter_hash); in ftrace_ops_test()
1500 rcu_assign_pointer(hash.notrace_hash, ops->func_hash->notrace_hash); in ftrace_ops_test()
1502 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()
1782 if (!all && count == hash->count) in __ftrace_hash_rec_update()
1919 struct ftrace_hash *hash = ops->func_hash->filter_hash; in ftrace_hash_ipmodify_enable() local
1921 if (ftrace_hash_empty(hash)) in ftrace_hash_ipmodify_enable()
1922 hash = NULL; in ftrace_hash_ipmodify_enable()
1924 return __ftrace_hash_update_ipmodify(ops, EMPTY_HASH, hash); in ftrace_hash_ipmodify_enable()
1930 struct ftrace_hash *hash = ops->func_hash->filter_hash; in ftrace_hash_ipmodify_disable() local
1932 if (ftrace_hash_empty(hash)) in ftrace_hash_ipmodify_disable()
1933 hash = NULL; in ftrace_hash_ipmodify_disable()
1935 __ftrace_hash_update_ipmodify(ops, hash, EMPTY_HASH); in ftrace_hash_ipmodify_disable()
3059 struct ftrace_hash *hash; member
3074 struct ftrace_hash *hash; in t_probe_next() local
3098 hash = iter->probe->ops.func_hash->filter_hash; in t_probe_next()
3104 if (!hash || hash == EMPTY_HASH) in t_probe_next()
3107 size = 1 << hash->size_bits; in t_probe_next()
3115 hash = iter->probe->ops.func_hash->filter_hash; in t_probe_next()
3116 size = 1 << hash->size_bits; in t_probe_next()
3120 hhd = &hash->buckets[iter->pidx]; in t_probe_next()
3293 !ftrace_lookup_ip(iter->hash, rec->ip)) || in t_func_next()
3372 ftrace_hash_empty(iter->hash)) { in t_start()
3555 struct ftrace_hash *hash; in ftrace_regex_open() local
3582 hash = ops->func_hash->notrace_hash; in ftrace_regex_open()
3585 hash = ops->func_hash->filter_hash; in ftrace_regex_open()
3595 iter->hash = alloc_ftrace_hash(size_bits); in ftrace_regex_open()
3598 iter->hash = alloc_and_copy_ftrace_hash(size_bits, hash); in ftrace_regex_open()
3601 if (!iter->hash) { in ftrace_regex_open()
3606 iter->hash = hash; in ftrace_regex_open()
3619 free_ftrace_hash(iter->hash); in ftrace_regex_open()
3712 enter_record(struct ftrace_hash *hash, struct dyn_ftrace *rec, int clear_filter) in enter_record() argument
3717 entry = ftrace_lookup_ip(hash, rec->ip); in enter_record()
3723 free_hash_entry(hash, entry); in enter_record()
3729 ret = add_hash_entry(hash, rec->ip); in enter_record()
3735 add_rec_by_index(struct ftrace_hash *hash, struct ftrace_glob *func_g, in add_rec_by_index() argument
3753 enter_record(hash, rec, clear_filter); in add_rec_by_index()
3798 match_records(struct ftrace_hash *hash, char *func, int len, char *mod) in match_records() argument
3828 found = add_rec_by_index(hash, &func_g, clear_filter); in match_records()
3838 ret = enter_record(hash, rec, clear_filter); in match_records()
3853 ftrace_match_records(struct ftrace_hash *hash, char *buff, int len) in ftrace_match_records() argument
3855 return match_records(hash, buff, len, NULL); in ftrace_match_records()
3891 struct ftrace_hash *hash, in ftrace_hash_move_and_update_ops() argument
3901 ret = ftrace_hash_move(ops, enable, orig_hash, hash); in ftrace_hash_move_and_update_ops()
4073 ftrace_mod_callback(struct trace_array *tr, struct ftrace_hash *hash, in ftrace_mod_callback() argument
4091 ret = match_records(hash, func, strlen(func), module); in ftrace_mod_callback()
4137 struct ftrace_hash hash; member
4147 struct ftrace_hash *hash; in allocate_ftrace_func_mapper() local
4154 hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); in allocate_ftrace_func_mapper()
4155 return (struct ftrace_func_mapper *)hash; in allocate_ftrace_func_mapper()
4175 entry = ftrace_lookup_ip(&mapper->hash, ip); in ftrace_func_mapper_find_ip()
4197 entry = ftrace_lookup_ip(&mapper->hash, ip); in ftrace_func_mapper_add_ip()
4208 __add_hash_entry(&mapper->hash, &map->entry); in ftrace_func_mapper_add_ip()
4230 entry = ftrace_lookup_ip(&mapper->hash, ip); in ftrace_func_mapper_remove_ip()
4237 remove_hash_entry(&mapper->hash, entry); in ftrace_func_mapper_remove_ip()
4262 if (free_func && mapper->hash.count) { in free_ftrace_func_mapper()
4263 size = 1 << mapper->hash.size_bits; in free_ftrace_func_mapper()
4265 hhd = &mapper->hash.buckets[i]; in free_ftrace_func_mapper()
4272 free_ftrace_hash(&mapper->hash); in free_ftrace_func_mapper()
4318 struct ftrace_hash *hash; in register_ftrace_function_probe() local
4363 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); in register_ftrace_function_probe()
4365 if (!hash) { in register_ftrace_function_probe()
4370 ret = ftrace_match_records(hash, glob, strlen(glob)); in register_ftrace_function_probe()
4379 size = 1 << hash->size_bits; in register_ftrace_function_probe()
4381 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in register_ftrace_function_probe()
4414 hash, 1); in register_ftrace_function_probe()
4431 free_ftrace_hash(hash); in register_ftrace_function_probe()
4443 hlist_for_each_entry(entry, &hash->buckets[i], hlist) { in register_ftrace_function_probe()
4462 struct ftrace_hash *hash = NULL; in unregister_ftrace_function_probe_func() local
4514 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); in unregister_ftrace_function_probe_func()
4515 if (!hash) in unregister_ftrace_function_probe_func()
4520 size = 1 << hash->size_bits; in unregister_ftrace_function_probe_func()
4522 hlist_for_each_entry_safe(entry, tmp, &hash->buckets[i], hlist) { in unregister_ftrace_function_probe_func()
4531 remove_hash_entry(hash, entry); in unregister_ftrace_function_probe_func()
4548 if (ftrace_hash_empty(hash)) in unregister_ftrace_function_probe_func()
4552 hash, 1); in unregister_ftrace_function_probe_func()
4555 if (ftrace_enabled && !ftrace_hash_empty(hash)) in unregister_ftrace_function_probe_func()
4570 free_ftrace_hash(hash); in unregister_ftrace_function_probe_func()
4641 struct ftrace_hash *hash = iter->hash; in ftrace_process_regex() local
4650 ret = ftrace_match_records(hash, func, len); in ftrace_process_regex()
4665 ret = p->func(tr, hash, func, command, next, enable); in ftrace_process_regex()
4729 ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) in ftrace_match_addr() argument
4737 entry = ftrace_lookup_ip(hash, ip); in ftrace_match_addr()
4740 free_hash_entry(hash, entry); in ftrace_match_addr()
4744 return add_hash_entry(hash, ip); in ftrace_match_addr()
4752 struct ftrace_hash *hash; in ftrace_set_hash() local
4766 hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); in ftrace_set_hash()
4768 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); in ftrace_set_hash()
4770 if (!hash) { in ftrace_set_hash()
4775 if (buf && !ftrace_match_records(hash, buf, len)) { in ftrace_set_hash()
4780 ret = ftrace_match_addr(hash, ip, remove); in ftrace_set_hash()
4786 ret = ftrace_hash_move_and_update_ops(ops, orig_hash, hash, enable); in ftrace_set_hash()
4792 free_ftrace_hash(hash); in ftrace_set_hash()
4941 static int ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer);
4970 struct ftrace_hash *hash; in set_ftrace_early_graph() local
4972 hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); in set_ftrace_early_graph()
4973 if (WARN_ON(!hash)) in set_ftrace_early_graph()
4979 ret = ftrace_graph_set_hash(hash, func); in set_ftrace_early_graph()
4986 ftrace_graph_hash = hash; in set_ftrace_early_graph()
4988 ftrace_graph_notrace_hash = hash; in set_ftrace_early_graph()
5036 ftrace_match_records(iter->hash, parser->buffer, parser->idx); in ftrace_regex_release()
5049 iter->hash->flags |= FTRACE_HASH_FL_MOD; in ftrace_regex_release()
5055 iter->hash, filter_hash); in ftrace_regex_release()
5059 iter->hash = NULL; in ftrace_regex_release()
5063 free_ftrace_hash(iter->hash); in ftrace_regex_release()
5116 struct ftrace_hash *hash; member
5133 if (*pos >= fgd->hash->count) in __g_next()
5145 for (i = idx; i < 1 << fgd->hash->size_bits; i++) { in __g_next()
5146 head = &fgd->hash->buckets[i]; in __g_next()
5170 fgd->hash = rcu_dereference_protected(ftrace_graph_hash, in g_start()
5173 fgd->hash = rcu_dereference_protected(ftrace_graph_notrace_hash, in g_start()
5177 if (ftrace_hash_empty(fgd->hash) && !*pos) in g_start()
5240 fgd->hash); in __ftrace_graph_open()
5271 fgd->hash = NULL; in __ftrace_graph_open()
5291 fgd->hash = rcu_dereference_protected(ftrace_graph_hash, in ftrace_graph_open()
5319 fgd->hash = rcu_dereference_protected(ftrace_graph_notrace_hash, in ftrace_graph_notrace_open()
5395 ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer) in ftrace_graph_set_hash() argument
5423 entry = ftrace_lookup_ip(hash, rec->ip); in ftrace_graph_set_hash()
5430 if (add_hash_entry(hash, rec->ip) < 0) in ftrace_graph_set_hash()
5434 free_hash_entry(hash, entry); in ftrace_graph_set_hash()
5703 clear_mod_from_hash(struct ftrace_page *pg, struct ftrace_hash *hash) in clear_mod_from_hash() argument
5709 if (ftrace_hash_empty(hash)) in clear_mod_from_hash()
5714 entry = __ftrace_lookup_ip(hash, rec->ip); in clear_mod_from_hash()
6065 clear_func_from_hash(struct ftrace_init_func *func, struct ftrace_hash *hash) in clear_func_from_hash() argument
6069 entry = ftrace_lookup_ip(hash, func->ip); in clear_func_from_hash()