llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.92k stars 11.53k forks source link

Crash while optimizing Linux Kernel with BOLT #102359

Open Cerberios opened 1 month ago

Cerberios commented 1 month ago
Hello there! I am not a programmer, but want to use kernel optimized with BOLT
I got some bug, please look over, may be it will help to prettify LLVM project
---
PERF2BOLT: Starting data aggregation job for /usr/src/linux/perf.data
PERF2BOLT: spawning perf job to read branch events
PERF2BOLT: spawning perf job to read mem events
PERF2BOLT: spawning perf job to read process events
PERF2BOLT: spawning perf job to read task events
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: <unknown>
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0xffffffff83800000, offset 0xffffffff83800000
BOLT-INFO: static input executable detected
BOLT-INFO: disabling -align-macro-fusion in non-relocation mode
BOLT-INFO: enabling lite mode
BOLT-ERROR: symbol seen in the middle of the function srso_untrain_ret/1(*2). Skipping.
BOLT-ERROR: symbol seen in the middle of the function retbleed_untrain_ret/1(*2). Skipping.
BOLT-INFO: pre-processing profile using perf data aggregator
BOLT-WARNING: build-id will not be checked because we could not read one from input binary
PERF2BOLT: waiting for perf task events collection to finish...
PERF2BOLT: parsing perf-script task events output
PERF2BOLT: input binary is associated with 0 PID(s)
PERF2BOLT: waiting for perf events collection to finish...
PERF2BOLT: parse branch events...
PERF2BOLT: read 15715699 samples and 501543825 LBR entries
PERF2BOLT: 0 samples (0.0%) were ignored
PERF2BOLT: traces mismatching disassembled function contents: 0 (0.0%)
PERF2BOLT: out of range traces involving unknown regions: 485862005 (100.0%)
PERF2BOLT: waiting for perf mem events collection to finish...
perf2bolt: /usr/local/sources/llvm-project/bolt/lib/Rewrite/LinuxKernelRewriter.cpp:367: void {anonymous}::LinuxKernelRewriter::processLKBugTable(): Assertion `BC.getBinaryFunctionContainingAddress(RefAddress) && "__bug_table entries should point to a function"' failed.
 #0 0x00005ae7b33d03e2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/llvm-bolt+0xdc93e2)
 #1 0x00005ae7b33cd64f llvm::sys::RunSignalHandlers() (/usr/local/bin/llvm-bolt+0xdc664f)
 #2 0x00005ae7b33cd795 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007da2f6c50420 (/usr/lib64/libc.so.6+0x45420)
 #4 0x00007da2f6caac0b pthread_kill (/usr/lib64/libc.so.6+0x9fc0b)
 #5 0x00007da2f6c50376 raise (/usr/lib64/libc.so.6+0x45376)
 #6 0x00007da2f6c338b7 abort (/usr/lib64/libc.so.6+0x288b7)
 #7 0x00007da2f6c337db (/usr/lib64/libc.so.6+0x287db)
 #8 0x00007da2f6c46616 (/usr/lib64/libc.so.6+0x3b616)
 #9 0x00005ae7b34ca289 (anonymous namespace)::LinuxKernelRewriter::preCFGInitializer() LinuxKernelRewriter.cpp:0:0
#10 0x00005ae7b34cb8fd llvm::bolt::MetadataManager::runInitializersPreCFG() (/usr/local/bin/llvm-bolt+0xec48fd)
#11 0x00005ae7b34976f4 llvm::bolt::RewriteInstance::run() (/usr/local/bin/llvm-bolt+0xe906f4)
#12 0x00005ae7b292a553 main (/usr/local/bin/llvm-bolt+0x323553)
#13 0x00007da2f6c35400 (/usr/lib64/libc.so.6+0x2a400)
#14 0x00007da2f6c354b9 __libc_start_main (/usr/lib64/libc.so.6+0x2a4b9)
#15 0x00005ae7b29c9ee5 _start (/usr/local/bin/llvm-bolt+0x3c2ee5)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: perf2bolt -p /usr/src/linux/perf.data -o ./perf.fdata /usr/src/linux/vmlinux
Aborted
---
Linux thinkbox 6.10.3-gentoo-simple-gcc #1 SMP PREEMPT_DYNAMIC Sun Aug  4 09:00:09 EEST 2024 x86_64 13th Gen Intel(R) Core(TM) i5-1335U GenuineIntel GNU/Linux
---
ldd (Gentoo 2.39-r9 (patchset 9)) 2.39
sys-libs/glibc:            2.39-r9::gentoo
sh bash 5.2_p32
ld GNU ld (Gentoo 2.43 p1) 2.43.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p32::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo, 1.17-r1::gentoo
dev-build/cmake:           3.30.2::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.5.1::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.11.9_p1::gentoo, 3.12.5::gentoo
dev-lang/rust:             1.79.0::gentoo
dev-util/ccache:           4.10.1::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54.2::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.42-r2::gentoo, 2.43::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           18.1.8::gentoo
sys-devel/gcc:             13.3.1_p20240802::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             18.1.8::gentoo
sys-devel/llvm:            18.1.8-r2::leorepo
sys-kernel/linux-headers:  6.9::gentoo (virtual/os-headers)
---
I follow the manual at:
https://github.com/llvm/llvm-project/blob/main/bolt/docs/OptimizingLinux.md
---
Thank You!
maksfb commented 1 month ago

Hi, are you using BOLT that came with your distro? Could you try the latest/trunk version?