Subject: Re: [PATCHv4 bpf-next 0/2] perf tools: Fix prologue generation

From: Arnaldo Carvalho de Melo <[email-masked]>
Date: Fri, 10 Jun 2022 15:38:35 -0300

Em Fri, Jun 10, 2022 at 03:34:24PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jun 09, 2022 at 01:31:52PM -0700, Andrii Nakryiko escreveu:
> > On Fri, Jun 3, 2022 at 1:45 PM Jiri Olsa <[email-masked]> wrote:
> > >
> > > hi,
> > > sending change we discussed some time ago [1] to get rid of
> > > some deprecated functions we use in perf prologue code.
> > >
> > > Despite the gloomy discussion I think the final code does
> > > not look that bad ;-)
> > >
> > > This patchset removes following libbpf functions from perf:
> > >   bpf_program__set_prep
> > >   bpf_program__nth_fd
> > >   struct bpf_prog_prep_result
> > >
> > > v4 changes:
> > >   - fix typo [Andrii]
> > >
> > > v3 changes:
> > >   - removed R0/R1 zero init in libbpf_prog_prepare_load_fn,
> > >     because it's not needed [Andrii]
> > >   - rebased/post on top of bpf-next/master which now has
> > >     all the needed perf/core changes
> > >
> > > v2 changes:
> > >   - use fallback section prog handler, so we don't need to
> > >     use section prefix [Andrii]
> > >   - realloc prog->insns array in bpf_program__set_insns [Andrii]
> > >   - squash patch 1 from previous version with
> > >     bpf_program__set_insns change [Daniel]
> > >   - patch 3 already merged [Arnaldo]
> > >   - added more comments
> > >
> > > thanks,
> > > jirka
> > >
> > 
> > Arnaldo, can I get an ack from you for this patch set? Thank you!
> 
> So, before these patches:
> 
> [acme@quaco perf-urgent]$ git log --oneline -5
> 22905f78d181f446 (HEAD) libperf evsel: Open shouldn't leak fd on failure
> a3c6da3dbd4bdf9c perf test: Fix "perf stat CSV output linter" test on s390
> 785cb9e85e8ba66f perf unwind: Fix uninitialized variable
> 874c8ca1e60b2c56 netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context
> 3d9f55c57bc3659f Merge tag 'fs_for_v5.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
> [acme@quaco perf-urgent]$ sudo su -
> [root@quaco ~]# perf -v
> perf version 5.19.rc1.g22905f78d181
> [root@quaco ~]# perf test 42
>  42: BPF filter                                                      :
>  42.1: Basic BPF filtering                                           : Ok
>  42.2: BPF pinning                                                   : Ok
>  42.3: BPF prologue generation                                       : Ok
> [root@quaco ~]#
> 
> And after:
> 
> [acme@quaco perf-urgent]$ git log --oneline -5
> f8ec656242acf2de (HEAD -> perf/urgent) perf tools: Rework prologue generation code
> a750a8dd7e5d2d4b perf tools: Register fallback libbpf section handler
> d28f2a8ad42af160 libperf evsel: Open shouldn't leak fd on failure
> a3c6da3dbd4bdf9c perf test: Fix "perf stat CSV output linter" test on s390
> 785cb9e85e8ba66f perf unwind: Fix uninitialized variable
> [acme@quaco perf-urgent]$ sudo su -
> [root@quaco ~]# perf -v
> perf version 5.19.rc1.gf8ec656242ac
> [root@quaco ~]# perf test 42
>  42: BPF filter                                                      :
>  42.1: Basic BPF filtering                                           : FAILED!
>  42.2: BPF pinning                                                   : FAILED!
>  42.3: BPF prologue generation                                       : Ok
> [root@quaco ~]# 
> 
> Jiri, can you try reproducing these? Do this require some other work
> that is in bpf-next/master? Lemme try...

No:

[acme@quaco perf-urgent]$ git log --oneline -5
d324948b907b292e (HEAD -> bpf-next-master) perf tools: Rework prologue generation code
911fc51320e09283 perf tools: Register fallback libbpf section handler
fe92833524e368e5 (bpf-next/master, bpf-next/for-next) libbpf: Fix uprobe symbol file offset calculation logic
492f99e4190a4574 bpf, docs: Fix typo "BFP_ALU" to "BPF_ALU"
0b817059a8830b8b bpftool: Fix bootstrapping during a cross compilation
[acme@quaco perf-urgent]$ sudo su -
[root@quaco ~]# perf -v
perf version 5.18.gd324948b907b
[root@quaco ~]# perf test 42
 42: BPF filter                                                      :
 42.1: Basic BPF filtering                                           : FAILED!
 42.2: BPF pinning                                                   : FAILED!
 42.3: BPF prologue generation                                       : Ok
[root@quaco ~]#

Removing these two patches:

[acme@quaco perf-urgent]$ git log --oneline -5
fe92833524e368e5 (HEAD -> bpf-next-master, bpf-next/master, bpf-next/for-next) libbpf: Fix uprobe symbol file offset calculation logic
492f99e4190a4574 bpf, docs: Fix typo "BFP_ALU" to "BPF_ALU"
0b817059a8830b8b bpftool: Fix bootstrapping during a cross compilation
d352bd889b6a9c97 Merge branch 'bpf: Add 64bit enum value support'
61dbd5982964074f docs/bpf: Update documentation for BTF_KIND_ENUM64 support
[acme@quaco perf-urgent]$ sudo su -
[root@quaco ~]# perf -v
perf version 5.18.gfe92833524e3
[root@quaco ~]# perf test 42
 42: BPF filter                                                      :
 42.1: Basic BPF filtering                                           : Ok
 42.2: BPF pinning                                                   : Ok
 42.3: BPF prologue generation                                       : Ok
[root@quaco ~]# 

- Arnaldo