Re: [PATCH v7 bpf-next RESEND 1/2] bpf: Add bpf_read_branch_records() helper

From: Daniel Xu
Date: Fri Feb 14 2020 - 01:35:08 EST


On Tue Feb 11, 2020 at 11:23 AM, Andrii Nakryiko wrote:
> On Mon, Feb 10, 2020 at 12:09 PM Daniel Xu <dxu@xxxxxxxxx> wrote:
[...]
> > + * int bpf_read_branch_records(struct bpf_perf_event_data *ctx, void *buf, u32 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.
> > + * Return
> > + * On success, number of bytes written to *buf*. On error, a
> > + * negative value.
> > + *
> > + * The *flags* can be set to **BPF_F_GET_BRANCH_RECORDS_SIZE** to
> > + * instead return the number of bytes required to store all the
> > + * branch entries. If this flag is set, *buf* may be NULL.
> > + *
> > + * **-EINVAL** if arguments invalid or **buf_size** not a multiple
>
>
> buf_size -> size

Whoops, thanks for catching.

[...]