[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240228032142.396719-1-jhubbard@nvidia.com>
Date: Tue, 27 Feb 2024 19:21:42 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Arnaldo Carvalho de Melo <acme@...hat.com>
CC: Alexei Starovoitov <ast@...nel.org>, <bpf@...r.kernel.org>, LKML
<linux-kernel@...r.kernel.org>, <dwarves@...r.kernel.org>, John Hubbard
<jhubbard@...dia.com>
Subject: [PATCH] fix linux kernel BTF builds: increase max percpu variables by 10x
When building the Linux kernel with a distro .config, most or even all
possible kernel modules are built. This adds up to 4500+ modules, and
based on my testing, this causes the pahole utility to run out of space,
which shows up like this (CONFIG_DEBUG_INFO_BTF=y is required in order
to reproduce this):
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.o
Reached the limit of per-CPU variables: 4096
..repeated many times...
Reached the limit of per-CPU variables: 4096
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.S
LD vmlinux
BTFIDS vmlinux
libbpf: failed to find '.BTF' ELF section in vmlinux
FAILED: load BTF from vmlinux: No data available
make[2]: *** [scripts/Makefile.vmlinux:37: vmlinux] Error 255
make[2]: *** Deleting file 'vmlinux'
make[1]: *** [/kernel_work/linux-people/Makefile:1162: vmlinux] Error 2
make: *** [Makefile:240: __sub-make] Error 2
Increasing MAX_PERCPU_VAR_CNT by 10x avoids running out of space, and
allows the build to succeed.
Signed-off-by: John Hubbard <jhubbard@...dia.com>
---
btf_encoder.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/btf_encoder.c b/btf_encoder.c
index fd04008..d9f4e80 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -50,7 +50,7 @@ struct elf_function {
struct btf_encoder_state state;
};
-#define MAX_PERCPU_VAR_CNT 4096
+#define MAX_PERCPU_VAR_CNT 40960
struct var_info {
uint64_t addr;
--
2.44.0
Powered by blists - more mailing lists