Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: masahiroy@kernel.org, linux-kernel@vger.kernel.org,
	Jiri Slaby <jslaby@suse.cz>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	linux-kbuild@vger.kernel.org, bpf@vger.kernel.org,
	shung-hsi.yu@suse.com, msuchanek@suse.com
Subject: Re: [RFC] kbuild: bpf: Do not run pahole with -j on 32bit userspace
Date: Wed, 21 Aug 2024 07:32:21 +0200	[thread overview]
Message-ID: <523c1afa-ed9d-4c76-baea-1c43b1b0c682@kernel.org> (raw)
In-Reply-To: <ZsSpU5DqT3sRDzZy@krava>

On 20. 08. 24, 16:33, Jiri Olsa wrote:
> On Tue, Aug 20, 2024 at 10:59:50AM +0200, Jiri Slaby (SUSE) wrote:
>> From: Jiri Slaby <jslaby@suse.cz>
>>
>> == WARNING ==
>> This is only a PoC. There are deficiencies like CROSS_COMPILE or LLVM
>> are completely unhandled.
>>
>> The simple version is just do there:
>>    ifeq ($(CONFIG_64BIT,y)
>> but it has its own deficiencies, of course.
>>
>> So any ideas, inputs?
>> == WARNING ==
>>
>> When pahole is run with -j on 32bit userspace (32bit pahole in
>> particular), it randomly fails with OOM:
>>> btf_encoder__tag_kfuncs: Failed to get ELF section(62) data: out of memory.
>>> btf_encoder__encode: failed to tag kfuncs!
>>
>> or simply SIGSEGV (failed to allocate the btf encoder).
>>
>> It very depends on how many threads are created.
>>
>> So do not invoke pahole with -j on 32bit.
> 
> could you share more details about your setup?
> 
> does it need to run on pure 32bit to reproduce?

armv7l builds are 32bit only.

> I can't reproduce when
> doing cross build and running 32 bit pahole on x86_64..

i586 is built using 64bit kernel. It is enough to have 32bit userspace.
As written in the linked bug:
https://bugzilla.suse.com/show_bug.cgi?id=1229450#c6

FWIW, steps to reproduce locally:
docker pull jirislaby/pahole_crash
docker run -it jirislaby/pahole_crash

The VM space of pahole is exhausted:
process map: https://bugzilla.suse.com/attachment.cgi?id=876821
strace of mmaps: https://bugzilla.suse.com/attachment.cgi?id=876822

You need to run with large enough -j on a fast machine. Note that this 
happens on build hosts even with -j4, but they are under heavy load, so 
parallelism of held memory is high.

On my box with 16 cores, it is (likely far) enough to run with -j32.

> I do see some
> errors though
> 
>    [667939] STRUCT bpf_prog_aux Error emitting BTF type
>    Encountered error while encoding BTF.

It's possible that it is one of the errors. There are different ones. As 
I wrote above, sometimes it is a crash, sometimes it is the failure I 
mentioned above. But it always ends up with a failed build:
 > libbpf: failed to find '.BTF' ELF section in vmlinux
 > FAILED: load BTF from vmlinux: No data available
 > make[2]: *** [../scripts/Makefile.vmlinux:34: vmlinux] Error 255
 > make[2]: *** Deleting file 'vmlinux'
 > make[1]: *** 
[/home/abuild/rpmbuild/BUILD/kernel-vanilla-6.11~rc3.338.gc3f2d783a459/linux-6.11-rc3-338-gc3f2d783a459/Makefile:1158: 
vmlinux] Error 2
 > make: *** [../Makefile:224: __sub-make] Error 2
 > error: Bad exit status from /var/tmp/rpm-tmp.olf5Nu (%build)

thanks,
-- 
js
suse labs


  reply	other threads:[~2024-08-21  5:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  8:59 [RFC] kbuild: bpf: Do not run pahole with -j on 32bit userspace Jiri Slaby (SUSE)
2024-08-20  9:08 ` Jiri Slaby
2024-08-20 14:33 ` Jiri Olsa
2024-08-21  5:32   ` Jiri Slaby [this message]
2024-08-21  6:40     ` Jiri Slaby
2024-08-21  7:29       ` Jiri Slaby
2024-08-22  3:55         ` Shung-Hsi Yu
2024-08-22 15:24           ` Arnaldo Carvalho de Melo
2024-08-26  8:57             ` Jiri Slaby
2024-08-26 17:03               ` Arnaldo Carvalho de Melo
2024-08-26 18:42                 ` Sedat Dilek
2024-08-26 18:48                   ` Phil Auld
2024-08-26 20:04                     ` Arnaldo Carvalho de Melo
2024-08-26 22:07                       ` Andrii Nakryiko
2024-08-27  8:37                 ` Jiri Slaby
2024-09-04  6:06                   ` Jiri Slaby
2024-08-26 20:02               ` Arnaldo Carvalho de Melo
2024-08-26 10:18             ` Sedat Dilek
2024-09-25  8:17               ` Sedat Dilek

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=523c1afa-ed9d-4c76-baea-1c43b1b0c682@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=kpsingh@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=msuchanek@suse.com \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=olsajiri@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shung-hsi.yu@suse.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox