lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ya4CxsyoyFQVFzoi@kernel.org>
Date:   Mon, 6 Dec 2021 09:32:06 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Song Liu <songliubraving@...com>
Cc:     Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>
Subject: Re: Building perf with BUILD_BPF_SKEL=1 by default

Em Fri, Dec 03, 2021 at 08:05:59PM +0000, Song Liu escreveu:
> > On Dec 3, 2021, at 5:28 AM, Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
> > The failure for fedora:32, which seems to be on the threshold for clang
> > to be considered recent enough for building skels fails differently:

> > clang version 10.0.1 (Fedora 10.0.1-3.fc32)
> > Target: x86_64-unknown-linux-gnu
> > Thread model: posix
> > InstalledDir: /usr/bin
> > Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/10
> > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
> > Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/10
> > Candidate multilib: .;@m64
> > Candidate multilib: 32;@m32
> > Selected multilib: .;@m64
> > + '[' '!' ']'
> > + rm -rf /tmp/build/perf
> > + mkdir /tmp/build/perf
> > + make ARCH= CROSS_COMPILE= EXTRA_CFLAGS= BUILD_BPF_SKEL=1 -C tools/perf O=/tmp/build/perf
> > make: Entering directory '/git/perf-5.16.0-rc3/tools/perf'
> >  BUILD:   Doing 'make -j32' parallel build
> >  HOSTCC  /tmp/build/perf/fixdep.o
> >  HOSTLD  /tmp/build/perf/fixdep-in.o
> >  LINK    /tmp/build/perf/fixdep
> > /bin/sh: -c: line 0: syntax error near unexpected token `('
> > /bin/sh: -c: line 0: `expr bison (GNU Bison) 3.5 \>\= 371'
> > Makefile.config:997: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
> > 
> > Auto-detecting system features:
> > ...                         dwarf: [ on  ]
> > ...            dwarf_getlocations: [ on  ]
> > ...                         glibc: [ on  ]
> > ...                        libbfd: [ on  ]
> > ...                libbfd-buildid: [ on  ]
> > ...                        libcap: [ on  ]
> > ...                        libelf: [ on  ]
> > ...                       libnuma: [ on  ]
> > ...        numa_num_possible_cpus: [ on  ]
> > ...                       libperl: [ on  ]
> > ...                     libpython: [ on  ]
> > ...                     libcrypto: [ on  ]
> > ...                     libunwind: [ on  ]
> > ...            libdw-dwarf-unwind: [ on  ]
> > ...                          zlib: [ on  ]
> > ...                          lzma: [ on  ]
> > ...                     get_cpuid: [ on  ]
> > ...                           bpf: [ on  ]
> > ...                        libaio: [ on  ]
> > ...                       libzstd: [ on  ]
> > ...        disassembler-four-args: [ on  ]
> > 

<SNIP>

> >  GEN     /tmp/build/perf/util/bpf_skel/vmlinux.h
> >  CLANG   /tmp/build/perf/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o
> >  CLANG   /tmp/build/perf/util/bpf_skel/.tmp/bperf_leader.bpf.o
> >  CLANG   /tmp/build/perf/util/bpf_skel/.tmp/bperf_follower.bpf.o
> >  CLANG   /tmp/build/perf/util/bpf_skel/.tmp/bperf_cgroup.bpf.o
> >  GENSKEL /tmp/build/perf/util/bpf_skel/bpf_prog_profiler.skel.h
> >  GENSKEL /tmp/build/perf/util/bpf_skel/bperf_leader.skel.h
> > libbpf: elf: skipping unrecognized data section(9) .eh_frame
> > libbpf: elf: skipping relo section(15) .rel.eh_frame for section(9) .eh_frame
> > libbpf: elf: skipping unrecognized data section(7) .eh_frame
> > libbpf: elf: skipping relo section(12) .rel.eh_frame for section(7) .eh_frame
> > libbpf: map 'prev_readings': unexpected def kind var.
> > Error: failed to open BPF object file: Invalid argument
> > make[2]: *** [Makefile.perf:1076: /tmp/build/perf/util/bpf_skel/bperf_leader.skel.h] Error 255
> > make[2]: *** Waiting for unfinished jobs....
> > make[1]: *** [Makefile.perf:240: sub-make] Error 2
> > make: *** [Makefile:70: all] Error 2
> > make: Leaving directory '/git/perf-5.16.0-rc3/tools/perf'
> > + exit 1
> > [perfbuilder@...e 32]$
> 
> Cc Andrii. 
> 
> Could you please try the fix below? 
> 
> If it doesn't work, could you please dump btf for debugging?
> 
>   bpftool btf dump file /tmp/build/perf/util/bpf_skel/.tmp/bperf_leader.bpf.o

It fixes the issue on Alpine Linux 3.12 and 3.13, Alt Linux p9 and fedora:32, probably others, still testing.

Can you please provide a cset commit log for me to stamp on it?

- Arnaldo
 
> Thanks,
> Song
> 
> 
> 
> 
> diff --git i/tools/perf/util/bpf_skel/bperf_follower.bpf.c w/tools/perf/util/bpf_skel/bperf_follower.bpf.c
> index 4a6acfde14937..bd191c9bc49bc 100644
> --- i/tools/perf/util/bpf_skel/bperf_follower.bpf.c
> +++ w/tools/perf/util/bpf_skel/bperf_follower.bpf.c
> @@ -6,8 +6,19 @@
>  #include "bperf.h"
>  #include "bperf_u.h"
> 
> -reading_map diff_readings SEC(".maps");
> -reading_map accum_readings SEC(".maps");
> +struct {
> +       __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
> +       __uint(key_size, sizeof(__u32));
> +       __uint(value_size, sizeof(struct bpf_perf_event_value));
> +       __uint(max_entries, 1);
> +} diff_readings SEC(".maps");
> +
> +struct {
> +       __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
> +       __uint(key_size, sizeof(__u32));
> +       __uint(value_size, sizeof(struct bpf_perf_event_value));
> +       __uint(max_entries, 1);
> +} accum_readings SEC(".maps");
> 
>  struct {
>         __uint(type, BPF_MAP_TYPE_HASH);
> diff --git i/tools/perf/util/bpf_skel/bperf_leader.bpf.c w/tools/perf/util/bpf_skel/bperf_leader.bpf.c
> index 40d962b058634..d52a335e63f0f 100644
> --- i/tools/perf/util/bpf_skel/bperf_leader.bpf.c
> +++ w/tools/perf/util/bpf_skel/bperf_leader.bpf.c
> @@ -12,8 +12,19 @@ struct {
>         __uint(map_flags, BPF_F_PRESERVE_ELEMS);
>  } events SEC(".maps");
> 
> -reading_map prev_readings SEC(".maps");
> -reading_map diff_readings SEC(".maps");
> +struct {
> +       __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
> +       __uint(key_size, sizeof(__u32));
> +       __uint(value_size, sizeof(struct bpf_perf_event_value));
> +       __uint(max_entries, 1);
> +} prev_readings SEC(".maps");
> +
> +struct {
> +       __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
> +       __uint(key_size, sizeof(__u32));
> +       __uint(value_size, sizeof(struct bpf_perf_event_value));
> +       __uint(max_entries, 1);
> +} diff_readings SEC(".maps");
> 
>  SEC("raw_tp/sched_switch")
>  int BPF_PROG(on_switch)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ