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: Sun, 5 Dec 2021 10:06:42 -0300	[thread overview]
Message-ID: <Yay5Yjnj7LUodupy@kernel.org> (raw)
In-Reply-To: <CF175681-8101-43D1-ABDB-449E644BE986@fb.com>

Em Fri, Dec 03, 2021 at 07:32:34PM +0000, Song Liu escreveu:
> 
> 
> > On Dec 3, 2021, at 5:10 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > 
> > Hi Song,
> > 
> > 	So I'm changing all my containers to build with BUILD_BPF_SKEL=1
> > to then make this the default, so far older containers fail either
> > because the clang available is too old, so I've added a NO_BUILD_BPF_SKEL=1
> > env var to disable that in those containers and then there is this other
> > case where clang is recent enough but:
> > 
> >    util/bpf_skel/bperf_leader.bpf.c:13:20: error: use of undeclared identifier 'BPF_F_PRESERVE_ELEMS'
> >            __uint(map_flags, BPF_F_PRESERVE_ELEMS);
> > 
> > Because the system's /usr/include/linux/bpf.h doesn't have that
> > BPF_F_PRESERVE_ELEMS enum entry.
> > 
> > These are enums to make them available via BTF, but then I can't use
> > the:
> > 
> > #ifdef BPF_F_PRESERVE_ELEMS
> > #define BPF_F_PRESERVE_ELEMS (1U << 11)
> > #endif
> > 
> > approach.
> > 
> > But then we _have_ it in the tools/include/uapi/linux/bpf.h we ship:
> > 
> > $ grep BPF_F_PRESERVE_ELEMS tools/include/uapi/linux/bpf.h
> > 	BPF_F_PRESERVE_ELEMS	= (1U << 11),
> > $
> > 
> > so we need to switch to using it somehow, this way we can build in more
> > systems and make bperf and other BPF enabled features.
> > 
> > From a quick look I couldn't find where to add
> > $(sourcedir)/tools/include/uapi/ to the include path used to build
> > util/bpf_skel/bperf_leader.bpf.c, should be easy, can you take a look?
> > 
> > Thanks,
> > 
> > - Arnaldo
> 
> I think the following should fix it

I'm trying this now and tentatively sticking a Signed-off-by: you to it,
ok?

- 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 b8fa3cb2da230..4a6acfde14937 100644
> --- i/tools/perf/util/bpf_skel/bperf_follower.bpf.c
> +++ w/tools/perf/util/bpf_skel/bperf_follower.bpf.c
> @@ -1,7 +1,6 @@
>  // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>  // Copyright (c) 2021 Facebook
> -#include <linux/bpf.h>
> -#include <linux/perf_event.h>
> +#include "vmlinux.h"
>  #include <bpf/bpf_helpers.h>
>  #include <bpf/bpf_tracing.h>
>  #include "bperf.h"
> diff --git i/tools/perf/util/bpf_skel/bperf_leader.bpf.c w/tools/perf/util/bpf_skel/bperf_leader.bpf.c
> index 4f70d1459e86c..40d962b058634 100644
> --- i/tools/perf/util/bpf_skel/bperf_leader.bpf.c
> +++ w/tools/perf/util/bpf_skel/bperf_leader.bpf.c
> @@ -1,7 +1,6 @@
>  // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>  // Copyright (c) 2021 Facebook
> -#include <linux/bpf.h>
> -#include <linux/perf_event.h>
> +#include "vmlinux.h"
>  #include <bpf/bpf_helpers.h>
>  #include <bpf/bpf_tracing.h>
>  #include "bperf.h"
> diff --git i/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c w/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> index ab12b4c4ece21..97037d3b3d9fa 100644
> --- i/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> +++ w/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>  // Copyright (c) 2020 Facebook
> -#include <linux/bpf.h>
> +#include "vmlinux.h"
>  #include <bpf/bpf_helpers.h>
>  #include <bpf/bpf_tracing.h>
> 

-- 

- Arnaldo

  reply	other threads:[~2021-12-05 13:06 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
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 [this message]
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=Yay5Yjnj7LUodupy@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).