Re: [PATCH bpf-next v4 1/2] perf: stop using deprecated bpf_load_program() API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 19, 2022 at 3:35 PM Song Liu <songliubraving@xxxxxx> wrote:
>
>
>
> > On Jan 19, 2022, at 3:26 PM, Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote:
> >
> > On Wed, Jan 19, 2022 at 3:20 PM Song Liu <songliubraving@xxxxxx> wrote:
> >>
> >>
> >>
> >>> On Jan 19, 2022, at 3:06 PM, Christy Lee <christylee@xxxxxx> wrote:
> >>>
> >>> bpf_load_program() API is deprecated, remove perf's usage of the
> >>> deprecated function. Add a __weak function declaration for libbpf
> >>> version compatibility.
> >>>
> >>> Signed-off-by: Christy Lee <christylee@xxxxxx>
> >>> Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> >>
> >> Acked-by: Song Liu <songliubraving@xxxxxx>
> >>
> >> With one minor comment below.
> >>
> >>> ---
> >>> tools/perf/tests/bpf.c      | 14 ++++----------
> >>> tools/perf/util/bpf-event.c | 16 ++++++++++++++++
> >>> 2 files changed, 20 insertions(+), 10 deletions(-)
> >>>
> >>> diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
> >>> index 573490530194..57b9591f7cbb 100644
> >>> --- a/tools/perf/tests/bpf.c
> >>> +++ b/tools/perf/tests/bpf.c
> >>> @@ -281,8 +281,8 @@ static int __test__bpf(int idx)
> >>>
> >>> static int check_env(void)
> >>> {
> >>> +     LIBBPF_OPTS(bpf_prog_load_opts, opts);
> >>
> >> This changes seems unnecessary.
> >>
> >>>      int err;
> >>> -     unsigned int kver_int;
> >>>      char license[] = "GPL";
> >>>
> >>>      struct bpf_insn insns[] = {
> >>> @@ -290,19 +290,13 @@ static int check_env(void)
> >>>              BPF_EXIT_INSN(),
> >>>      };
> >>>
> >>> -     err = fetch_kernel_version(&kver_int, NULL, 0);
> >>> +     err = fetch_kernel_version(&opts.kern_version, NULL, 0);
> >
> > Opts are used here. Libbpf is now performing the same kern_version
> > extraction logic, so we might not need fetch_kernel_version() now, but
> > I'd still keep it to avoid unnecessary regressions.
>
> Yeah, I noticed opts is used. But we only use opts.kern_version
> here, which is an u32. Will this be a problem if we compile perf
> against an older libbpf? (if we ever do that).

Oh, because struct bpf_prog_load_opts might not be defined? Yes, but
there will also be a problem if linking against libbpf older than v0.6
anyways (due to the bpf_prog_load() macro overload shenanigans), so I
think libbpf 0.6 is the minimum version for perf, essentially.

>
> Thanks,
> Song
>
>
>
>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux