Home
last modified time | relevance | path

Searched refs:btf (Results 1 – 25 of 53) sorted by relevance

123

/Linux-v5.4/include/linux/
Dbtf.h9 struct btf;
16 void btf_put(struct btf *btf);
18 struct btf *btf_get_by_fd(int fd);
19 int btf_get_info_by_fd(const struct btf *btf,
43 const struct btf_type *btf_type_id_size(const struct btf *btf,
46 void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
49 u32 btf_id(const struct btf *btf);
50 bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s,
53 int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t);
57 const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id);
[all …]
Dbpf.h24 struct btf;
58 const struct btf *btf,
93 struct btf *btf; member
171 return map->btf && map->ops->map_seq_show_elem; in bpf_map_support_seq_show()
175 const struct btf *btf,
395 struct btf *btf; member
/Linux-v5.4/kernel/bpf/
Dbtf.c201 struct btf { struct
250 struct btf *btf; member
295 void (*seq_show)(const struct btf *btf, const struct btf_type *t,
523 static bool btf_name_offset_valid(const struct btf *btf, u32 offset) in btf_name_offset_valid() argument
526 offset < btf->hdr.str_len; in btf_name_offset_valid()
540 static bool __btf_name_valid(const struct btf *btf, u32 offset, bool dot_ok) in __btf_name_valid() argument
543 const char *src = &btf->strings[offset]; in __btf_name_valid()
564 static bool btf_name_valid_identifier(const struct btf *btf, u32 offset) in btf_name_valid_identifier() argument
566 return __btf_name_valid(btf, offset, false); in btf_name_valid_identifier()
569 static bool btf_name_valid_section(const struct btf *btf, u32 offset) in btf_name_valid_section() argument
[all …]
Dlocal_storage.c334 const struct btf *btf, in cgroup_storage_check_btf() argument
361 if (!btf_member_is_reg_int(btf, key_type, m, 0, size)) in cgroup_storage_check_btf()
370 if (!btf_member_is_reg_int(btf, key_type, m, offset, size)) in cgroup_storage_check_btf()
391 btf_type_seq_show(map->btf, map->btf_key_type_id, key, m); in cgroup_storage_seq_show_elem()
395 btf_type_seq_show(map->btf, map->btf_value_type_id, in cgroup_storage_seq_show_elem()
402 btf_type_seq_show(map->btf, map->btf_value_type_id, in cgroup_storage_seq_show_elem()
Dsyscall.c330 btf_put(map->btf); in __bpf_map_put()
494 const struct btf *btf, in map_check_no_btf() argument
501 static int map_check_btf(struct bpf_map *map, const struct btf *btf, in map_check_btf() argument
510 key_type = btf_type_id_size(btf, &btf_key_id, &key_size); in map_check_btf()
514 key_type = btf_type_by_id(btf, 0); in map_check_btf()
519 value_type = btf_type_id_size(btf, &btf_value_id, &value_size); in map_check_btf()
523 map->spin_lock_off = btf_find_spin_lock(btf, value_type); in map_check_btf()
543 ret = map->ops->map_check_btf(map, btf, key_type, value_type); in map_check_btf()
584 struct btf *btf; in map_create() local
591 btf = btf_get_by_fd(attr->btf_fd); in map_create()
[all …]
Darraymap.c386 btf_type_seq_show(map->btf, map->btf_value_type_id, value, m); in array_map_seq_show_elem()
406 btf_type_seq_show(map->btf, map->btf_value_type_id, in percpu_array_map_seq_show_elem()
416 const struct btf *btf, in array_map_check_btf() argument
619 btf_type_seq_show(map->btf, map->btf_value_type_id, in prog_array_map_seq_show_elem()
/Linux-v5.4/tools/lib/bpf/
Dbtf.h23 struct btf;
67 LIBBPF_API void btf__free(struct btf *btf);
68 LIBBPF_API struct btf *btf__new(__u8 *data, __u32 size);
69 LIBBPF_API struct btf *btf__parse_elf(const char *path,
71 LIBBPF_API int btf__finalize_data(struct bpf_object *obj, struct btf *btf);
72 LIBBPF_API int btf__load(struct btf *btf);
73 LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
75 LIBBPF_API __u32 btf__get_nr_types(const struct btf *btf);
76 LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf,
78 LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
[all …]
Dbtf.c25 struct btf { struct
44 static int btf_add_type(struct btf *btf, struct btf_type *t) in btf_add_type() argument
46 if (btf->types_size - btf->nr_types < 2) { in btf_add_type()
50 if (btf->types_size == BTF_MAX_NR_TYPES) in btf_add_type()
53 expand_by = max(btf->types_size >> 2, 16); in btf_add_type()
54 new_size = min(BTF_MAX_NR_TYPES, btf->types_size + expand_by); in btf_add_type()
56 new_types = realloc(btf->types, sizeof(*new_types) * new_size); in btf_add_type()
60 if (btf->nr_types == 0) in btf_add_type()
63 btf->types = new_types; in btf_add_type()
64 btf->types_size = new_size; in btf_add_type()
[all …]
Dbtf_dump.c56 const struct btf *btf; member
107 return btf__name_by_offset(d->btf, name_off); in btf_name_of()
119 struct btf_dump *btf_dump__new(const struct btf *btf, in btf_dump__new() argument
131 d->btf = btf; in btf_dump__new()
164 for (i = 0, cnt = btf__get_nr_types(d->btf); i <= cnt; i++) { in btf_dump__free()
202 if (id > btf__get_nr_types(d->btf)) in btf_dump__dump_type()
207 d->type_states = calloc(1 + btf__get_nr_types(d->btf), in btf_dump__dump_type()
211 d->cached_names = calloc(1 + btf__get_nr_types(d->btf), in btf_dump__dump_type()
251 int i, j, n = btf__get_nr_types(d->btf); in btf_dump_mark_referenced()
256 t = btf__type_by_id(d->btf, i); in btf_dump_mark_referenced()
[all …]
Dlibbpf.c286 struct btf *btf; member
1019 skip_mods_and_typedefs(const struct btf *btf, __u32 id, __u32 *res_id) in skip_mods_and_typedefs() argument
1021 const struct btf_type *t = btf__type_by_id(btf, id); in skip_mods_and_typedefs()
1029 t = btf__type_by_id(btf, t->type); in skip_mods_and_typedefs()
1042 static bool get_map_field_int(const char *map_name, const struct btf *btf, in get_map_field_int() argument
1045 const struct btf_type *t = skip_mods_and_typedefs(btf, m->type, NULL); in get_map_field_int()
1046 const char *name = btf__name_by_offset(btf, m->name_off); in get_map_field_int()
1056 arr_t = btf__type_by_id(btf, t->type); in get_map_field_int()
1086 var = btf__type_by_id(obj->btf, vi->type); in bpf_object__init_user_btf_map()
1088 map_name = btf__name_by_offset(obj->btf, var->name_off); in bpf_object__init_user_btf_map()
[all …]
DBuild1 libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o str_error.o \
/Linux-v5.4/tools/bpf/bpftool/
Dbtf_dumper.c39 actual_type_id = btf__resolve_type(d->btf, type_id); in btf_dumper_modifier()
54 const struct btf_type *t = btf__type_by_id(d->btf, type_id); in btf_dumper_array()
60 elem_size = btf__resolve_size(d->btf, arr->type); in btf_dumper_array()
274 t = btf__type_by_id(d->btf, type_id); in btf_dumper_struct()
292 jsonw_name(d->jw, btf__name_by_offset(d->btf, m[i].name_off)); in btf_dumper_struct()
315 const struct btf_type *t = btf__type_by_id(d->btf, type_id); in btf_dumper_var()
319 jsonw_name(d->jw, btf__name_by_offset(d->btf, t->name_off)); in btf_dumper_var()
333 t = btf__type_by_id(d->btf, type_id); in btf_dumper_datasec()
341 jsonw_name(d->jw, btf__name_by_offset(d->btf, t->name_off)); in btf_dumper_datasec()
357 const struct btf_type *t = btf__type_by_id(d->btf, type_id); in btf_dumper_do_type()
[all …]
Dmain.h123 struct btf;
168 const struct btf *btf,
177 const struct btf *btf, in disasm_print_insn() argument
199 const struct btf *btf; member
213 void btf_dumper_type_only(const struct btf *btf, __u32 func_type_id,
216 void btf_dump_linfo_plain(const struct btf *btf,
219 void btf_dump_linfo_json(const struct btf *btf,
Dbtf.c77 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument
81 return btf__name_by_offset(btf, off) ? : "(invalid)"; in btf_str()
84 static int dump_btf_type(const struct btf *btf, __u32 id, in dump_btf_type() argument
97 jsonw_string_field(w, "name", btf_str(btf, t->name_off)); in dump_btf_type()
100 btf_str(btf, t->name_off)); in dump_btf_type()
160 const char *name = btf_str(btf, m->name_off); in dump_btf_type()
206 const char *name = btf_str(btf, v->name_off); in dump_btf_type()
251 const char *name = btf_str(btf, p->name_off); in dump_btf_type()
321 static int dump_btf_raw(const struct btf *btf, in dump_btf_raw() argument
335 t = btf__type_by_id(btf, root_type_ids[i]); in dump_btf_raw()
[all …]
Dmap.c208 unsigned char *value, struct btf *btf) in print_entry_json() argument
217 if (btf) { in print_entry_json()
219 .btf = btf, in print_entry_json()
250 if (btf) { in print_entry_json()
252 .btf = btf, in print_entry_json()
710 struct bpf_map_info *map_info, struct btf *btf, in dump_map_elem() argument
718 print_entry_json(map_info, key, value, btf); in dump_map_elem()
720 if (btf) { in dump_map_elem()
722 .btf = btf, in dump_map_elem()
775 struct btf *btf = NULL; in do_dump() local
[all …]
Dxlated_dumper.c217 struct btf *btf = dd->btf; in dump_xlated_json() local
234 if (btf && record) { in dump_xlated_json()
236 btf_dumper_type_only(btf, record->type_id, in dump_xlated_json()
252 btf_dump_linfo_json(btf, linfo, linum); in dump_xlated_json()
302 struct btf *btf = dd->btf; in dump_xlated_plain() local
315 if (btf && record) { in dump_xlated_plain()
317 btf_dumper_type_only(btf, record->type_id, in dump_xlated_plain()
331 btf_dump_linfo_plain(btf, linfo, "; ", in dump_xlated_plain()
Djit_disasm.c77 const struct btf *btf, in disasm_print_insn() argument
154 btf_dump_linfo_json(btf, linfo, linum); in disasm_print_insn()
159 btf_dump_linfo_plain(btf, linfo, "; ", in disasm_print_insn()
Dxlated_dumper.h22 struct btf *btf; member
Dprog.c420 struct btf *btf = NULL; in do_dump() local
511 if (info->btf_id && btf__get_from_id(info->btf_id, &btf)) { in do_dump()
584 btf_dumper_type_only(btf, record->type_id, in do_dump()
605 name, disasm_opt, btf, in do_dump()
621 disasm_opt, btf, NULL, 0, 0, false); in do_dump()
632 dd.btf = btf; in do_dump()
/Linux-v5.4/tools/testing/selftests/bpf/
Dtest_btf_dump.c36 static int btf_dump_all_types(const struct btf *btf, in btf_dump_all_types() argument
39 size_t type_cnt = btf__get_nr_types(btf); in btf_dump_all_types()
43 d = btf_dump__new(btf, NULL, opts, btf_dump_printf); in btf_dump_all_types()
61 struct btf *btf = NULL; in test_btf_dump_case() local
69 btf = btf__parse_elf(test_file, NULL); in test_btf_dump_case()
70 if (CHECK(IS_ERR(btf), in test_btf_dump_case()
71 "failed to load test BTF: %ld\n", PTR_ERR(btf))) { in test_btf_dump_case()
72 err = -PTR_ERR(btf); in test_btf_dump_case()
73 btf = NULL; in test_btf_dump_case()
92 err = btf_dump_all_types(btf, &test_case->opts); in test_btf_dump_case()
[all …]
/Linux-v5.4/tools/perf/util/
Dbpf-event.c95 struct btf *btf) in perf_env__fetch_btf() argument
101 data = btf__get_raw_data(btf, &data_size); in perf_env__fetch_btf()
117 struct btf *btf, in synthesize_bpf_prog_name() argument
131 if (btf) { in synthesize_bpf_prog_name()
133 t = btf__type_by_id(btf, finfo->type_id); in synthesize_bpf_prog_name()
134 short_name = btf__name_by_offset(btf, t->name_off); in synthesize_bpf_prog_name()
170 struct btf *btf = NULL; in perf_event__synthesize_one_bpf_prog() local
218 if (btf__get_from_id(info->btf_id, &btf)) { in perf_event__synthesize_one_bpf_prog()
221 btf = NULL; in perf_event__synthesize_one_bpf_prog()
224 perf_env__fetch_btf(env, info->btf_id, btf); in perf_event__synthesize_one_bpf_prog()
[all …]
/Linux-v5.4/tools/bpf/bpftool/Documentation/
Dbpftool-btf.rst2 bpftool-btf
13 **bpftool** [*OPTIONS*] **btf** *COMMAND*
22 | **bpftool** **btf** { **show** | **list** } [**id** *BTF_ID*]
23 | **bpftool** **btf dump** *BTF_SRC* [**format** *FORMAT*]
24 | **bpftool** **btf help**
33 **bpftool btf { show | list }** [**id** *BTF_ID*]
39 **bpftool btf dump** *BTF_SRC*
64 **bpftool btf help**
88 **# bpftool btf dump id 1226**
141 **$ bpftool btf dump file prog.o**
[all …]
/Linux-v5.4/scripts/
Dlink-vmlinux.sh130 ${OBJCOPY} --dump-section .BTF=.btf.vmlinux.bin ${1} 2>/dev/null
132 --rename-section .data=.BTF .btf.vmlinux.bin ${2}
189 rm -f .btf.*
254 if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then
255 btf_vmlinux_bin_o=.btf.vmlinux.bin.o
/Linux-v5.4/Documentation/ABI/testing/
Dsysfs-kernel-btf1 What: /sys/kernel/btf
9 What: /sys/kernel/btf/vmlinux
16 Documentation/bpf/btf.rst for detailed description of format
/Linux-v5.4/Documentation/bpf/
Dbtf.rst35 The file ``include/uapi/linux/btf.h`` provides high-level definition of how
155 * btf member bit offset 100 from the start of the structure,
156 * btf member pointing to an int type,
165 * btf member bit offset 102,
166 * btf member pointing to an int type,
460 * BPF_MAP_CREATE: map creation with btf key and value type info.
461 * BPF_PROG_LOAD: prog load with btf function and line info.
462 * BPF_BTF_GET_FD_BY_ID: get a btf fd
463 * BPF_OBJ_GET_INFO_BY_FD: btf, func_info, line_info
464 and other btf related info are returned.
[all …]

123