Home
last modified time | relevance | path

Searched refs:btf_id (Results 1 – 25 of 56) sorted by relevance

123

/linux-6.6.21/tools/testing/selftests/bpf/prog_tests/
Dmodule_fentry_shadow.c62 __s32 btf_id[2] = {}; in test_module_fentry_shadow() local
90 btf_id[0] = btf__find_by_name_kind(vmlinux_btf, symbol_name, BTF_KIND_FUNC); in test_module_fentry_shadow()
91 if (!ASSERT_GT(btf_id[0], 0, "btf_find_by_name")) in test_module_fentry_shadow()
94 btf_id[1] = btf__find_by_name_kind(mod_btf, symbol_name, BTF_KIND_FUNC); in test_module_fentry_shadow()
95 if (!ASSERT_GT(btf_id[1], 0, "btf_find_by_name")) in test_module_fentry_shadow()
99 load_opts.attach_btf_id = btf_id[i]; in test_module_fentry_shadow()
Dfexit_bpf2bpf.c115 __s32 btf_id; in test_fexit_bpf2bpf_common() local
120 btf_id = btf__find_by_name_kind(btf, tgt_name + 1, BTF_KIND_FUNC); in test_fexit_bpf2bpf_common()
146 ASSERT_EQ(link_info.tracing.target_btf_id, btf_id, "link_tgt_btf_id"); in test_fexit_bpf2bpf_common()
424 if (!info.btf_id) in find_prog_btf_id()
427 btf = btf__load_from_kernel_by_id(info.btf_id); in find_prog_btf_id()
464 int btf_id; in test_fentry_to_cgroup_bpf() local
478 btf_id = find_prog_btf_id("bind_v4_prog", bpf_program__fd(skel->progs.bind_v4_prog)); in test_fentry_to_cgroup_bpf()
479 if (!ASSERT_GE(btf_id, 0, "find_prog_btf_id")) in test_fentry_to_cgroup_bpf()
482 fentry_fd = load_fentry(bpf_program__fd(skel->progs.bind_v4_prog), btf_id); in test_fentry_to_cgroup_bpf()
493 ASSERT_EQ(info.btf_id, 0, "info.btf_id"); in test_fentry_to_cgroup_bpf()
[all …]
Dctx_rewrite.c249 static int find_field_offset_aux(struct btf *btf, int btf_id, char *field_name, int off) in find_field_offset_aux() argument
251 const struct btf_type *type = btf__type_by_id(btf, btf_id); in find_field_offset_aux()
257 PRINT_FAIL("Can't find btf_type for id %d\n", btf_id); in find_field_offset_aux()
262 PRINT_FAIL("BTF id %d is not struct or union\n", btf_id); in find_field_offset_aux()
296 int btf_id, field_offset; in find_field_offset() local
310 btf_id = btf__find_by_name(btf, type_str); in find_field_offset()
311 if (btf_id < 0) { in find_field_offset()
316 field_offset = find_field_offset_aux(btf, btf_id, field_str, 0); in find_field_offset()
/linux-6.6.21/tools/bpf/resolve_btfids/
Dmain.c92 struct btf_id { struct
167 static struct btf_id *btf_id__find(struct rb_root *root, const char *name) in btf_id__find()
170 struct btf_id *id; in btf_id__find()
174 id = rb_entry(p, struct btf_id, rb_node); in btf_id__find()
186 static struct btf_id *
191 struct btf_id *id; in btf_id__add()
196 id = rb_entry(parent, struct btf_id, rb_node); in btf_id__add()
249 static struct btf_id *add_set(struct object *obj, char *name, bool is_set8) in add_set()
267 static struct btf_id *add_symbol(struct rb_root *root, char *name, size_t size) in add_symbol()
425 struct btf_id *id; in symbols_collect()
[all …]
/linux-6.6.21/tools/perf/util/
Dbpf-event.c96 u32 btf_id, in perf_env__fetch_btf() argument
109 node->id = btf_id; in perf_env__fetch_btf()
224 if (info->btf_id && info->nr_func_info && info->func_info_rec_size) { in perf_event__synthesize_one_bpf_prog()
231 btf = btf__load_from_kernel_by_id(info->btf_id); in perf_event__synthesize_one_bpf_prog()
233 pr_debug("%s: failed to get BTF of id %u, aborting\n", __func__, info->btf_id); in perf_event__synthesize_one_bpf_prog()
237 perf_env__fetch_btf(env, info->btf_id, btf); in perf_event__synthesize_one_bpf_prog()
453 u32 btf_id; in perf_env__add_bpf_info() local
474 btf_id = info_linear->info.btf_id; in perf_env__add_bpf_info()
483 if (btf_id == 0) in perf_env__add_bpf_info()
486 btf = btf__load_from_kernel_by_id(btf_id); in perf_env__add_bpf_info()
[all …]
Denv.c96 __u32 btf_id = btf_node->id; in __perf_env__insert_btf() local
105 if (btf_id < node->id) { in __perf_env__insert_btf()
107 } else if (btf_id > node->id) { in __perf_env__insert_btf()
110 pr_debug("duplicated btf %u\n", btf_id); in __perf_env__insert_btf()
121 struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id) in perf_env__find_btf() argument
126 res = __perf_env__find_btf(env, btf_id); in perf_env__find_btf()
131 struct btf_node *__perf_env__find_btf(struct perf_env *env, __u32 btf_id) in __perf_env__find_btf() argument
140 if (btf_id < node->id) in __perf_env__find_btf()
142 else if (btf_id > node->id) in __perf_env__find_btf()
Denv.h175 struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id);
176 struct btf_node *__perf_env__find_btf(struct perf_env *env, __u32 btf_id);
/linux-6.6.21/tools/bpf/bpftool/
Dbtf.c523 static bool btf_is_kernel_module(__u32 btf_id) in btf_is_kernel_module() argument
531 btf_fd = bpf_btf_get_fd_by_id(btf_id); in btf_is_kernel_module()
533 p_err("can't get BTF object by id (%u): %s", btf_id, strerror(errno)); in btf_is_kernel_module()
543 p_err("can't get BTF (ID %u) object info: %s", btf_id, strerror(errno)); in btf_is_kernel_module()
556 __u32 btf_id = -1; in do_dump() local
579 btf_id = info.btf_id; in do_dump()
615 btf_id = info.btf_id; in do_dump()
619 btf_id = strtoul(*argv, &endptr, 0); in do_dump()
674 if (!base_btf && btf_is_kernel_module(btf_id)) { in do_dump()
680 btf = btf__load_from_kernel_by_id_split(btf_id, base_btf); in do_dump()
[all …]
Dmap.c521 if (info->btf_id) in show_map_close_json()
522 jsonw_int_field(json_wtr, "btf_id", info->btf_id); in show_map_close_json()
614 if (info->btf_id || frozen) in show_map_close_plain()
617 if (info->btf_id) in show_map_close_plain()
618 printf("btf_id %d", info->btf_id); in show_map_close_plain()
621 printf("%sfrozen", info->btf_id ? " " : ""); in show_map_close_plain()
781 if (!info.btf_id) in maps_have_btf()
804 *btf = btf__load_from_kernel_by_id(info->btf_id); in get_map_kv_btf()
Dprog.c324 btf = btf__load_from_kernel_by_id(map_info.btf_id); in show_prog_metadata()
481 if (info->btf_id) in print_prog_json()
482 jsonw_int_field(json_wtr, "btf_id", info->btf_id); in print_prog_json()
567 if (info->btf_id) in print_prog_plain()
568 printf("\n\tbtf_id %d", info->btf_id); in print_prog_plain()
727 if (info->btf_id) { in prog_dump()
728 btf = btf__load_from_kernel_by_id(info->btf_id); in prog_dump()
2206 if (info.btf_id == 0) { in profile_target_name()
2228 btf = btf__load_from_kernel_by_id(info.btf_id); in profile_target_name()
2237 info.btf_id, func_info.type_id); in profile_target_name()
/linux-6.6.21/include/linux/
Dbpf_verifier.h97 u32 btf_id; member
123 u32 btf_id; member
487 u32 btf_id; /* btf_id for struct typed var */ member
720 struct btf *btf, u32 btf_id) in bpf_trampoline_compute_key() argument
723 return ((u64)tgt_prog->aux->id << 32) | btf_id; in bpf_trampoline_compute_key()
725 return ((u64)btf_obj_id(btf) << 32) | 0x80000000 | btf_id; in bpf_trampoline_compute_key()
729 static inline void bpf_trampoline_unpack_key(u64 key, u32 *obj_id, u32 *btf_id) in bpf_trampoline_unpack_key() argument
733 if (btf_id) in bpf_trampoline_unpack_key()
734 *btf_id = key & 0x7FFFFFFF; in bpf_trampoline_unpack_key()
740 u32 btf_id,
Dbpf_lsm.h30 bool bpf_lsm_is_sleepable_hook(u32 btf_id);
50 static inline bool bpf_lsm_is_sleepable_hook(u32 btf_id) in bpf_lsm_is_sleepable_hook() argument
Dbtf.h112 u32 btf_id; member
117 u32 btf_id; member
499 s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id);
502 struct btf_struct_meta *btf_find_struct_meta(const struct btf *btf, u32 btf_id);
533 static inline s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id) in btf_find_dtor_kfunc() argument
542 static inline struct btf_struct_meta *btf_find_struct_meta(const struct btf *btf, u32 btf_id) in btf_find_struct_meta() argument
/linux-6.6.21/tools/lib/bpf/
Dlinker.c86 int btf_id; member
1582 struct src_obj *obj, Elf64_Sym *sym, int btf_id) in glob_map_defs_match() argument
1589 t = btf__type_by_id(obj->btf, btf_id); in glob_map_defs_match()
1591 pr_warn("global '%s': invalid map definition type [%d]\n", sym_name, btf_id); in glob_map_defs_match()
1603 t = btf__type_by_id(linker->btf, glob_sym->btf_id); in glob_map_defs_match()
1622 struct src_obj *obj, Elf64_Sym *sym, size_t sym_idx, int btf_id) in glob_syms_match() argument
1629 if (!glob_sym->btf_id || !btf_id) { in glob_syms_match()
1634 src_t = btf__type_by_id(obj->btf, btf_id); in glob_syms_match()
1643 return glob_map_defs_match(sym_name, linker, glob_sym, obj, sym, btf_id); in glob_syms_match()
1646 linker->btf, glob_sym->btf_id, obj->btf, btf_id)) in glob_syms_match()
[all …]
/linux-6.6.21/kernel/bpf/preload/iterators/
Diterators.bpf.c59 static const char *get_name(struct btf *btf, long btf_id, const char *fallback) in get_name() argument
69 bpf_probe_read_kernel(&t, sizeof(t), types + btf_id); in get_name()
/linux-6.6.21/net/ipv4/
Dbpf_tcp_ca.c64 info->btf_id == sock_id) in bpf_tcp_ca_is_valid_access()
66 info->btf_id = tcp_sock_id; in bpf_tcp_ca_is_valid_access()
78 t = btf_type_by_id(reg->btf, reg->btf_id); in bpf_tcp_ca_btf_struct_access()
/linux-6.6.21/tools/testing/selftests/bpf/
Dtest_verifier.c975 int btf_id = 0; in fixup_prog_kfuncs() local
980 btf_id = btf__find_by_name_kind(vmlinux_btf, in fixup_prog_kfuncs()
983 btf_id = btf_id < 0 ? 0 : btf_id; in fixup_prog_kfuncs()
987 if (!btf_id) { in fixup_prog_kfuncs()
990 btf_id = btf__find_by_name_kind(testmod_btf, in fixup_prog_kfuncs()
993 btf_id = btf_id < 0 ? 0 : btf_id; in fixup_prog_kfuncs()
994 if (btf_id) { in fixup_prog_kfuncs()
1004 prog[fixup_kfunc_btf_id->insn_idx].imm = btf_id; in fixup_prog_kfuncs()
/linux-6.6.21/kernel/bpf/
Dverifier.c278 u32 btf_id; member
484 meta = btf_find_struct_meta(reg->btf, reg->btf_id); in reg_btf_record()
545 static bool is_sync_callback_calling_kfunc(u32 btf_id);
767 static const char *iter_type_str(const struct btf *btf, u32 btf_id) in iter_type_str() argument
769 if (!btf || btf_id == 0) in iter_type_str()
773 return btf_type_name(btf, btf_id) + sizeof(ITER_PREFIX) - 1; in iter_type_str()
1188 struct btf *btf, u32 btf_id, int nr_slots) in mark_stack_slots_iter() argument
1210 st->iter.btf_id = btf_id; in mark_stack_slots_iter()
1282 struct btf *btf, u32 btf_id, int nr_slots) in is_iter_reg_valid_init() argument
1300 if (st->iter.btf != btf || st->iter.btf_id != btf_id) in is_iter_reg_valid_init()
[all …]
Dbpf_iter.c13 u32 btf_id; /* cached value */ member
336 tinfo->btf_id = prog->aux->attach_btf_id; in cache_btf_id()
352 if (iter->btf_id && iter->btf_id == prog_btf_id) { in bpf_iter_prog_supported()
380 if (tinfo->btf_id == prog->aux->attach_btf_id) { in bpf_iter_get_func_proto()
541 if (iter->btf_id == prog_btf_id) { in bpf_iter_link_attach()
Dtask_iter.c849 task_reg_info.ctx_arg_info[0].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_TASK]; in task_iter_init()
854 task_file_reg_info.ctx_arg_info[0].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_TASK]; in task_iter_init()
855 task_file_reg_info.ctx_arg_info[1].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_FILE]; in task_iter_init()
860 task_vma_reg_info.ctx_arg_info[0].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_TASK]; in task_iter_init()
861 task_vma_reg_info.ctx_arg_info[1].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_VMA]; in task_iter_init()
Dbtf.c3644 field->kptr.btf_id = id; in btf_parse_kptr()
3852 u32 btf_id; in btf_check_and_fixup_fields() local
3856 btf_id = rec->fields[i].graph_root.value_btf_id; in btf_check_and_fixup_fields()
3857 meta = btf_find_struct_meta(btf, btf_id); in btf_check_and_fixup_fields()
5384 type->btf_id = i; in btf_parse_struct_metas()
5401 struct btf_struct_meta *btf_find_struct_meta(const struct btf *btf, u32 btf_id) in btf_find_struct_meta() argument
5405 BUILD_BUG_ON(offsetof(struct btf_struct_meta, btf_id) != 0); in btf_find_struct_meta()
5409 return bsearch(&btf_id, tab->types, tab->cnt, sizeof(tab->types[0]), btf_id_cmp_func); in btf_find_struct_meta()
6056 if (!ctx_arg_info->btf_id) { in btf_ctx_access()
6063 info->btf_id = ctx_arg_info->btf_id; in btf_ctx_access()
[all …]
Dprog_iter.c103 bpf_prog_reg_info.ctx_arg_info[0].btf_id = *btf_bpf_prog_id; in bpf_prog_iter_init()
Dlink_iter.c103 bpf_link_reg_info.ctx_arg_info[0].btf_id = *btf_bpf_link_id; in bpf_link_iter_init()
/linux-6.6.21/net/core/
Dbpf_sk_storage.c357 u32 btf_id; in bpf_sk_storage_tracing_allowed() local
376 btf_id = prog->aux->attach_btf_id; in bpf_sk_storage_tracing_allowed()
377 t = btf_type_by_id(btf_vmlinux, btf_id); in bpf_sk_storage_tracing_allowed()
926 bpf_sk_storage_map_reg_info.ctx_arg_info[0].btf_id = in bpf_sk_storage_map_iter_init()
/linux-6.6.21/kernel/trace/
Dbpf_trace.c89 s32 *btf_id);
523 s32 btf_id; in BPF_CALL_4() local
526 ret = bpf_btf_printf_prepare(ptr, btf_ptr_size, flags, &btf, &btf_id); in BPF_CALL_4()
530 return btf_type_seq_show_flags(btf, btf_id, ptr->ptr, m, flags); in BPF_CALL_4()
980 s32 *btf_id) in bpf_btf_printf_prepare() argument
996 *btf_id = ptr->type_id; in bpf_btf_printf_prepare()
1000 if (*btf_id > 0) in bpf_btf_printf_prepare()
1001 t = btf_type_by_id(*btf, *btf_id); in bpf_btf_printf_prepare()
1002 if (*btf_id <= 0 || !t) in bpf_btf_printf_prepare()
1012 s32 btf_id; in BPF_CALL_5() local
[all …]

123