On Fri, Jan 24, 2020 at 01:17:03PM -0800, Daniel Xu wrote: > + * > + * int bpf_perf_prog_read_branches(struct bpf_perf_event_data *ctx, void *buf, u32 buf_size, u64 flags) > + * Description > + * For an eBPF program attached to a perf event, retrieve the > + * branch records (struct perf_branch_entry) associated to *ctx* > + * and store it in the buffer pointed by *buf* up to size > + * *buf_size* bytes. > + * > + * The *flags* can be set to **BPF_F_GET_BR_SIZE** to instead > + * return the number of bytes required to store all the branch > + * entries. If this flag is set, *buf* may be NULL. > + * Return > + * On success, number of bytes written to *buf*. On error, a > + * negative value. > + * > + * **-EINVAL** if arguments invalid or **buf_size** not a multiple > + * of sizeof(struct perf_branch_entry). > + * > + * **-ENOENT** if architecture does not support branch records. the patches look good, but I'm struggling to decode the names. perf_prog_read_branches... perf_prog means that it's for bpf prog that is of 'perf' type? I don't think any other helper has such prefix. read branches... branches? they are branch records or branch entries. How about bpf_read_branch_records() ? I think BPF_F_GET_BR_SIZE is too cryptic. How about BPF_F_GET_BRANCH_RECORDS_SIZE ?