diff mbox series

[bpf-next,2/3] tools: runqslower: build and use lightweight bootstrap version of bpftool

Message ID 20220712030813.865410-3-pulehui@huawei.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series Use lightweigt version of bpftool | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 5 maintainers not CCed: haoluo@google.com song@kernel.org martin.lau@linux.dev jolsa@kernel.org sdf@google.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Kernel LATEST on ubuntu-latest with llvm-15
bpf/vmtest-bpf-next-VM_Test-1 success Logs for Kernel LATEST on ubuntu-latest with gcc
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Kernel LATEST on z15 with gcc

Commit Message

Pu Lehui July 12, 2022, 3:08 a.m. UTC
tools/runqslower 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>
---
 tools/bpf/runqslower/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Andrii Nakryiko July 13, 2022, 6:52 p.m. UTC | #1
On Mon, Jul 11, 2022 at 7:37 PM Pu Lehui <pulehui@huawei.com> wrote:
>
> tools/runqslower 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>
> ---
>  tools/bpf/runqslower/Makefile | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
> index da6de16a3dfb..8900c74f29e2 100644
> --- a/tools/bpf/runqslower/Makefile
> +++ b/tools/bpf/runqslower/Makefile
> @@ -4,7 +4,7 @@ include ../../scripts/Makefile.include
>  OUTPUT ?= $(abspath .output)/
>
>  BPFTOOL_OUTPUT := $(OUTPUT)bpftool/
> -DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)bpftool
> +DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)bootstrap/bpftool
>  BPFTOOL ?= $(DEFAULT_BPFTOOL)
>  LIBBPF_SRC := $(abspath ../../lib/bpf)
>  BPFOBJ_OUTPUT := $(OUTPUT)libbpf/
> @@ -86,6 +86,12 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(BPFOBJ_OU
>         $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(BPFOBJ_OUTPUT) \
>                     DESTDIR=$(BPFOBJ_OUTPUT) prefix= $(abspath $@) install_headers
>
> +ifeq ($(CROSS_COMPILE),)
>  $(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT)
>         $(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=$(BPFTOOL_OUTPUT)   \
> -                   ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD)
> +                   LIBBPF_BOOTSTRAP_OUTPUT=$(BPFOBJ_OUTPUT)                   \
> +                   LIBBPF_BOOTSTRAP_DESTDIR=$(BPF_DESTDIR) bootstrap
> +else
> +$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT)
> +       $(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=$(BPFTOOL_OUTPUT) bootstrap
> +endif

Same comment as on the other patch, this CROSS_COMPILE if/else seems a
bit fragile, let's keep only the second cleaner part, maybe?


> --
> 2.25.1
>
Pu Lehui July 14, 2022, 2:02 a.m. UTC | #2
On 2022/7/14 2:52, Andrii Nakryiko wrote:
> On Mon, Jul 11, 2022 at 7:37 PM Pu Lehui <pulehui@huawei.com> wrote:
>>
>> tools/runqslower 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>
>> ---
>>   tools/bpf/runqslower/Makefile | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
>> index da6de16a3dfb..8900c74f29e2 100644
>> --- a/tools/bpf/runqslower/Makefile
>> +++ b/tools/bpf/runqslower/Makefile
>> @@ -4,7 +4,7 @@ include ../../scripts/Makefile.include
>>   OUTPUT ?= $(abspath .output)/
>>
>>   BPFTOOL_OUTPUT := $(OUTPUT)bpftool/
>> -DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)bpftool
>> +DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)bootstrap/bpftool
>>   BPFTOOL ?= $(DEFAULT_BPFTOOL)
>>   LIBBPF_SRC := $(abspath ../../lib/bpf)
>>   BPFOBJ_OUTPUT := $(OUTPUT)libbpf/
>> @@ -86,6 +86,12 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(BPFOBJ_OU
>>          $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(BPFOBJ_OUTPUT) \
>>                      DESTDIR=$(BPFOBJ_OUTPUT) prefix= $(abspath $@) install_headers
>>
>> +ifeq ($(CROSS_COMPILE),)
>>   $(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT)
>>          $(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=$(BPFTOOL_OUTPUT)   \
>> -                   ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD)
>> +                   LIBBPF_BOOTSTRAP_OUTPUT=$(BPFOBJ_OUTPUT)                   \
>> +                   LIBBPF_BOOTSTRAP_DESTDIR=$(BPF_DESTDIR) bootstrap
>> +else
>> +$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT)
>> +       $(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=$(BPFTOOL_OUTPUT) bootstrap
>> +endif
> 
> Same comment as on the other patch, this CROSS_COMPILE if/else seems a
> bit fragile, let's keep only the second cleaner part, maybe?
> 

I will make it simple.

> 
>> --
>> 2.25.1
>>
> .
>
diff mbox series

Patch

diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
index da6de16a3dfb..8900c74f29e2 100644
--- a/tools/bpf/runqslower/Makefile
+++ b/tools/bpf/runqslower/Makefile
@@ -4,7 +4,7 @@  include ../../scripts/Makefile.include
 OUTPUT ?= $(abspath .output)/
 
 BPFTOOL_OUTPUT := $(OUTPUT)bpftool/
-DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)bpftool
+DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)bootstrap/bpftool
 BPFTOOL ?= $(DEFAULT_BPFTOOL)
 LIBBPF_SRC := $(abspath ../../lib/bpf)
 BPFOBJ_OUTPUT := $(OUTPUT)libbpf/
@@ -86,6 +86,12 @@  $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(BPFOBJ_OU
 	$(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(BPFOBJ_OUTPUT) \
 		    DESTDIR=$(BPFOBJ_OUTPUT) prefix= $(abspath $@) install_headers
 
+ifeq ($(CROSS_COMPILE),)
 $(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT)
 	$(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=$(BPFTOOL_OUTPUT)   \
-		    ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD)
+		    LIBBPF_BOOTSTRAP_OUTPUT=$(BPFOBJ_OUTPUT)		       \
+		    LIBBPF_BOOTSTRAP_DESTDIR=$(BPF_DESTDIR) bootstrap
+else
+$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT)
+	$(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=$(BPFTOOL_OUTPUT) bootstrap
+endif