[PATCHv2 0/3] perf/bpf: Replace deprecated code

Jiri Olsa posted 3 patches 4 years, 4 months ago
There is a newer version of this series
tools/perf/util/bpf-loader.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 230 insertions(+), 37 deletions(-)
[PATCHv2 0/3] perf/bpf: Replace deprecated code
Posted by Jiri Olsa 4 years, 4 months ago
hi,
the original patchset [1] removed the whole perf functionality
with the hope nobody's using that. But it turned out there's
actually bpf script using prologue functionality, so there
might be users of this.

This patchset gets rid of and adds workaround (and keeps the
current functionality) for following deprecated libbpf
functions/struct:

  bpf_program__set_priv
  bpf_program__priv
  bpf_map__set_priv
  bpf_map__priv
  bpf_program__set_prep
  bpf_program__nth_fd
  struct bpf_prog_prep_result

Basically it implements workarounds suggested by Andrii in [2].

I tested with script from examples/bpf that are working for me:

  examples/bpf/hello.c
  examples/bpf/5sec.c

The rest seem to fail for various reasons even without this
change..  they seem unmaintained for some time now, but I might
have wrong setup.

Also available in here:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/depre

thanks,
jirka


[1] https://lore.kernel.org/linux-perf-users/YgoPxhE3OEEmZqla@krava/T/#t
[2] https://lore.kernel.org/linux-perf-users/YgoPxhE3OEEmZqla@krava/T/#md3ccab9fe70a4583e94603b1a562e369bd67b17d
---
Jiri Olsa (3):
      perf tools: Remove bpf_program__set_priv/bpf_program__priv usage
      perf tools: Remove bpf_map__set_priv/bpf_map__priv usage
      perf tools: Rework prologue generation code

 tools/perf/util/bpf-loader.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 230 insertions(+), 37 deletions(-)
Re: [PATCHv2 0/3] perf/bpf: Replace deprecated code
Posted by Andrii Nakryiko 4 years, 4 months ago
On Thu, Feb 17, 2022 at 5:19 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> hi,
> the original patchset [1] removed the whole perf functionality
> with the hope nobody's using that. But it turned out there's
> actually bpf script using prologue functionality, so there
> might be users of this.
>
> This patchset gets rid of and adds workaround (and keeps the
> current functionality) for following deprecated libbpf
> functions/struct:
>
>   bpf_program__set_priv
>   bpf_program__priv
>   bpf_map__set_priv
>   bpf_map__priv
>   bpf_program__set_prep
>   bpf_program__nth_fd
>   struct bpf_prog_prep_result
>
> Basically it implements workarounds suggested by Andrii in [2].
>
> I tested with script from examples/bpf that are working for me:
>
>   examples/bpf/hello.c
>   examples/bpf/5sec.c
>
> The rest seem to fail for various reasons even without this
> change..  they seem unmaintained for some time now, but I might
> have wrong setup.
>
> Also available in here:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
>   perf/depre
>
> thanks,
> jirka
>
>
> [1] https://lore.kernel.org/linux-perf-users/YgoPxhE3OEEmZqla@krava/T/#t
> [2] https://lore.kernel.org/linux-perf-users/YgoPxhE3OEEmZqla@krava/T/#md3ccab9fe70a4583e94603b1a562e369bd67b17d
> ---
> Jiri Olsa (3):
>       perf tools: Remove bpf_program__set_priv/bpf_program__priv usage
>       perf tools: Remove bpf_map__set_priv/bpf_map__priv usage
>       perf tools: Rework prologue generation code
>

It's great that you are deprecating these, thanks a lot for that! I
suggest to also doing libbpf_set_strict_mode(LIBBPF_STRICT_ALL) to
check that libbpf 1.0 won't break anything. For example, you'll need
to use a custom SEC() handler to handle those quirky sections that
perf allows. This patch set has landed in bpf-next, so you should be
good to go.


>  tools/perf/util/bpf-loader.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 230 insertions(+), 37 deletions(-)
Re: [PATCHv2 0/3] perf/bpf: Replace deprecated code
Posted by Jiri Olsa 4 years, 4 months ago
On Thu, Feb 17, 2022 at 01:55:13PM -0800, Andrii Nakryiko wrote:
> On Thu, Feb 17, 2022 at 5:19 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > hi,
> > the original patchset [1] removed the whole perf functionality
> > with the hope nobody's using that. But it turned out there's
> > actually bpf script using prologue functionality, so there
> > might be users of this.
> >
> > This patchset gets rid of and adds workaround (and keeps the
> > current functionality) for following deprecated libbpf
> > functions/struct:
> >
> >   bpf_program__set_priv
> >   bpf_program__priv
> >   bpf_map__set_priv
> >   bpf_map__priv
> >   bpf_program__set_prep
> >   bpf_program__nth_fd
> >   struct bpf_prog_prep_result
> >
> > Basically it implements workarounds suggested by Andrii in [2].
> >
> > I tested with script from examples/bpf that are working for me:
> >
> >   examples/bpf/hello.c
> >   examples/bpf/5sec.c
> >
> > The rest seem to fail for various reasons even without this
> > change..  they seem unmaintained for some time now, but I might
> > have wrong setup.
> >
> > Also available in here:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> >   perf/depre
> >
> > thanks,
> > jirka
> >
> >
> > [1] https://lore.kernel.org/linux-perf-users/YgoPxhE3OEEmZqla@krava/T/#t
> > [2] https://lore.kernel.org/linux-perf-users/YgoPxhE3OEEmZqla@krava/T/#md3ccab9fe70a4583e94603b1a562e369bd67b17d
> > ---
> > Jiri Olsa (3):
> >       perf tools: Remove bpf_program__set_priv/bpf_program__priv usage
> >       perf tools: Remove bpf_map__set_priv/bpf_map__priv usage
> >       perf tools: Rework prologue generation code
> >
> 
> It's great that you are deprecating these, thanks a lot for that! I
> suggest to also doing libbpf_set_strict_mode(LIBBPF_STRICT_ALL) to

will check

> check that libbpf 1.0 won't break anything. For example, you'll need
> to use a custom SEC() handler to handle those quirky sections that
> perf allows. This patch set has landed in bpf-next, so you should be
> good to go.

ah ok it already got merged.. I'll add it in new version

thanks,
jirka

> 
> 
> >  tools/perf/util/bpf-loader.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
> >  1 file changed, 230 insertions(+), 37 deletions(-)