Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf bpf: Pull in bpf_program__get_prog_info_linear()

To prepare for impending deprecation of libbpf's bpf_program__get_prog_info_linear(),
pull in the function and associated helpers into the perf codebase and migrate
existing uses to the perf copy.

Since libbpf's deprecated definitions will still be visible to perf, it is necessary
to rename perf's definitions.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20211011082031.4148337-4-davemarchevsky@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Dave Marchevsky and committed by
Arnaldo Carvalho de Melo
6ac22d03 ba4026b0

+374 -33
+1 -1
tools/perf/Documentation/perf.data-file-format.txt
··· 346 346 347 347 HEADER_BPF_PROG_INFO = 25, 348 348 349 - struct bpf_prog_info_linear, which contains detailed information about 349 + struct perf_bpil, which contains detailed information about 350 350 a BPF program, including type, id, tag, jited/xlated instructions, etc. 351 351 352 352 HEADER_BPF_BTF = 26,
+1
tools/perf/util/Build
··· 202 202 perf-y += perf-hooks.o 203 203 204 204 perf-$(CONFIG_LIBBPF) += bpf-event.o 205 + perf-$(CONFIG_LIBBPF) += bpf-utils.o 205 206 206 207 perf-$(CONFIG_CXX) += c++/ 207 208
+2 -1
tools/perf/util/annotate.c
··· 28 28 #include "evsel.h" 29 29 #include "evlist.h" 30 30 #include "bpf-event.h" 31 + #include "bpf-utils.h" 31 32 #include "block-range.h" 32 33 #include "string2.h" 33 34 #include "util/event.h" ··· 1705 1704 { 1706 1705 struct annotation *notes = symbol__annotation(sym); 1707 1706 struct annotation_options *opts = args->options; 1708 - struct bpf_prog_info_linear *info_linear; 1709 1707 struct bpf_prog_linfo *prog_linfo = NULL; 1710 1708 struct bpf_prog_info_node *info_node; 1711 1709 int len = sym->end - sym->start; 1712 1710 disassembler_ftype disassemble; 1713 1711 struct map *map = args->ms.map; 1712 + struct perf_bpil *info_linear; 1714 1713 struct disassemble_info info; 1715 1714 struct dso *dso = map->dso; 1716 1715 int pc = 0, count, sub_id;
+20 -21
tools/perf/util/bpf-event.c
··· 10 10 #include <internal/lib.h> 11 11 #include <symbol/kallsyms.h> 12 12 #include "bpf-event.h" 13 + #include "bpf-utils.h" 13 14 #include "debug.h" 14 15 #include "dso.h" 15 16 #include "symbol.h" ··· 33 32 return err ? ERR_PTR(err) : btf; 34 33 } 35 34 36 - #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) 37 - 38 35 static int snprintf_hex(char *buf, size_t size, unsigned char *data, size_t len) 39 36 { 40 37 int ret = 0; ··· 47 48 union perf_event *event, 48 49 struct perf_sample *sample __maybe_unused) 49 50 { 50 - struct bpf_prog_info_linear *info_linear; 51 51 struct bpf_prog_info_node *info_node; 52 52 struct perf_env *env = machine->env; 53 + struct perf_bpil *info_linear; 53 54 int id = event->bpf.id; 54 55 unsigned int i; 55 56 ··· 174 175 { 175 176 struct perf_record_ksymbol *ksymbol_event = &event->ksymbol; 176 177 struct perf_record_bpf_event *bpf_event = &event->bpf; 177 - struct bpf_prog_info_linear *info_linear; 178 178 struct perf_tool *tool = session->tool; 179 179 struct bpf_prog_info_node *info_node; 180 + struct perf_bpil *info_linear; 180 181 struct bpf_prog_info *info; 181 182 struct btf *btf = NULL; 182 183 struct perf_env *env; ··· 190 191 */ 191 192 env = session->data ? &session->header.env : &perf_env; 192 193 193 - arrays = 1UL << BPF_PROG_INFO_JITED_KSYMS; 194 - arrays |= 1UL << BPF_PROG_INFO_JITED_FUNC_LENS; 195 - arrays |= 1UL << BPF_PROG_INFO_FUNC_INFO; 196 - arrays |= 1UL << BPF_PROG_INFO_PROG_TAGS; 197 - arrays |= 1UL << BPF_PROG_INFO_JITED_INSNS; 198 - arrays |= 1UL << BPF_PROG_INFO_LINE_INFO; 199 - arrays |= 1UL << BPF_PROG_INFO_JITED_LINE_INFO; 194 + arrays = 1UL << PERF_BPIL_JITED_KSYMS; 195 + arrays |= 1UL << PERF_BPIL_JITED_FUNC_LENS; 196 + arrays |= 1UL << PERF_BPIL_FUNC_INFO; 197 + arrays |= 1UL << PERF_BPIL_PROG_TAGS; 198 + arrays |= 1UL << PERF_BPIL_JITED_INSNS; 199 + arrays |= 1UL << PERF_BPIL_LINE_INFO; 200 + arrays |= 1UL << PERF_BPIL_JITED_LINE_INFO; 200 201 201 - info_linear = bpf_program__get_prog_info_linear(fd, arrays); 202 + info_linear = get_bpf_prog_info_linear(fd, arrays); 202 203 if (IS_ERR_OR_NULL(info_linear)) { 203 204 info_linear = NULL; 204 205 pr_debug("%s: failed to get BPF program info. aborting\n", __func__); ··· 451 452 452 453 static void perf_env__add_bpf_info(struct perf_env *env, u32 id) 453 454 { 454 - struct bpf_prog_info_linear *info_linear; 455 455 struct bpf_prog_info_node *info_node; 456 + struct perf_bpil *info_linear; 456 457 struct btf *btf = NULL; 457 458 u64 arrays; 458 459 u32 btf_id; ··· 462 463 if (fd < 0) 463 464 return; 464 465 465 - arrays = 1UL << BPF_PROG_INFO_JITED_KSYMS; 466 - arrays |= 1UL << BPF_PROG_INFO_JITED_FUNC_LENS; 467 - arrays |= 1UL << BPF_PROG_INFO_FUNC_INFO; 468 - arrays |= 1UL << BPF_PROG_INFO_PROG_TAGS; 469 - arrays |= 1UL << BPF_PROG_INFO_JITED_INSNS; 470 - arrays |= 1UL << BPF_PROG_INFO_LINE_INFO; 471 - arrays |= 1UL << BPF_PROG_INFO_JITED_LINE_INFO; 466 + arrays = 1UL << PERF_BPIL_JITED_KSYMS; 467 + arrays |= 1UL << PERF_BPIL_JITED_FUNC_LENS; 468 + arrays |= 1UL << PERF_BPIL_FUNC_INFO; 469 + arrays |= 1UL << PERF_BPIL_PROG_TAGS; 470 + arrays |= 1UL << PERF_BPIL_JITED_INSNS; 471 + arrays |= 1UL << PERF_BPIL_LINE_INFO; 472 + arrays |= 1UL << PERF_BPIL_JITED_LINE_INFO; 472 473 473 - info_linear = bpf_program__get_prog_info_linear(fd, arrays); 474 + info_linear = get_bpf_prog_info_linear(fd, arrays); 474 475 if (IS_ERR_OR_NULL(info_linear)) { 475 476 pr_debug("%s: failed to get BPF program info. aborting\n", __func__); 476 477 goto out;
+1 -1
tools/perf/util/bpf-event.h
··· 19 19 struct target; 20 20 21 21 struct bpf_prog_info_node { 22 - struct bpf_prog_info_linear *info_linear; 22 + struct perf_bpil *info_linear; 23 23 struct rb_node rb_node; 24 24 }; 25 25
+261
tools/perf/util/bpf-utils.c
··· 1 + // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) 2 + 3 + #ifndef _GNU_SOURCE 4 + #define _GNU_SOURCE 5 + #endif 6 + 7 + #include <errno.h> 8 + #include <stdlib.h> 9 + #include <linux/err.h> 10 + #include <linux/kernel.h> 11 + #include <bpf/bpf.h> 12 + #include "bpf-utils.h" 13 + #include "debug.h" 14 + 15 + struct bpil_array_desc { 16 + int array_offset; /* e.g. offset of jited_prog_insns */ 17 + int count_offset; /* e.g. offset of jited_prog_len */ 18 + int size_offset; /* > 0: offset of rec size, 19 + * < 0: fix size of -size_offset 20 + */ 21 + }; 22 + 23 + static struct bpil_array_desc bpil_array_desc[] = { 24 + [PERF_BPIL_JITED_INSNS] = { 25 + offsetof(struct bpf_prog_info, jited_prog_insns), 26 + offsetof(struct bpf_prog_info, jited_prog_len), 27 + -1, 28 + }, 29 + [PERF_BPIL_XLATED_INSNS] = { 30 + offsetof(struct bpf_prog_info, xlated_prog_insns), 31 + offsetof(struct bpf_prog_info, xlated_prog_len), 32 + -1, 33 + }, 34 + [PERF_BPIL_MAP_IDS] = { 35 + offsetof(struct bpf_prog_info, map_ids), 36 + offsetof(struct bpf_prog_info, nr_map_ids), 37 + -(int)sizeof(__u32), 38 + }, 39 + [PERF_BPIL_JITED_KSYMS] = { 40 + offsetof(struct bpf_prog_info, jited_ksyms), 41 + offsetof(struct bpf_prog_info, nr_jited_ksyms), 42 + -(int)sizeof(__u64), 43 + }, 44 + [PERF_BPIL_JITED_FUNC_LENS] = { 45 + offsetof(struct bpf_prog_info, jited_func_lens), 46 + offsetof(struct bpf_prog_info, nr_jited_func_lens), 47 + -(int)sizeof(__u32), 48 + }, 49 + [PERF_BPIL_FUNC_INFO] = { 50 + offsetof(struct bpf_prog_info, func_info), 51 + offsetof(struct bpf_prog_info, nr_func_info), 52 + offsetof(struct bpf_prog_info, func_info_rec_size), 53 + }, 54 + [PERF_BPIL_LINE_INFO] = { 55 + offsetof(struct bpf_prog_info, line_info), 56 + offsetof(struct bpf_prog_info, nr_line_info), 57 + offsetof(struct bpf_prog_info, line_info_rec_size), 58 + }, 59 + [PERF_BPIL_JITED_LINE_INFO] = { 60 + offsetof(struct bpf_prog_info, jited_line_info), 61 + offsetof(struct bpf_prog_info, nr_jited_line_info), 62 + offsetof(struct bpf_prog_info, jited_line_info_rec_size), 63 + }, 64 + [PERF_BPIL_PROG_TAGS] = { 65 + offsetof(struct bpf_prog_info, prog_tags), 66 + offsetof(struct bpf_prog_info, nr_prog_tags), 67 + -(int)sizeof(__u8) * BPF_TAG_SIZE, 68 + }, 69 + 70 + }; 71 + 72 + static __u32 bpf_prog_info_read_offset_u32(struct bpf_prog_info *info, 73 + int offset) 74 + { 75 + __u32 *array = (__u32 *)info; 76 + 77 + if (offset >= 0) 78 + return array[offset / sizeof(__u32)]; 79 + return -(int)offset; 80 + } 81 + 82 + static __u64 bpf_prog_info_read_offset_u64(struct bpf_prog_info *info, 83 + int offset) 84 + { 85 + __u64 *array = (__u64 *)info; 86 + 87 + if (offset >= 0) 88 + return array[offset / sizeof(__u64)]; 89 + return -(int)offset; 90 + } 91 + 92 + static void bpf_prog_info_set_offset_u32(struct bpf_prog_info *info, int offset, 93 + __u32 val) 94 + { 95 + __u32 *array = (__u32 *)info; 96 + 97 + if (offset >= 0) 98 + array[offset / sizeof(__u32)] = val; 99 + } 100 + 101 + static void bpf_prog_info_set_offset_u64(struct bpf_prog_info *info, int offset, 102 + __u64 val) 103 + { 104 + __u64 *array = (__u64 *)info; 105 + 106 + if (offset >= 0) 107 + array[offset / sizeof(__u64)] = val; 108 + } 109 + 110 + struct perf_bpil * 111 + get_bpf_prog_info_linear(int fd, __u64 arrays) 112 + { 113 + struct bpf_prog_info info = {}; 114 + struct perf_bpil *info_linear; 115 + __u32 info_len = sizeof(info); 116 + __u32 data_len = 0; 117 + int i, err; 118 + void *ptr; 119 + 120 + if (arrays >> PERF_BPIL_LAST_ARRAY) 121 + return ERR_PTR(-EINVAL); 122 + 123 + /* step 1: get array dimensions */ 124 + err = bpf_obj_get_info_by_fd(fd, &info, &info_len); 125 + if (err) { 126 + pr_debug("can't get prog info: %s", strerror(errno)); 127 + return ERR_PTR(-EFAULT); 128 + } 129 + 130 + /* step 2: calculate total size of all arrays */ 131 + for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) { 132 + bool include_array = (arrays & (1UL << i)) > 0; 133 + struct bpil_array_desc *desc; 134 + __u32 count, size; 135 + 136 + desc = bpil_array_desc + i; 137 + 138 + /* kernel is too old to support this field */ 139 + if (info_len < desc->array_offset + sizeof(__u32) || 140 + info_len < desc->count_offset + sizeof(__u32) || 141 + (desc->size_offset > 0 && info_len < (__u32)desc->size_offset)) 142 + include_array = false; 143 + 144 + if (!include_array) { 145 + arrays &= ~(1UL << i); /* clear the bit */ 146 + continue; 147 + } 148 + 149 + count = bpf_prog_info_read_offset_u32(&info, desc->count_offset); 150 + size = bpf_prog_info_read_offset_u32(&info, desc->size_offset); 151 + 152 + data_len += count * size; 153 + } 154 + 155 + /* step 3: allocate continuous memory */ 156 + data_len = roundup(data_len, sizeof(__u64)); 157 + info_linear = malloc(sizeof(struct perf_bpil) + data_len); 158 + if (!info_linear) 159 + return ERR_PTR(-ENOMEM); 160 + 161 + /* step 4: fill data to info_linear->info */ 162 + info_linear->arrays = arrays; 163 + memset(&info_linear->info, 0, sizeof(info)); 164 + ptr = info_linear->data; 165 + 166 + for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) { 167 + struct bpil_array_desc *desc; 168 + __u32 count, size; 169 + 170 + if ((arrays & (1UL << i)) == 0) 171 + continue; 172 + 173 + desc = bpil_array_desc + i; 174 + count = bpf_prog_info_read_offset_u32(&info, desc->count_offset); 175 + size = bpf_prog_info_read_offset_u32(&info, desc->size_offset); 176 + bpf_prog_info_set_offset_u32(&info_linear->info, 177 + desc->count_offset, count); 178 + bpf_prog_info_set_offset_u32(&info_linear->info, 179 + desc->size_offset, size); 180 + bpf_prog_info_set_offset_u64(&info_linear->info, 181 + desc->array_offset, 182 + ptr_to_u64(ptr)); 183 + ptr += count * size; 184 + } 185 + 186 + /* step 5: call syscall again to get required arrays */ 187 + err = bpf_obj_get_info_by_fd(fd, &info_linear->info, &info_len); 188 + if (err) { 189 + pr_debug("can't get prog info: %s", strerror(errno)); 190 + free(info_linear); 191 + return ERR_PTR(-EFAULT); 192 + } 193 + 194 + /* step 6: verify the data */ 195 + for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) { 196 + struct bpil_array_desc *desc; 197 + __u32 v1, v2; 198 + 199 + if ((arrays & (1UL << i)) == 0) 200 + continue; 201 + 202 + desc = bpil_array_desc + i; 203 + v1 = bpf_prog_info_read_offset_u32(&info, desc->count_offset); 204 + v2 = bpf_prog_info_read_offset_u32(&info_linear->info, 205 + desc->count_offset); 206 + if (v1 != v2) 207 + pr_warning("%s: mismatch in element count\n", __func__); 208 + 209 + v1 = bpf_prog_info_read_offset_u32(&info, desc->size_offset); 210 + v2 = bpf_prog_info_read_offset_u32(&info_linear->info, 211 + desc->size_offset); 212 + if (v1 != v2) 213 + pr_warning("%s: mismatch in rec size\n", __func__); 214 + } 215 + 216 + /* step 7: update info_len and data_len */ 217 + info_linear->info_len = sizeof(struct bpf_prog_info); 218 + info_linear->data_len = data_len; 219 + 220 + return info_linear; 221 + } 222 + 223 + void bpil_addr_to_offs(struct perf_bpil *info_linear) 224 + { 225 + int i; 226 + 227 + for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) { 228 + struct bpil_array_desc *desc; 229 + __u64 addr, offs; 230 + 231 + if ((info_linear->arrays & (1UL << i)) == 0) 232 + continue; 233 + 234 + desc = bpil_array_desc + i; 235 + addr = bpf_prog_info_read_offset_u64(&info_linear->info, 236 + desc->array_offset); 237 + offs = addr - ptr_to_u64(info_linear->data); 238 + bpf_prog_info_set_offset_u64(&info_linear->info, 239 + desc->array_offset, offs); 240 + } 241 + } 242 + 243 + void bpil_offs_to_addr(struct perf_bpil *info_linear) 244 + { 245 + int i; 246 + 247 + for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) { 248 + struct bpil_array_desc *desc; 249 + __u64 addr, offs; 250 + 251 + if ((info_linear->arrays & (1UL << i)) == 0) 252 + continue; 253 + 254 + desc = bpil_array_desc + i; 255 + offs = bpf_prog_info_read_offset_u64(&info_linear->info, 256 + desc->array_offset); 257 + addr = offs + ptr_to_u64(info_linear->data); 258 + bpf_prog_info_set_offset_u64(&info_linear->info, 259 + desc->array_offset, addr); 260 + } 261 + }
+76
tools/perf/util/bpf-utils.h
··· 1 + /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ 2 + 3 + #ifndef __PERF_BPF_UTILS_H 4 + #define __PERF_BPF_UTILS_H 5 + 6 + #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) 7 + 8 + #ifdef HAVE_LIBBPF_SUPPORT 9 + 10 + #include <bpf/libbpf.h> 11 + 12 + /* 13 + * Get bpf_prog_info in continuous memory 14 + * 15 + * struct bpf_prog_info has multiple arrays. The user has option to choose 16 + * arrays to fetch from kernel. The following APIs provide an uniform way to 17 + * fetch these data. All arrays in bpf_prog_info are stored in a single 18 + * continuous memory region. This makes it easy to store the info in a 19 + * file. 20 + * 21 + * Before writing perf_bpil to files, it is necessary to 22 + * translate pointers in bpf_prog_info to offsets. Helper functions 23 + * bpil_addr_to_offs() and bpil_offs_to_addr() 24 + * are introduced to switch between pointers and offsets. 25 + * 26 + * Examples: 27 + * # To fetch map_ids and prog_tags: 28 + * __u64 arrays = (1UL << PERF_BPIL_MAP_IDS) | 29 + * (1UL << PERF_BPIL_PROG_TAGS); 30 + * struct perf_bpil *info_linear = 31 + * get_bpf_prog_info_linear(fd, arrays); 32 + * 33 + * # To save data in file 34 + * bpil_addr_to_offs(info_linear); 35 + * write(f, info_linear, sizeof(*info_linear) + info_linear->data_len); 36 + * 37 + * # To read data from file 38 + * read(f, info_linear, <proper_size>); 39 + * bpil_offs_to_addr(info_linear); 40 + */ 41 + enum perf_bpil_array_types { 42 + PERF_BPIL_FIRST_ARRAY = 0, 43 + PERF_BPIL_JITED_INSNS = 0, 44 + PERF_BPIL_XLATED_INSNS, 45 + PERF_BPIL_MAP_IDS, 46 + PERF_BPIL_JITED_KSYMS, 47 + PERF_BPIL_JITED_FUNC_LENS, 48 + PERF_BPIL_FUNC_INFO, 49 + PERF_BPIL_LINE_INFO, 50 + PERF_BPIL_JITED_LINE_INFO, 51 + PERF_BPIL_PROG_TAGS, 52 + PERF_BPIL_LAST_ARRAY, 53 + }; 54 + 55 + struct perf_bpil { 56 + /* size of struct bpf_prog_info, when the tool is compiled */ 57 + __u32 info_len; 58 + /* total bytes allocated for data, round up to 8 bytes */ 59 + __u32 data_len; 60 + /* which arrays are included in data */ 61 + __u64 arrays; 62 + struct bpf_prog_info info; 63 + __u8 data[]; 64 + }; 65 + 66 + struct perf_bpil * 67 + get_bpf_prog_info_linear(int fd, __u64 arrays); 68 + 69 + void 70 + bpil_addr_to_offs(struct perf_bpil *info_linear); 71 + 72 + void 73 + bpil_offs_to_addr(struct perf_bpil *info_linear); 74 + 75 + #endif /* HAVE_LIBBPF_SUPPORT */ 76 + #endif /* __PERF_BPF_UTILS_H */
+3 -3
tools/perf/util/bpf_counter.c
··· 13 13 #include <perf/bpf_perf.h> 14 14 15 15 #include "bpf_counter.h" 16 + #include "bpf-utils.h" 16 17 #include "counts.h" 17 18 #include "debug.h" 18 19 #include "evsel.h" ··· 62 61 63 62 static char *bpf_target_prog_name(int tgt_fd) 64 63 { 65 - struct bpf_prog_info_linear *info_linear; 66 64 struct bpf_func_info *func_info; 65 + struct perf_bpil *info_linear; 67 66 const struct btf_type *t; 68 67 struct btf *btf = NULL; 69 68 char *name = NULL; 70 69 71 - info_linear = bpf_program__get_prog_info_linear( 72 - tgt_fd, 1UL << BPF_PROG_INFO_FUNC_INFO); 70 + info_linear = get_bpf_prog_info_linear(tgt_fd, 1UL << PERF_BPIL_FUNC_INFO); 73 71 if (IS_ERR_OR_NULL(info_linear)) { 74 72 pr_debug("failed to get info_linear for prog FD %d\n", tgt_fd); 75 73 return NULL;
+1
tools/perf/util/dso.c
··· 14 14 #ifdef HAVE_LIBBPF_SUPPORT 15 15 #include <bpf/libbpf.h> 16 16 #include "bpf-event.h" 17 + #include "bpf-utils.h" 17 18 #endif 18 19 #include "compress.h" 19 20 #include "env.h"
+1
tools/perf/util/env.c
··· 16 16 17 17 #ifdef HAVE_LIBBPF_SUPPORT 18 18 #include "bpf-event.h" 19 + #include "bpf-utils.h" 19 20 #include <bpf/libbpf.h> 20 21 21 22 void perf_env__insert_bpf_prog_info(struct perf_env *env,
+7 -6
tools/perf/util/header.c
··· 48 48 #include "util/util.h" // perf_exe() 49 49 #include "cputopo.h" 50 50 #include "bpf-event.h" 51 + #include "bpf-utils.h" 51 52 #include "clockid.h" 52 53 #include "pmu-hybrid.h" 53 54 ··· 1007 1006 1008 1007 node = rb_entry(next, struct bpf_prog_info_node, rb_node); 1009 1008 next = rb_next(&node->rb_node); 1010 - len = sizeof(struct bpf_prog_info_linear) + 1009 + len = sizeof(struct perf_bpil) + 1011 1010 node->info_linear->data_len; 1012 1011 1013 1012 /* before writing to file, translate address to offset */ 1014 - bpf_program__bpil_addr_to_offs(node->info_linear); 1013 + bpil_addr_to_offs(node->info_linear); 1015 1014 ret = do_write(ff, node->info_linear, len); 1016 1015 /* 1017 1016 * translate back to address even when do_write() fails, 1018 1017 * so that this function never changes the data. 1019 1018 */ 1020 - bpf_program__bpil_offs_to_addr(node->info_linear); 1019 + bpil_offs_to_addr(node->info_linear); 1021 1020 if (ret < 0) 1022 1021 goto out; 1023 1022 } ··· 3019 3018 #ifdef HAVE_LIBBPF_SUPPORT 3020 3019 static int process_bpf_prog_info(struct feat_fd *ff, void *data __maybe_unused) 3021 3020 { 3022 - struct bpf_prog_info_linear *info_linear; 3023 3021 struct bpf_prog_info_node *info_node; 3024 3022 struct perf_env *env = &ff->ph->env; 3023 + struct perf_bpil *info_linear; 3025 3024 u32 count, i; 3026 3025 int err = -1; 3027 3026 ··· 3050 3049 goto out; 3051 3050 } 3052 3051 3053 - info_linear = malloc(sizeof(struct bpf_prog_info_linear) + 3052 + info_linear = malloc(sizeof(struct perf_bpil) + 3054 3053 data_len); 3055 3054 if (!info_linear) 3056 3055 goto out; ··· 3072 3071 goto out; 3073 3072 3074 3073 /* after reading from file, translate offset to address */ 3075 - bpf_program__bpil_offs_to_addr(info_linear); 3074 + bpil_offs_to_addr(info_linear); 3076 3075 info_node->info_linear = info_linear; 3077 3076 perf_env__insert_bpf_prog_info(env, info_node); 3078 3077 }