From: Quentin Monnet <quentin@isovalent.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Pu Lehui <pulehui@huawei.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Jean-Philippe Brucker <jean-philippe@linaro.org>
Subject: Re: [PATCH bpf-next 3/3] bpf: iterators: build and use lightweight bootstrap version of bpftool
Date: Wed, 13 Jul 2022 20:03:50 +0100 [thread overview]
Message-ID: <40315ef2-e2e0-cb2b-becc-e1ba5a4826ff@isovalent.com> (raw)
In-Reply-To: <CAEf4Bza15HfVKDrA8dV+U5GJiDcPS0bnV81rmdxuFn0+_2hrXw@mail.gmail.com>
On 13/07/2022 19:55, Andrii Nakryiko wrote:
> On Mon, Jul 11, 2022 at 7:37 PM Pu Lehui <pulehui@huawei.com> wrote:
>>
>> kernel/bpf/preload/iterators use bpftool for vmlinux.h, skeleton, and
>> static linking only. So we can use lightweight bootstrap version of
>> bpftool to handle these, and it will be faster.
>>
>> Signed-off-by: Pu Lehui <pulehui@huawei.com>
>> Suggested-by: Andrii Nakryiko <andrii@kernel.org>
>> ---
>> kernel/bpf/preload/iterators/Makefile | 13 +++++++++----
>> 1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/kernel/bpf/preload/iterators/Makefile b/kernel/bpf/preload/iterators/Makefile
>> index bfe24f8c5a20..cf5f39f95fed 100644
>> --- a/kernel/bpf/preload/iterators/Makefile
>> +++ b/kernel/bpf/preload/iterators/Makefile
>> @@ -9,7 +9,7 @@ LLVM_STRIP ?= llvm-strip
>> TOOLS_PATH := $(abspath ../../../../tools)
>> BPFTOOL_SRC := $(TOOLS_PATH)/bpf/bpftool
>> BPFTOOL_OUTPUT := $(abs_out)/bpftool
>> -DEFAULT_BPFTOOL := $(OUTPUT)/sbin/bpftool
>> +DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool
>> BPFTOOL ?= $(DEFAULT_BPFTOOL)
>>
>> LIBBPF_SRC := $(TOOLS_PATH)/lib/bpf
>> @@ -61,9 +61,14 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
>> OUTPUT=$(abspath $(dir $@))/ prefix= \
>> DESTDIR=$(LIBBPF_DESTDIR) $(abspath $@) install_headers
>>
>> +ifeq ($(CROSS_COMPILE),)
>> $(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT)
>> $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOL_SRC) \
>> OUTPUT=$(BPFTOOL_OUTPUT)/ \
>> - LIBBPF_OUTPUT=$(LIBBPF_OUTPUT)/ \
>> - LIBBPF_DESTDIR=$(LIBBPF_DESTDIR)/ \
>> - prefix= DESTDIR=$(abs_out)/ install-bin
>> + LIBBPF_BOOTSTRAP_OUTPUT=$(LIBBPF_OUTPUT)/ \
>> + LIBBPF_BOOTSTRAP_DESTDIR=$(LIBBPF_DESTDIR)/ bootstrap
>> +else
>> +$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT)
>> + $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOL_SRC) \
>> + OUTPUT=$(BPFTOOL_OUTPUT)/ bootstrap
>> +endif
>
> another idea (related to my two previous comments for this patch set),
> maybe we can teach bpftool's Makefile to reuse LIBBPF_OUTPUT as
> LIBBPF_BOOTSTRAP_OUTPUT, if there is no CROSS_COMPILE? Then we can
> keep iterators/Makefile, samples/bpf/Makefile and runqslower/Makefile
> simpler and ignorant of CROSS_COMPILE, but still get the benefit of
> not rebuilding libbpf unnecessarily in non-cross-compile mode?
Could be a good idea. Seeing how the HID BPF patches add BTF/skeletons
generation at new locations, I'm also starting to wonder if it would be
worth having a Makefile.bpftool.include of some sort to harmonise the
way we compile the bootstrap bpftool as a dependency, and make it easier
to maintain. I haven't looked at how feasible that would be, yet.
prev parent reply other threads:[~2022-07-13 19:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 3:08 [PATCH bpf-next 0/3] Use lightweigt version of bpftool Pu Lehui
2022-07-12 3:08 ` [PATCH bpf-next 1/3] samples: bpf: Fix cross-compiling error by using bootstrap bpftool Pu Lehui
2022-07-12 10:11 ` Quentin Monnet
2022-07-12 11:32 ` Pu Lehui
2022-07-13 18:50 ` Andrii Nakryiko
2022-07-12 3:08 ` [PATCH bpf-next 2/3] tools: runqslower: build and use lightweight bootstrap version of bpftool Pu Lehui
2022-07-13 18:52 ` Andrii Nakryiko
2022-07-14 2:02 ` Pu Lehui
2022-07-12 3:08 ` [PATCH bpf-next 3/3] bpf: iterators: " Pu Lehui
2022-07-13 18:55 ` Andrii Nakryiko
2022-07-13 19:03 ` Quentin Monnet [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=40315ef2-e2e0-cb2b-becc-e1ba5a4826ff@isovalent.com \
--to=quentin@isovalent.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jean-philippe@linaro.org \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pulehui@huawei.com \
--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.