Thanks to visit codestin.com
Credit goes to github.com

Skip to content

arm64 big endian boot failure with LLVM 13 and 14 after -next commit 34f66c4c4d55 #1948

@nathanchance

Description

@nathanchance

After commit 34f66c4c4d55 ("arm64: Use a positive cpucap for FP/SIMD") in -next, CI notices a boot failure when building with LLVM 13 and 14 (we do not test LLVM 12 and earlier because ld.lld does not support OUTPUT_FORMAT on those versions):

https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/6574588247/job/17865804560
https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/6574643887/job/17867052219

$ make -skj"$(nproc)" ARCH=arm64 LLVM=1 virtconfig

$ scripts/config -d CPU_LITTLE_ENDIAN -e CPU_BIG_ENDIAN

$ make -skj"$(nproc)" ARCH=arm64 LLVM=1 olddefconfig Image.gz

$ boot-qemu.py -k . -t 15s
...
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
[    0.000000] Linux version 6.6.0-rc3-00013-g34f66c4c4d55 ([email protected]) (ClangBuiltLinux clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1), ClangBuiltLinux LLD 14.0.6) #1 SMP PREEMPT Thu Oct 19 10:59:15 MST 2023
[    0.000000] KASLR enabled
[    0.000000] random: crng init done
[    0.000000] Machine model: linux,dummy-virt
[    0.000000] earlycon: pl11 at MMIO 0x0000000009000000 (options '')
[    0.000000] printk: bootconsole [pl11] enabled
[    0.000000] Unhandled 64-bit el1h sync exception on CPU0, ESR 0x000000001fe00000 -- ASIMD
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.0-rc3-00013-g34f66c4c4d55 #1
[    0.000000] Hardware name: linux,dummy-virt (DT)
[    0.000000] pstate: 400000c9 (nZcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    0.000000] pc : __pi_strcmp+0x1c/0x150
[    0.000000] lr : populate_properties+0xe4/0x254
[    0.000000] sp : ffffd014173d3ad0
[    0.000000] x29: ffffd014173d3af0 x28: fffffbfffddffcb8 x27: 0000000000000000
[    0.000000] x26: 0000000000000058 x25: fffffbfffddfe054 x24: 0000000000000008
[    0.000000] x23: fffffbfffddfe000 x22: fffffbfffddfe000 x21: fffffbfffddfe044
[    0.000000] x20: ffffd014173d3b70 x19: 0000000000000001 x18: 0000000000000005
[    0.000000] x17: 0000000000000010 x16: 0000000000000000 x15: 00000000413e7000
[    0.000000] x14: 0000000000000000 x13: 0000000000001bcc x12: 0000000000000000
[    0.000000] x11: 00000000d00dfeed x10: ffffd414193f2cd0 x9 : 0000000000000000
[    0.000000] x8 : 0101010101010101 x7 : ffffffffffffffc0 x6 : 0000000000000000
[    0.000000] x5 : 0000000000000000 x4 : 0101010101010101 x3 : 000000000000002a
[    0.000000] x2 : 0000000000000001 x1 : ffffd014171f2988 x0 : fffffbfffddffcb8
[    0.000000] Kernel panic - not syncing: Unhandled exception
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.0-rc3-00013-g34f66c4c4d55 #1
[    0.000000] Hardware name: linux,dummy-virt (DT)
[    0.000000] Call trace:
[    0.000000]  dump_backtrace+0xec/0x108
[    0.000000]  show_stack+0x18/0x2c
[    0.000000]  dump_stack_lvl+0x50/0x68
[    0.000000]  dump_stack+0x18/0x24
[    0.000000]  panic+0x13c/0x340
[    0.000000]  el1t_64_irq_handler+0x0/0x1c
[    0.000000]  el1_abort+0x0/0x5c
[    0.000000]  el1h_64_sync+0x64/0x68
[    0.000000]  __pi_strcmp+0x1c/0x150
[    0.000000]  unflatten_dt_nodes+0x1e8/0x2d8
[    0.000000]  __unflatten_device_tree+0x5c/0x15c
[    0.000000]  unflatten_device_tree+0x38/0x50
[    0.000000]  setup_arch+0x164/0x1e0
[    0.000000]  start_kernel+0x64/0x38c
[    0.000000]  __primary_switched+0xbc/0xc4
qemu-system-aarch64: terminating on signal 15 from pid 2994349 (timeout)
# bad: [4230ea146b1e64628f11e44290bb4008e391bc24] Add linux-next specific files for 20231019
# good: [dd72f9c7e512da377074d47d990564959b772643] Merge tag 'spi-fix-v6-6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
git bisect start '4230ea146b1e64628f11e44290bb4008e391bc24' 'dd72f9c7e512da377074d47d990564959b772643'
# bad: [2958944f7786b88cb86f7b3377c1a8bda75fd506] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
git bisect bad 2958944f7786b88cb86f7b3377c1a8bda75fd506
# good: [a1fea94f1270c0b2e441320e1c0b185dd5961070] bcachefs: KEY_TYPE_error now counts towards i_sectors
git bisect good a1fea94f1270c0b2e441320e1c0b185dd5961070
# bad: [c6d5508ffd185ad82fd3458c0c9acd1801d4d123] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git
git bisect bad c6d5508ffd185ad82fd3458c0c9acd1801d4d123
# good: [e93a66f24437a1e36275b357b718be2b270d51c7] Merge branch 'for-next' of git://git.armlinux.org.uk/~rmk/linux-arm.git
git bisect good e93a66f24437a1e36275b357b718be2b270d51c7
# good: [0a84cbfb7fedf39843e12953c61a51bc8ab38673] Merge tag 'amlogic-arm64-dt-for-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux into soc/dt
git bisect good 0a84cbfb7fedf39843e12953c61a51bc8ab38673
# good: [0abc4a0457d9b04756f7df2d3334e9b0e13679d8] Merge branch 'soc/drivers' into for-next
git bisect good 0abc4a0457d9b04756f7df2d3334e9b0e13679d8
# bad: [43130e7ae2b84aa59991a995f4f5d6651cd3d4b5] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
git bisect bad 43130e7ae2b84aa59991a995f4f5d6651cd3d4b5
# bad: [a545beb64ec48b128d863da0092917413011e91f] Merge branch 'for-next/perf' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git
git bisect bad a545beb64ec48b128d863da0092917413011e91f
# bad: [e8d4006dc24e66105444715d6d5daa244aa2bdec] arm64: Remove cpus_have_const_cap()
git bisect bad e8d4006dc24e66105444715d6d5daa244aa2bdec
# bad: [25693f1771552ad6a2f38c7749a5b7516bbddd1d] arm64: Avoid cpus_have_const_cap() for ARM64_HAS_DIT
git bisect bad 25693f1771552ad6a2f38c7749a5b7516bbddd1d
# good: [d8569fba13850bbf46a172fcee63df2130cf4ecc] arm64: kvm: Use cpus_have_final_cap() explicitly
git bisect good d8569fba13850bbf46a172fcee63df2130cf4ecc
# bad: [7f0387cf76b1d026a5f0e0386a05c4cdac3a99af] arm64: Avoid cpus_have_const_cap() for ARM64_HAS_{ADDRESS,GENERIC}_AUTH
git bisect bad 7f0387cf76b1d026a5f0e0386a05c4cdac3a99af
# good: [907722917002ed06b8f75e119b83842d5f63b15e] arm64: Use build-time assertions for cpucap ordering
git bisect good 907722917002ed06b8f75e119b83842d5f63b15e
# bad: [34f66c4c4d5518c11bfb7d10defff8f814c9f28a] arm64: Use a positive cpucap for FP/SIMD
git bisect bad 34f66c4c4d5518c11bfb7d10defff8f814c9f28a
# good: [14567ba42c5747f50584eb463ac8029f2a30e0d1] arm64: Rename SVE/SME cpu_enable functions
git bisect good 14567ba42c5747f50584eb463ac8029f2a30e0d1
# first bad commit: [34f66c4c4d5518c11bfb7d10defff8f814c9f28a] arm64: Use a positive cpucap for FP/SIMD

LLVM 15 and newer do not show this issue. I bisected the fix to llvm/llvm-project@1379b15, which certainly seems like a reasonable change to land on.

While I am not exactly sure why that arm64 commit exposes this problem, it seems like something that is worth just working around in Kconfig due to arm64 big endian being a rather exotic configuration:

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index b10515c0200b..cacc67121adb 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1355,6 +1355,8 @@ choice
 config CPU_BIG_ENDIAN
        bool "Build big-endian kernel"
        depends on !LD_IS_LLD || LLD_VERSION >= 130000
+       # https://github.com/llvm/llvm-project/commit/1379b150991f70a5782e9a143c2ba5308da1161c
+       depends on AS_IS_GNU || AS_VERSION >= 150000
        help
          Say Y if you plan on running a kernel with a big-endian userspace.

Metadata

Metadata

Assignees

Labels

[BUG] linux-nextThis is an issue only seen in linux-next[FIXED][LINUX] development cycleThis bug was only present and fixed in a -next or -rc cycle[FIXED][LLVM] 15This bug was fixed in LLVM 15.x

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions