All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	bpf@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	dwarves@vger.kernel.org
Subject: Re: [PATCH] fix linux kernel BTF builds: increase max percpu variables by 10x
Date: Wed, 28 Feb 2024 10:20:14 +0100	[thread overview]
Message-ID: <Zd76zrhA4LAwA_WF@krava> (raw)
In-Reply-To: <20240228032142.396719-1-jhubbard@nvidia.com>

On Tue, Feb 27, 2024 at 07:21:42PM -0800, John Hubbard wrote:
> 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.

do you have an actual count of percpu variables for your config?
10x seems a lot to me

this might be a workaround, but we should make encoder->percpu.vars
dynamically allocated like we do for functions

jirka

> 
> Signed-off-by: John Hubbard <jhubbard@nvidia.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
> 
> 

  reply	other threads:[~2024-02-28  9:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28  3:21 [PATCH] fix linux kernel BTF builds: increase max percpu variables by 10x John Hubbard
2024-02-28  9:20 ` Jiri Olsa [this message]
2024-02-28 12:04   ` Alan Maguire
2024-02-28 23:21     ` John Hubbard
2024-02-29  9:17       ` Alan Maguire
2024-02-29 18:15         ` John Hubbard
2024-03-01 14:14           ` Jiri Olsa
2024-03-01 18:32             ` John Hubbard
2024-03-01 19:15               ` Suren Baghdasaryan

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=Zd76zrhA4LAwA_WF@krava \
    --to=olsajiri@gmail.com \
    --cc=acme@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.