From nobody Sat Apr 18 12:42:30 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 529FBC433EF for ; Thu, 14 Jul 2022 02:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231268AbiGNCPx (ORCPT ); Wed, 13 Jul 2022 22:15:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiGNCPv (ORCPT ); Wed, 13 Jul 2022 22:15:51 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A01481DA6A; Wed, 13 Jul 2022 19:15:49 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Ljyh81jWPz1L8wT; Thu, 14 Jul 2022 10:13:12 +0800 (CST) Received: from dggpemm500019.china.huawei.com (7.185.36.180) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 10:15:47 +0800 Received: from k04.huawei.com (10.67.174.115) by dggpemm500019.china.huawei.com (7.185.36.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 10:15:47 +0800 From: Pu Lehui To: , , CC: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Quentin Monnet , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "Jean-Philippe Brucker" , Pu Lehui Subject: [PATCH bpf-next v2 1/3] samples: bpf: Fix cross-compiling error by using bootstrap bpftool Date: Thu, 14 Jul 2022 10:46:10 +0800 Message-ID: <20220714024612.944071-2-pulehui@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220714024612.944071-1-pulehui@huawei.com> References: <20220714024612.944071-1-pulehui@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.115] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500019.china.huawei.com (7.185.36.180) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently, when cross compiling bpf samples, the host side cannot use arch-specific bpftool to generate vmlinux.h or skeleton. Since samples/bpf use bpftool for vmlinux.h, skeleton, and static linking only, we can use lightweight bootstrap version of bpftool to handle these, and it's always host-native. Signed-off-by: Pu Lehui Suggested-by: Andrii Nakryiko Acked-by: Quentin Monnet --- samples/bpf/Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 5002a5b9a7da..727da3c5879b 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -282,12 +282,10 @@ $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_S= RC)/Makefile) | $(LIBBPF_OU =20 BPFTOOLDIR :=3D $(TOOLS_PATH)/bpf/bpftool BPFTOOL_OUTPUT :=3D $(abspath $(BPF_SAMPLES_PATH))/bpftool -BPFTOOL :=3D $(BPFTOOL_OUTPUT)/bpftool -$(BPFTOOL): $(LIBBPF) $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefi= le) | $(BPFTOOL_OUTPUT) - $(MAKE) -C $(BPFTOOLDIR) srctree=3D$(BPF_SAMPLES_PATH)/../../ \ - OUTPUT=3D$(BPFTOOL_OUTPUT)/ \ - LIBBPF_OUTPUT=3D$(LIBBPF_OUTPUT)/ \ - LIBBPF_DESTDIR=3D$(LIBBPF_DESTDIR)/ +BPFTOOL :=3D $(BPFTOOL_OUTPUT)/bootstrap/bpftool +$(BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BP= FTOOL_OUTPUT) + $(MAKE) -C $(BPFTOOLDIR) srctree=3D$(BPF_SAMPLES_PATH)/../../ \ + OUTPUT=3D$(BPFTOOL_OUTPUT)/ bootstrap =20 $(LIBBPF_OUTPUT) $(BPFTOOL_OUTPUT): $(call msg,MKDIR,$@) --=20 2.25.1 From nobody Sat Apr 18 12:42:30 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9290CC433EF for ; Thu, 14 Jul 2022 02:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232591AbiGNCQR (ORCPT ); Wed, 13 Jul 2022 22:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231311AbiGNCQI (ORCPT ); Wed, 13 Jul 2022 22:16:08 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71F1F1E3F5; Wed, 13 Jul 2022 19:16:06 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LjykN2DFgzFq1x; Thu, 14 Jul 2022 10:15:08 +0800 (CST) Received: from dggpemm500019.china.huawei.com (7.185.36.180) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 10:15:47 +0800 Received: from k04.huawei.com (10.67.174.115) by dggpemm500019.china.huawei.com (7.185.36.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 10:15:47 +0800 From: Pu Lehui To: , , CC: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Quentin Monnet , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "Jean-Philippe Brucker" , Pu Lehui Subject: [PATCH bpf-next v2 2/3] tools: runqslower: build and use lightweight bootstrap version of bpftool Date: Thu, 14 Jul 2022 10:46:11 +0800 Message-ID: <20220714024612.944071-3-pulehui@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220714024612.944071-1-pulehui@huawei.com> References: <20220714024612.944071-1-pulehui@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.115] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500019.china.huawei.com (7.185.36.180) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Suggested-by: Andrii Nakryiko Acked-by: Quentin Monnet --- tools/bpf/runqslower/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile index da6de16a3dfb..8b3d87b82b7a 100644 --- a/tools/bpf/runqslower/Makefile +++ b/tools/bpf/runqslower/Makefile @@ -4,7 +4,7 @@ include ../../scripts/Makefile.include OUTPUT ?=3D $(abspath .output)/ =20 BPFTOOL_OUTPUT :=3D $(OUTPUT)bpftool/ -DEFAULT_BPFTOOL :=3D $(BPFTOOL_OUTPUT)bpftool +DEFAULT_BPFTOOL :=3D $(BPFTOOL_OUTPUT)bootstrap/bpftool BPFTOOL ?=3D $(DEFAULT_BPFTOOL) LIBBPF_SRC :=3D $(abspath ../../lib/bpf) BPFOBJ_OUTPUT :=3D $(OUTPUT)libbpf/ @@ -86,6 +86,5 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/= Makefile) | $(BPFOBJ_OU $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=3D$(BPFOBJ_OUTPUT) \ DESTDIR=3D$(BPFOBJ_OUTPUT) prefix=3D $(abspath $@) install_headers =20 -$(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT) - $(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=3D$(BPFTOOL_OUTPUT) \ - ARCH=3D CROSS_COMPILE=3D CC=3D$(HOSTCC) LD=3D$(HOSTLD) +$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT) + $(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=3D$(BPFTOOL_OUTPUT) bo= otstrap --=20 2.25.1 From nobody Sat Apr 18 12:42:30 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F987C43334 for ; Thu, 14 Jul 2022 02:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231769AbiGNCQK (ORCPT ); Wed, 13 Jul 2022 22:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbiGNCQH (ORCPT ); Wed, 13 Jul 2022 22:16:07 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F9201E3C4; Wed, 13 Jul 2022 19:16:07 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LjyhT6DHMz1L8wP; Thu, 14 Jul 2022 10:13:29 +0800 (CST) Received: from dggpemm500019.china.huawei.com (7.185.36.180) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 10:15:47 +0800 Received: from k04.huawei.com (10.67.174.115) by dggpemm500019.china.huawei.com (7.185.36.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 10:15:47 +0800 From: Pu Lehui To: , , CC: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Quentin Monnet , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "Jean-Philippe Brucker" , Pu Lehui Subject: [PATCH bpf-next v2 3/3] bpf: iterators: build and use lightweight bootstrap version of bpftool Date: Thu, 14 Jul 2022 10:46:12 +0800 Message-ID: <20220714024612.944071-4-pulehui@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220714024612.944071-1-pulehui@huawei.com> References: <20220714024612.944071-1-pulehui@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.115] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500019.china.huawei.com (7.185.36.180) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Suggested-by: Andrii Nakryiko Acked-by: Quentin Monnet --- kernel/bpf/preload/iterators/Makefile | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel/bpf/preload/iterators/Makefile b/kernel/bpf/preload/ite= rators/Makefile index bfe24f8c5a20..6762b1260f2f 100644 --- a/kernel/bpf/preload/iterators/Makefile +++ b/kernel/bpf/preload/iterators/Makefile @@ -9,7 +9,7 @@ LLVM_STRIP ?=3D llvm-strip TOOLS_PATH :=3D $(abspath ../../../../tools) BPFTOOL_SRC :=3D $(TOOLS_PATH)/bpf/bpftool BPFTOOL_OUTPUT :=3D $(abs_out)/bpftool -DEFAULT_BPFTOOL :=3D $(OUTPUT)/sbin/bpftool +DEFAULT_BPFTOOL :=3D $(BPFTOOL_OUTPUT)/bootstrap/bpftool BPFTOOL ?=3D $(DEFAULT_BPFTOOL) =20 LIBBPF_SRC :=3D $(TOOLS_PATH)/lib/bpf @@ -61,9 +61,5 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/= Makefile) | $(LIBBPF_OU OUTPUT=3D$(abspath $(dir $@))/ prefix=3D \ DESTDIR=3D$(LIBBPF_DESTDIR) $(abspath $@) install_headers =20 -$(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT) - $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOL_SRC) \ - OUTPUT=3D$(BPFTOOL_OUTPUT)/ \ - LIBBPF_OUTPUT=3D$(LIBBPF_OUTPUT)/ \ - LIBBPF_DESTDIR=3D$(LIBBPF_DESTDIR)/ \ - prefix=3D DESTDIR=3D$(abs_out)/ install-bin +$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT) + $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOL_SRC) OUTPUT=3D$(BPFTOOL_OUTPUT= )/ bootstrap --=20 2.25.1