-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash with Kernel 6.13 and recent Clang-20git snapshot #2066
Comments
Looks like `-O3` was set, so non standard command line flags are related
here.
…On Tue, Jan 21, 2025, 11:38 AM ms178 ***@***.***> wrote:
On a very fresh LLVM-20 git snapshot
(e4f03b158c97098e1835cc1f00d0175398974f98), I see the following crash if I
want to compile the 6.13 Linux Kernel from CachyOS:
HOSTCC scripts/asn1_compiler
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/marcus/llvm20/bin/clang-20 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -dumpdir scripts/asn1_compiler- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name asn1_compiler.c -function-alignment 5 -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -ffp-contract=fast -fno-rounding-math -ffp-exception-behavior=ignore -mconstructor-aliases -funwind-tables=2 -target-cpu raptorlake -target-feature +prfchw -target-feature -cldemote -target-feature +avx -target-feature +sahf -target-feature -xop -target-feature +crc32 -target-feature -amx-fp8 -target-feature +xsaves -target-feature -avx512fp16 -target-feature -usermsr -target-feature -sm4 -target-feature -egpr -target-feature +sse4.1 -target-feature -avx512ifma -target-feature +xsave -target-feature +sse4.2 -target-feature -tsxldtrk -target-feature -sm3 -target-feature +ptwrite -target-feature +widekl -target-feature -movrs -target-feature +invpcid -target-feature +64bit -target-feature +xsavec -target-feature -avx10.1-512 -target-feature -avx512vpopcntdq -target-feature +cmov -target-feature -avx512vp2intersect -target-feature -avx512cd -target-feature +movbe -target-feature -avxvnniint8 -target-feature -ccmp -target-feature -amx-int8 -target-feature +kl -target-feature -avx10.1-256 -target-feature -sha512 -target-feature +avxvnni -target-feature -rtm -target-feature +adx -target-feature +avx2 -target-feature +hreset -target-feature +movdiri -target-feature +serialize -target-feature +vpclmulqdq -target-feature -avx512vl -target-feature -uintr -target-feature -cf -target-feature +clflushopt -target-feature -raoint -target-feature -cmpccxadd -target-feature +bmi -target-feature -amx-tile -target-feature +sse -target-feature -avx10.2-256 -target-feature +gfni -target-feature -avxvnniint16 -target-feature -amx-fp16 -target-feature -zu -target-feature -ndd -target-feature +xsaveopt -target-feature +rdrnd -target-feature -avx512f -target-feature -amx-bf16 -target-feature -avx512bf16 -target-feature -avx512vnni -target-feature -push2pop2 -target-feature +cx8 -target-feature -avx512bw -target-feature +sse3 -target-feature +pku -target-feature -nf -target-feature -amx-tf32 -target-feature -amx-avx512 -target-feature +fsgsbase -target-feature -clzero -target-feature -mwaitx -target-feature -lwp -target-feature +lzcnt -target-feature +sha -target-feature +movdir64b -target-feature -ppx -target-feature -wbnoinvd -target-feature -enqcmd -target-feature -amx-transpose -target-feature -avx10.2-512 -target-feature -avxneconvert -target-feature -tbm -target-feature -pconfig -target-feature -amx-complex -target-feature +ssse3 -target-feature +cx16 -target-feature +fma -target-feature +popcnt -target-feature -avxifma -target-feature +f16c -target-feature -avx512bitalg -target-feature -rdpru -target-feature +clwb -target-feature +mmx -target-feature +sse2 -target-feature +rdseed -target-feature -avx512vbmi2 -target-feature -prefetchi -target-feature -amx-movrs -target-feature +rdpid -target-feature -fma4 -target-feature -avx512vbmi -target-feature +shstk -target-feature +vaes -target-feature +waitpkg -target-feature -sgx -target-feature +fxsr -target-feature -avx512dq -target-feature -sse4a -target-feature +aes -target-feature +bmi2 -target-feature +pclmul -tune-cpu raptorlake -debugger-tuning=gdb -fdebug-compilation-dir=/tmp/makepkg/linux-cachyos/src/linux-6.13 -ffunction-sections -fdata-sections -fsplit-machine-functions -fcoverage-compilation-dir=/tmp/makepkg/linux-cachyos/src/linux-6.13 -resource-dir /home/marcus/llvm20/lib/clang/20 -dependency-file scripts/.asn1_compiler.d -MT scripts/asn1_compiler -I ./scripts/include -I ./include -internal-isystem /home/marcus/llvm20/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -source-date-epoch 1737487879 -O3 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-error -w -std=gnu11 -ferror-limit 19 -fcf-protection=none -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -mprefer-vector-width=256 -mllvm -inline-threshold=1000 -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement -mllvm -enable-gvn-hoist -mllvm -enable-dfa-jump-thread -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/asn1_compiler-456ed7.o -x c scripts/asn1_compiler.c
1. <eof> parser at end of file
2. Optimizer
3. Running pass "function<eager-inv>(float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,extra-vector-passes,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,early-cse<>,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop(loop-unroll-and-jam),loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)" on module "scripts/asn1_compiler.c"
4. Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "main"
#0 0x00005e1b5aed88c2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) Signals.cpp:0:0
#1 0x00005e1b5aed8ccf SignalHandler(int) Signals.cpp:0:0
#2 0x00007762de845f50 (/usr/lib/libc.so.6+0x45f50)
#3 0x00005e1b58dd7acd llvm::X86TTIImpl::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::TargetTransformInfo::CastContextHint, llvm::TargetTransformInfo::TargetCostKind, llvm::Instruction const*) (.cold) X86TargetTransformInfo.cpp:0:0
#4 0x00005e1b5bc88c83 llvm::VPWidenCastRecipe::computeCost(llvm::ElementCount, llvm::VPCostContext&) const (/home/marcus/llvm20/bin/clang-20+0xce88c83)
#5 0x00005e1b5bc8322b llvm::VPRecipeBase::cost(llvm::ElementCount, llvm::VPCostContext&) (/home/marcus/llvm20/bin/clang-20+0xce8322b)
#6 0x00005e1b5bc761c3 llvm::VPBasicBlock::cost(llvm::ElementCount, llvm::VPCostContext&) (/home/marcus/llvm20/bin/clang-20+0xce761c3)
#7 0x00005e1b5bc7637d llvm::VPRegionBlock::cost(llvm::ElementCount, llvm::VPCostContext&) (/home/marcus/llvm20/bin/clang-20+0xce7637d)
#8 0x00005e1b5bc23e9c llvm::LoopVectorizationPlanner::cost(llvm::VPlan&, llvm::ElementCount) const LoopVectorize.cpp:0:0
#9 0x00005e1b5bc24265 llvm::LoopVectorizationPlanner::computeBestVF() LoopVectorize.cpp:0:0
#10 0x00005e1b5bc52312 llvm::LoopVectorizePass::processLoop(llvm::Loop*) LoopVectorize.cpp:0:0
#11 0x00005e1b59b252c1 llvm::LoopVectorizePass::runImpl(llvm::Function&) LoopVectorize.cpp:0:0
#12 0x00005e1b599aed27 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (.cold) bolt-pseudo.o:0:0
#13 0x00005e1b58af07cd llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilder.cpp:0:0
#14 0x00005e1b57cfc769 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/marcus/llvm20/bin/clang-20+0x8efc769)
#15 0x00005e1b57cfc11b llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) AMDGPUTargetMachine.cpp:0:0
#16 0x00005e1b57faea24 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/marcus/llvm20/bin/clang-20+0x91aea24)
#17 0x00005e1b57fae6a9 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) AMDGPUTargetMachine.cpp:0:0
#18 0x00005e1b57fb7744 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/marcus/llvm20/bin/clang-20+0x91b7744)
#19 0x00005e1b586a8fdf (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#20 0x00005e1b585c1fef clang::emitBackendOutput(clang::CompilerInstance&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/marcus/llvm20/bin/clang-20+0x97c1fef)
#21 0x00005e1b59a64ca2 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/marcus/llvm20/bin/clang-20+0xac64ca2)
#22 0x00005e1b57d7a684 clang::ParseAST(clang::Sema&, bool, bool) (/home/marcus/llvm20/bin/clang-20+0x8f7a684)
#23 0x00005e1b5873281e clang::FrontendAction::Execute() (/home/marcus/llvm20/bin/clang-20+0x993281e)
#24 0x00005e1b5869a9ab clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/marcus/llvm20/bin/clang-20+0x989a9ab)
#25 0x00005e1b5869ad9c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/marcus/llvm20/bin/clang-20+0x989ad9c)
#26 0x00005e1b58698b4e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/marcus/llvm20/bin/clang-20+0x9898b4e)
#27 0x00005e1b5869a2f1 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x00005e1b58697d19 clang_main(int, char**, llvm::ToolContext const&) (/home/marcus/llvm20/bin/clang-20+0x9897d19)
#29 0x00005e1b52a9b752 (/home/marcus/llvm20/bin/clang-20+0x3c9b752)
#30 0x00007762de826187 (/usr/lib/libc.so.6+0x26187)
#31 0x00007762de826237 __libc_start_main (/usr/lib/libc.so.6+0x26237)
#32 0x00005e1b533bce71 _start (/home/marcus/llvm20/bin/clang-20+0x45bce71)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 20.0.0git (https://github.com/llvm/llvm-project.git e4f03b158c97098e1835cc1f00d0175398974f98)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /home/marcus/llvm20/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/asn1_compiler-82f6f2.c
clang: note: diagnostic msg: /tmp/asn1_compiler-82f6f2.sh
clang: note: diagnostic msg:
********************
make[2]: *** [scripts/Makefile.host:114: scripts/asn1_compiler] Fehler 1
make[1]: *** [/tmp/makepkg/linux-cachyos/src/linux-6.13/Makefile:1255: scripts] Fehler 2
make: *** [Makefile:251: __sub-make] Fehler 2
asn1_compiler-82f6f2.c.txt
<https://github.com/user-attachments/files/18495653/asn1_compiler-82f6f2.c.txt>
asn1_compiler-82f6f2.sh.txt
<https://github.com/user-attachments/files/18495654/asn1_compiler-82f6f2.sh.txt>
—
Reply to this email directly, view it on GitHub
<#2066>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN5IX5I47QZFQZYFM4IPVD2L2O2VAVCNFSM6AAAAABVTI6IMSVHI2DSMVQWIX3LMV43ASLTON2WKOZSHAYDENRVG4ZDEMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I've tried something more conservative and also dbus-broker, with the same issue (trace is from dbus-broker):
|
Dbus-broker gets past the first stage in my PGO+BOLT-optimized PKGBUILD with these very modest flags...
... but fails in stage 2 with a trace that looks very familiar:
|
O2 and above seems to trigger this, I don't get it with O1 and these flags:
|
Can you rebuild llvm with assertions enabled? There's an assert in |
It also looks like there are a bunch of vectorizing flags in the command, presumably those come from CachyOS as well? Is there any way to see everything that they enable because those certainly seem related for reproducing? cc @ptr1337 |
@nathanchance These additional vectorizing flags are from my personal modifications. The issue doesn't seem to be specific to the Linux Kernel though, I've since reproduced it with dbus-broker with O2 and above (O1 is fine). I am currently building LLVM with assertions enabled, as Nick suggested. I'll come back if I have more to report. P.S: I've also filed llvm/llvm-project#123809 to track this on LLVM upstream. |
With an assertion build from the same revision but minus the BOLT optimization stage that I usually perform on top, I cannot reproduce this issue. Yet another level of added complexity is that I've used some BOLT patches on top which might be a factor here, too. Next, I'll perform the BOLT optimization on the assertion build and see if that causes the issue to re-appear. |
Indeed something bad is going on after performing the BOLT optimizations. The trace with the Kernel looks different, though:
|
After some further experiments, I am now fairly confident that BOLT or the BOLT extra patches broke my Clang/LLD binaries as I cannot reproduce the issue reported here and upstream any longer with the LTO+PGOed binaries. As this is most likely a toolchain and not a Clang/Kernel-related issue, shall I close this one in favor of further discussions in the LLVM upstream issue? |
Yes, I would recommend bisecting that series to see which patch causes it then working with the author to make sure it gets fixed before merging into LLVM upstream. |
No, this build and flags are not passed by us. ms178 manually patches the Kbuild/Makefile and adds these. |
On a very fresh LLVM-20 git snapshot (e4f03b158c97098e1835cc1f00d0175398974f98), I see the following crash if I want to compile the 6.13 Linux Kernel from CachyOS:
asn1_compiler-82f6f2.c.txt
asn1_compiler-82f6f2.sh.txt
The text was updated successfully, but these errors were encountered: