All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andriin@fb.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Shuah Khan <shuah@kernel.org>,
	Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	linux-rdma@vger.kernel.org,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	clang-built-linux@googlegroups.com
Subject: Re: [PATCH bpf-next v2 09/10] selftests: Remove tools/lib/bpf from include path
Date: Wed, 15 Jan 2020 09:22:01 -0800	[thread overview]
Message-ID: <CAEf4BzZ2jAQPKzzp+NhWXbUFcfdcXs+akFSY4O0JhabJy=9vag@mail.gmail.com> (raw)
In-Reply-To: <157909757860.1192265.1725940708658939712.stgit@toke.dk>

On Wed, Jan 15, 2020 at 6:16 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> From: Toke Høiland-Jørgensen <toke@redhat.com>
>
> To make sure no new files are introduced that doesn't include the bpf/
> prefix in its #include, remove tools/lib/bpf from the include path
> entirely, and use tools/lib instead. To fix the original issue with
> bpf_helper_defs.h being stale, change the Makefile rule to regenerate the
> file in the lib/bpf dir instead of having a local copy in selftests.
>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  tools/testing/selftests/bpf/.gitignore |    3 ++-
>  tools/testing/selftests/bpf/Makefile   |   16 ++++++++--------
>  2 files changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
> index 1d14e3ab70be..17dd02651dee 100644
> --- a/tools/testing/selftests/bpf/.gitignore
> +++ b/tools/testing/selftests/bpf/.gitignore
> @@ -33,10 +33,11 @@ libbpf.pc
>  libbpf.so.*
>  test_hashmap
>  test_btf_dump
> +test_cgroup_attach
> +test_select_reuseport

These were moved into test_progs, they are not independent binaries
anymore, you probably just had old leftovers lying in your
selftests/bpf directory. Let's not re-add them.

>  xdping
>  test_cpp
>  *.skel.h
>  /no_alu32
>  /bpf_gcc
>  /tools
> -bpf_helper_defs.h
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index cd98ae875e30..4889cc3ead4b 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -21,7 +21,7 @@ LLC           ?= llc
>  LLVM_OBJCOPY   ?= llvm-objcopy
>  BPF_GCC                ?= $(shell command -v bpf-gcc;)
>  CFLAGS += -g -Wall -O2 $(GENFLAGS) -I$(CURDIR) -I$(APIDIR) -I$(LIBDIR)  \
> -         -I$(BPFDIR) -I$(GENDIR) -I$(TOOLSINCDIR)                      \
> +         -I$(GENDIR) -I$(TOOLSINCDIR)                  \
>           -Dbpf_prog_load=bpf_prog_test_load                            \
>           -Dbpf_load_program=bpf_test_load_program
>  LDLIBS += -lcap -lelf -lz -lrt -lpthread
> @@ -129,7 +129,7 @@ $(OUTPUT)/runqslower: force
>         $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower           \
>                     OUTPUT=$(CURDIR)/tools/
>
> -BPFOBJ := $(OUTPUT)/libbpf.a
> +BPFOBJ := $(BPFDIR)/libbpf.a

We can't do that. See fa633a0f8919 ("libbpf: Fix build on read-only
filesystems") for why and why we have this problem with
bpf_helper_defs.h in the first place.

>
>  $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
>
> @@ -155,17 +155,17 @@ force:
>  DEFAULT_BPFTOOL := $(OUTPUT)/tools/sbin/bpftool
>  BPFTOOL ?= $(DEFAULT_BPFTOOL)
>
> -$(DEFAULT_BPFTOOL): force
> +$(DEFAULT_BPFTOOL): force $(BPFOBJ)

do we need this? bpftool's makefile will build its own libbpf.a
independently. We can probably optimize that, but see above, we need
to ensure that we build only within selftest/bpf dirs.

This "read-only outside of selftests/bpf" requirement actually made me
realize that we probably need to specify OUTPUT pointing somewhere
inside selftests/bpf/tools subdir to build entire bpftool within
selftests/bpf directory and not touch anything outside. Do you mind
fixing that while you are at it?

>         $(Q)$(MAKE) $(submake_extras)  -C $(BPFTOOLDIR)                       \
>                     prefix= DESTDIR=$(OUTPUT)/tools/ install
>
>  $(BPFOBJ): force
> -       $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(OUTPUT)/
> +       $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BPFDIR)/ $(BPFOBJ)
>
> -BPF_HELPERS := $(OUTPUT)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.h)
> -$(OUTPUT)/bpf_helper_defs.h: $(BPFOBJ)
> +BPF_HELPERS := $(BPFDIR)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.h)
> +$(BPFDIR)/bpf_helper_defs.h: $(BPFOBJ)
>         $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR)                            \
> -                   OUTPUT=$(OUTPUT)/ $(OUTPUT)/bpf_helper_defs.h
> +               OUTPUT=$(BPFDIR)/ $(BPFDIR)/bpf_helper_defs.h
>
>  # Get Clang's default includes on this system, as opposed to those seen by
>  # '-target bpf'. This fixes "missing" files on some architectures/distros,
> @@ -186,7 +186,7 @@ MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
>  CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
>  BPF_CFLAGS = -g -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN)                  \
>              -I$(OUTPUT) -I$(CURDIR) -I$(CURDIR)/include/uapi           \
> -            -I$(APIDIR) -I$(LIBDIR) -I$(BPFDIR) -I$(abspath $(OUTPUT)/../usr/include)
> +            -I$(APIDIR) -I$(LIBDIR) -I$(abspath $(OUTPUT)/../usr/include)
>
>  CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) \
>                -Wno-compare-distinct-pointer-types
>

  reply	other threads:[~2020-01-15 17:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 14:12 [PATCH bpf-next v2 00/10] tools: Use consistent libbpf include paths everywhere Toke Høiland-Jørgensen
2020-01-15 14:12 ` [PATCH bpf-next v2 01/10] samples/bpf: Don't try to remove user's homedir on clean Toke Høiland-Jørgensen
2020-01-15 15:21   ` Jesper Dangaard Brouer
2020-01-15 14:12 ` [PATCH bpf-next v2 02/10] tools/bpf/runqslower: Fix override option for VMLINUX_BTF Toke Høiland-Jørgensen
2020-01-15 16:59   ` Andrii Nakryiko
2020-01-15 22:06     ` Toke Høiland-Jørgensen
2020-01-15 22:31       ` Andrii Nakryiko
2020-01-16  9:05         ` Toke Høiland-Jørgensen
2020-01-16 17:14           ` Andrii Nakryiko
2020-01-15 14:12 ` [PATCH bpf-next v2 03/10] tools/runqslower: Use consistent include paths for libbpf Toke Høiland-Jørgensen
2020-01-15 14:12 ` [PATCH bpf-next v2 04/10] selftests: " Toke Høiland-Jørgensen
2020-01-15 14:12 ` [PATCH bpf-next v2 05/10] bpftool: " Toke Høiland-Jørgensen
2020-01-15 17:44   ` Andrii Nakryiko
2020-01-15 14:12 ` [PATCH bpf-next v2 06/10] perf: " Toke Høiland-Jørgensen
2020-01-15 14:12 ` [PATCH bpf-next v2 07/10] samples/bpf: " Toke Høiland-Jørgensen
2020-01-15 15:18   ` Jesper Dangaard Brouer
2020-01-15 15:41     ` Toke Høiland-Jørgensen
2020-01-15 14:12 ` [PATCH bpf-next v2 08/10] libbpf: Fix include of bpf_helpers.h when libbpf is installed on system Toke Høiland-Jørgensen
2020-01-15 14:12 ` [PATCH bpf-next v2 09/10] selftests: Remove tools/lib/bpf from include path Toke Høiland-Jørgensen
2020-01-15 17:22   ` Andrii Nakryiko [this message]
2020-01-15 14:12 ` [PATCH bpf-next v2 10/10] tools/runqslower: " Toke Høiland-Jørgensen
2020-01-15 18:06 ` [PATCH bpf-next v2 00/10] tools: Use consistent libbpf include paths everywhere Andrii Nakryiko
2020-01-15 22:10   ` Toke Høiland-Jørgensen
2020-01-15 21:19 ` Alexei Starovoitov
2020-01-15 22:09   ` Toke Høiland-Jørgensen

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='CAEf4BzZ2jAQPKzzp+NhWXbUFcfdcXs+akFSY4O0JhabJy=9vag@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dledford@redhat.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jgg@ziepe.ca \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=shuah@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=toke@redhat.com \
    --cc=yhs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.