linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Song Liu <songliubraving@fb.com>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-perf-users@vger.kernel.org"
	<linux-perf-users@vger.kernel.org>
Subject: Re: Building perf with BUILD_BPF_SKEL=1 by default
Date: Mon, 6 Dec 2021 09:32:06 -0300	[thread overview]
Message-ID: <Ya4CxsyoyFQVFzoi@kernel.org> (raw)
In-Reply-To: <80DE5BBF-E831-43F5-91DE-46775DE4D6E7@fb.com>

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@kernel.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@five 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)

  reply	other threads:[~2021-12-06 12:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 13:10 Building perf with BUILD_BPF_SKEL=1 by default Arnaldo Carvalho de Melo
2021-12-03 13:28 ` Arnaldo Carvalho de Melo
2021-12-03 14:23   ` Arnaldo Carvalho de Melo
2021-12-03 19:40     ` Song Liu
2021-12-03 20:05   ` Song Liu
2021-12-06 12:32     ` Arnaldo Carvalho de Melo [this message]
2021-12-06 17:08       ` Song Liu
2021-12-06 20:00         ` Arnaldo Carvalho de Melo
2021-12-06 22:34           ` Song Liu
2021-12-07  0:49             ` Arnaldo Carvalho de Melo
2021-12-07  1:07               ` Song Liu
2021-12-03 19:32 ` Song Liu
2021-12-05 13:06   ` Arnaldo Carvalho de Melo
2021-12-05 13:38     ` Arnaldo Carvalho de Melo
2021-12-06  3:47     ` Song Liu
2021-12-06 14:16   ` Athira Rajeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ya4CxsyoyFQVFzoi@kernel.org \
    --to=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).