commit: 0f40783765322f593867fe66021be5d411d17648 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> AuthorDate: Thu Nov 21 18:01:52 2024 +0000 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> CommitDate: Thu Nov 21 18:01:52 2024 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0f407837
kbuild,bpf: Pass make jobs' value to pahole Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> 0000_README | 4 ++ 2996_kbuild-bpf-jobs-val-pahole-fix.patch | 64 +++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/0000_README b/0000_README index 069847dc..3c22b167 100644 --- a/0000_README +++ b/0000_README @@ -139,6 +139,10 @@ Patch: 2995_dtrace-6.11_p1.patch From: https://github.com/thesamesam/linux/tree/dtrace-sam/v2/6.11-flat Desc: dtrace patch for 6.11.X (CTF, modules.builtin.objs) +Patch: 2996_kbuild-bpf-jobs-val-pahole-fix.patch +From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git +Desc: kbuild,bpf: Pass make jobs' value to pahole + Patch: 3000_Support-printing-firmware-info.patch From: https://bugs.gentoo.org/732852 Desc: Print firmware info (Reqs CONFIG_GENTOO_PRINT_FIRMWARE_INFO). Thanks to Georgy Yakovlev diff --git a/2996_kbuild-bpf-jobs-val-pahole-fix.patch b/2996_kbuild-bpf-jobs-val-pahole-fix.patch new file mode 100644 index 00000000..e69cde35 --- /dev/null +++ b/2996_kbuild-bpf-jobs-val-pahole-fix.patch @@ -0,0 +1,64 @@ +From 09048d22b7825a5025cf7e135f7e3134daff4df2 Mon Sep 17 00:00:00 2001 +From: Florian Schmaus <[email protected]> +Date: Sat, 2 Nov 2024 11:04:51 +0100 +Subject: kbuild,bpf: Pass make jobs' value to pahole +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Pass the value of make's -j/--jobs argument to pahole, to avoid out of +memory errors and make pahole respect the "jobs" value of make. + +On systems with little memory but many cores, invoking pahole using -j +without argument potentially creates too many pahole instances, +causing an out-of-memory situation. Instead, we should pass make's +"jobs" value as an argument to pahole's -j, which is likely configured +to be (much) lower than the actual core count on such systems. + +If make was invoked without -j, either via cmdline or MAKEFLAGS, then +JOBS will be simply empty, resulting in the existing behavior, as +expected. + +Signed-off-by: Florian Schmaus <[email protected]> +Signed-off-by: Andrii Nakryiko <[email protected]> +Tested-by: Holger Hoffstätte <[email protected]> +Link: https://lore.kernel.org/bpf/[email protected] +--- + scripts/Makefile.btf | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +(limited to 'scripts/Makefile.btf') + +diff --git a/scripts/Makefile.btf b/scripts/Makefile.btf +index b75f09f3f4248d..c3cbeb13de5035 100644 +--- a/scripts/Makefile.btf ++++ b/scripts/Makefile.btf +@@ -3,6 +3,8 @@ + pahole-ver := $(CONFIG_PAHOLE_VERSION) + pahole-flags-y := + ++JOBS := $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))) ++ + ifeq ($(call test-le, $(pahole-ver), 125),y) + + # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars +@@ -12,14 +14,14 @@ endif + + pahole-flags-$(call test-ge, $(pahole-ver), 121) += --btf_gen_floats + +-pahole-flags-$(call test-ge, $(pahole-ver), 122) += -j ++pahole-flags-$(call test-ge, $(pahole-ver), 122) += -j$(JOBS) + + pahole-flags-$(call test-ge, $(pahole-ver), 125) += --skip_encoding_btf_inconsistent_proto --btf_gen_optimized + + else + + # Switch to using --btf_features for v1.26 and later. +-pahole-flags-$(call test-ge, $(pahole-ver), 126) = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs ++pahole-flags-$(call test-ge, $(pahole-ver), 126) = -j$(JOBS) --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs + + ifneq ($(KBUILD_EXTMOD),) + module-pahole-flags-$(call test-ge, $(pahole-ver), 126) += --btf_features=distilled_base +-- +cgit 1.2.3-korg +
