From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.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 <kuba@kernel.org>,
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 v5 00/11] tools: Use consistent libbpf include paths everywhere
Date: Tue, 21 Jan 2020 14:33:46 +0100 [thread overview]
Message-ID: <874kwpndc5.fsf@toke.dk> (raw)
In-Reply-To: <CAEf4BzYNp81_bOFSEZR=AcruC2ms76fCWQGit+=2QZrFAXpGqg@mail.gmail.com>
Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:
> On Mon, Jan 20, 2020 at 5:08 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>
>> We are currently being somewhat inconsistent with the libbpf include paths,
>> which makes it difficult to move files from the kernel into an external
>> libbpf-using project without adjusting include paths.
>>
>> Having the bpf/ subdir of $INCLUDEDIR in the include path has never been a
>> requirement for building against libbpf before, and indeed the libbpf pkg-config
>> file doesn't include it. So let's make all libbpf includes across the kernel
>> tree use the bpf/ prefix in their includes. Since bpftool skeleton generation
>> emits code with a libbpf include, this also ensures that those can be used in
>> existing external projects using the regular pkg-config include path.
>>
>> This turns out to be a somewhat invasive change in the number of files touched;
>> however, the actual changes to files are fairly trivial (most of them are simply
>> made with 'sed'). The series is split to make the change for one tool subdir at
>> a time, while trying not to break the build along the way. It is structured like
>> this:
>>
>> - Patch 1-3: Trivial fixes to Makefiles for issues I discovered while changing
>> the include paths.
>>
>> - Patch 4-8: Change the include directives to use the bpf/ prefix, and updates
>> Makefiles to make sure tools/lib/ is part of the include path, but without
>> removing tools/lib/bpf
>>
>> - Patch 9-11: Remove tools/lib/bpf from include paths to make sure we don't
>> inadvertently re-introduce includes without the bpf/ prefix.
>>
>> Changelog:
>>
>> v5:
>> - Combine the libbpf build rules in selftests Makefile (using Andrii's
>> suggestion for a make rule).
>> - Re-use self-tests libbpf build for runqslower (new patch 10)
>> - Formatting fixes
>>
>> v4:
>> - Move runqslower error on missing BTF into make rule
>> - Make sure we don't always force a rebuild selftests
>> - Rebase on latest bpf-next (dropping patch 11)
>>
>> v3:
>> - Don't add the kernel build dir to the runqslower Makefile, pass it in from
>> selftests instead.
>> - Use libbpf's 'make install_headers' in selftests instead of trying to
>> generate bpf_helper_defs.h in-place (to also work on read-only filesystems).
>> - Use a scratch builddir for both libbpf and bpftool when building in selftests.
>> - Revert bpf_helpers.h to quoted include instead of angled include with a bpf/
>> prefix.
>> - Fix a few style nits from Andrii
>>
>> v2:
>> - Do a full cleanup of libbpf includes instead of just changing the
>> bpf_helper_defs.h include.
>>
>> ---
>>
>
> Looks good, it's a clear improvement on what we had before, thanks!
>
> It doesn't re-build bpftool when bpftool sources changes, but I think
> it was like that even before, so no need to block on that. Would be
> nice to have a follow up fixing that, though. $(wildcard
> $(BPFTOOL_DIR)/*.[ch] $(BPFTOOL_DIR)/Makefile) should do it, same as
> for libbpf.
Yeah, I did realise there was some potential for improvement for bpftool
as well, but I got enough of Makefiles for now :)
I'll see if I can't circle back to this at some point...
> So, for the series:
>
> Acked-by: Andrii Nakryiko <andriin@fb.com>
> Tested-by: Andrii Nakryiko <andriin@fb.com>
Thanks!
-Toke
prev parent reply other threads:[~2020-01-21 13:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 13:06 [PATCH bpf-next v5 00/11] tools: Use consistent libbpf include paths everywhere Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 01/11] samples/bpf: Don't try to remove user's homedir on clean Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 02/11] tools/bpf/runqslower: Fix override option for VMLINUX_BTF Toke Høiland-Jørgensen
2020-01-20 20:56 ` Andrii Nakryiko
2020-01-20 13:06 ` [PATCH bpf-next v5 03/11] selftests: Pass VMLINUX_BTF to runqslower Makefile Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 04/11] tools/runqslower: Use consistent include paths for libbpf Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 05/11] selftests: " Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 06/11] bpftool: " Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 07/11] perf: " Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 08/11] samples/bpf: " Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 09/11] tools/runqslower: Remove tools/lib/bpf from include path Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 10/11] runsqslower: Support user-specified libbpf include and object paths Toke Høiland-Jørgensen
2020-01-20 13:06 ` [PATCH bpf-next v5 11/11] selftests: Refactor build to remove tools/lib/bpf from include path Toke Høiland-Jørgensen
2020-01-20 22:20 ` [PATCH bpf-next v5 00/11] tools: Use consistent libbpf include paths everywhere Andrii Nakryiko
2020-01-21 0:43 ` Alexei Starovoitov
2020-01-21 13:33 ` Toke Høiland-Jørgensen [this message]
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=874kwpndc5.fsf@toke.dk \
--to=toke@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii.nakryiko@gmail.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=jgg@ziepe.ca \
--cc=john.fastabend@gmail.com \
--cc=jolsa@redhat.com \
--cc=kafai@fb.com \
--cc=kuba@kernel.org \
--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=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.