Closed
Description
After llvm/llvm-project@e87f33d, I see a boot failure with ARCH=riscv defconfig
:
$ make -sjk"$(nproc)" ARCH=riscv LLVM=1 mrproper defconfig Image
$ boot-qemu.py -k .
...
[ 0.000000] Linux version 6.7.0-rc5 ([email protected]) (ClangBuiltLinux clang version 18.0.0git (https://github.com/llvm/llvm-project e87f33d9ce785668223c3bcc4e06956985cccda1), ClangBuiltLinux LLD 18.0.0) #1 SMP Mon Dec 11 10:23:26 MST 2023
...
[ 0.000000] percpu: Embedded 20 pages/cpu s41592 r8192 d32136 u81920
[ 0.000000] Unable to handle kernel paging request at virtual address ff6000001ffe9040
[ 0.000000] Oops [#1]
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.7.0-rc5 #1
[ 0.000000] Hardware name: riscv-virtio,qemu (DT)
[ 0.000000] epc : 0xff6000001ffe9040
[ 0.000000] ra : 0xff6000001ffe9040
[ 0.000000] epc : ff6000001ffe9040 ra : ff6000001ffe9040 sp : ffffffff81203e00
[ 0.000000] gp : ffffffff813102c0 tp : ffffffff8120d580 t0 : 0000000000000000
[ 0.000000] t1 : 0000000000000000 t2 : ffffffff8134a648 s0 : 0000000000000004
[ 0.000000] s1 : ffffffff80c21000 a0 : ff6000001ffeadc0 a1 : 000000000000a000
[ 0.000000] a2 : 0000000000000000 a3 : 000000000000a000 a4 : ff6000001ffeadcc
[ 0.000000] a5 : 0000000000000000 a6 : 0000000000000028 a7 : 0000000000000400
[ 0.000000] s2 : ff6000001ffe9000 s3 : 0000000000014000 s4 : 0000000000001000
[ 0.000000] s5 : 0000000000000018 s6 : 0000000000000040 s7 : 0000000000000001
[ 0.000000] s8 : 000000009ffe7fff s9 : ffffffff81310530 s10: ff6000001ffeaec0
[ 0.000000] s11: ff6000001ffe9050 t3 : ffffffff8134b398 t4 : ffffffff8134b398
[ 0.000000] t5 : ffffffff8134b2d8 t6 : ffffffff8134b398
[ 0.000000] status: 0000000200000100 badaddr: ff6000001ffe9040 cause: 000000000000000c
[ 0.000000] Code: 0000 0000 1000 0000 0000 0000 0001 0000 0000 0000 (0001) 0000
[ 0.000000] ---[ end trace 0000000000000000 ]---
[ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
qemu-system-riscv64: terminating on signal 15 from pid 36702 (timeout)
That commit seems rather innocuous, so it seems likely that this has just exposed some other issue related to linker relaxation because if I apply the following diff that adds -mno-relax
to KBUILD_CFLAGS
and KBUILD_AFLAGS
, the kernel boots fine.
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index a74be78678eb..d66f09fee2b4 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -44,7 +44,6 @@ else
endif
ifeq ($(CONFIG_LD_IS_LLD),y)
-ifeq ($(call test-lt, $(CONFIG_LLD_VERSION), 150000),y)
KBUILD_CFLAGS += -mno-relax
KBUILD_AFLAGS += -mno-relax
ifndef CONFIG_AS_IS_LLVM
@@ -52,7 +51,6 @@ ifndef CONFIG_AS_IS_LLVM
KBUILD_AFLAGS += -Wa,-mno-relax
endif
endif
-endif
ifeq ($(CONFIG_SHADOW_CALL_STACK),y)
KBUILD_LDFLAGS += --no-relax-gp
cc @topperc @MaskRay just in case you have any immediate ideas of where I should look to see what is going on here.
Bisect log
# bad: [08cb64034f17d50a660ec78ce8ea81a025b0ba71] [NFC] Remove an unused decl to avoid warning
# good: [13b88265088329decd15449e3b2461a6177174b2] Revert " [OpenMP][NFC] Remove `DelayedBinDesc`" (#74679)
git bisect start '08cb64034f17d50a660ec78ce8ea81a025b0ba71' '13b88265088329decd15449e3b2461a6177174b2'
# bad: [f5724847ec6d7e157f711a590e73895e0f048fc4] [mlir][Transforms][NFC] GreedyPatternRewriteDriver: Remove redundant worklist management code (#74796)
git bisect bad f5724847ec6d7e157f711a590e73895e0f048fc4
# good: [04c4566ca19c054c26460a14270086f1fbaf9abd] [flang] Use `genOpenMPTerminator` to insert terminator (#74719)
git bisect good 04c4566ca19c054c26460a14270086f1fbaf9abd
# bad: [58785ebd24b82f7d1d5fa6a0f8bb2a15de130230] [SLP][NFC]Check for ephemeral values beforehand, NFC.
git bisect bad 58785ebd24b82f7d1d5fa6a0f8bb2a15de130230
# good: [0e6685ab1a8313cd1dc7eb3c99ff642e6c492aa2] [ELF,test] Improve tombstone value tests
git bisect good 0e6685ab1a8313cd1dc7eb3c99ff642e6c492aa2
# good: [a4d4b45aef6dbac1cead60dcba5e60939fc1656d] [ELF] relocateNonAlloc: move likely expr == R_ABS before unlikely R_SIZE. NFC
git bisect good a4d4b45aef6dbac1cead60dcba5e60939fc1656d
# good: [7030aab1d7a33c17d72eaf721c679be6ca0b073d] [gn build] Port 3ed940ac3dac
git bisect good 7030aab1d7a33c17d72eaf721c679be6ca0b073d
# good: [ab4d6cd6d14cef1a167de1aea2fe44900d1d7309] [TextAPI] Update RecordSlice attributes to follow code guidelines (#74743)
git bisect good ab4d6cd6d14cef1a167de1aea2fe44900d1d7309
# bad: [ffb2af3ed6a95a4eb55b81a3d1351d5d4bd66eb5] [SCEVExpander] Attempt to reinfer flags dropped due to CSE (#72431)
git bisect bad ffb2af3ed6a95a4eb55b81a3d1351d5d4bd66eb5
# bad: [e87f33d9ce785668223c3bcc4e06956985cccda1] [RISCV][MC] Pass MCSubtargetInfo down to shouldForceRelocation and evaluateTargetFixup. (#73721)
git bisect bad e87f33d9ce785668223c3bcc4e06956985cccda1
# first bad commit: [e87f33d9ce785668223c3bcc4e06956985cccda1] [RISCV][MC] Pass MCSubtargetInfo down to shouldForceRelocation and evaluateTargetFixup. (#73721)