Skip to content
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

Tracking issue for kexec on LoongArch #1963

Closed
heiher opened this issue Nov 24, 2023 · 2 comments
Closed

Tracking issue for kexec on LoongArch #1963

heiher opened this issue Nov 24, 2023 · 2 comments
Labels
[ARCH] loongarch This bug impacts ARCH=loongarch [PATCH] Accepted A submitted patch has been accepted upstream

Comments

@heiher
Copy link
Member

heiher commented Nov 24, 2023

Currently, the vmlinux built from Clang cannot be loaded via kexec.

kexec -l --reuse-cmdline vmlinux
kexec -e
[   21.434033] kexec_core: Starting new kernel
[   21.434285] EFI boot flag 0x1
[   21.434317] Command line at 0x9000000000108000
[   21.434362] System table at 0xf730018
[   21.434400] We will call new kernel at 0x90000000013e0000
[   21.434453] Bye ...
[   21.434908] CPU 0 Unable to handle kernel paging request at virtual address 0000000000000031, era == 9000000000100058, ra == 9000000002780a20
[   21.435183] Oops[#1]:
[   21.435300] CPU: 0 PID: 242 Comm: kexec Not tainted 6.6.2+ #27
[   21.435417] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[   21.435546] pc 9000000000100058 ra 9000000002780a20 tp 900000010598c000 sp 900000010598fd00
[   21.435658] a0 0000000000000001 a1 9000000000108000 a2 000000000f730018 a3 90000000013e0000
[   21.435770] a4 900000010581c000 a5 9000000000100000 a6 0000000000000001 a7 0000000000000001
[   21.435883] t0 fffffffffffffff7 t1 0000000000000000 t2 0000000000000000 t3 00000000000000ff
[   21.435996] t4 000000000000ffff t5 0000000000ffff0a t6 00000000ffff0a10 t7 0000000000000016
[   21.436110] t8 9000000003916a24 u0 90000000042e46a0 s9 0000000000000001 s0 900000010581c210
[   21.436224] s1 90000001109f8060 s2 0000000000000008 s3 9000000000100060 s4 001400a52880c2c5
[   21.436337] s5 00000000000007f4 s6 0000555558cfc000 s7 000055557ffcc4c0 s8 0000000000000000
[   21.436453]    ra: 9000000002780a20 relocate_new_kernel+0x0/0x8
[   21.436737]   ERA: 9000000000100058 0x9000000000100058
[   21.436874]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
[   21.437038]  PRMD: 00000000 (PPLV0 -PIE -PWE)
[   21.437136]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
[   21.437246]  ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
[   21.437359] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
[   21.437455]  BADV: 0000000000000031
[   21.437510]  PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
[   21.437611] Modules linked in:
[   21.437685] Process kexec (pid: 242, threadinfo=000000004c51a381, task=00000000b87a44d4)
[   21.437860] Stack : fffffffffee1dead 9000000003e4c748 fffffffffee1dead 9000000003e62c30
[   21.438023]         0000000045584543 900000000432ccb0 900000000432cc98 9000000002862740
[   21.438145]         00007ffff241fd58 00000000ffffffea 00007ffff241fd58 90000000027bf354
[   21.438270]         0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.438391]         0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.438520]         0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.438640]         0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.438757]         0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.438876]         0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.438999]         0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.439125]         ...
[   21.439181] Call Trace:
[   21.439349] [<9000000002862740>] kernel_kexec+0xc0/0xe0
[   21.439477] [<90000000027bf354>] sys_reboot+0x1f4/0x280
[   21.439565] [<900000000392f23c>] do_syscall+0x7c/0xa0
[   21.439641] [<90000000027712bc>] handle_syscall+0xbc/0x158
[   21.439738] 
[   21.439776] Code: 29c02060  559653ff  28c282c4 <2880c2c5> 001400a5  02c0235a  02c02318  02ffff9c  43ff9f9f 
[   21.439980] 
[   21.440085] ---[ end trace 0000000000000000 ]---
@heiher
Copy link
Member Author

heiher commented Nov 24, 2023

horms pushed a commit to horms/kexec-tools that referenced this issue Nov 27, 2023
Normally vmlinux for LoongArch is of ET_EXEC type, while if built with
CONFIG_RELOCATABLE (this is PIE) and Clang, it will be of ET_DYN type.
Meanwhile, physical address field of segments in vmlinux has actually
the same value as virtual address field.

Similar to arm64, this patch allows to unconditionally skip the check
on LoongArch.

Link: ClangBuiltLinux/linux#1963
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Simon Horman <horms@kernel.org>
@nickdesaulniers nickdesaulniers added [PATCH] Submitted A patch has been submitted for review [ARCH] loongarch This bug impacts ARCH=loongarch labels Nov 27, 2023
@nathanchance
Copy link
Member

If I understand correctly, this should be resolved by https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=eaa717e912eef22706a3ccfb579a544ac1ee0904, so I am closing this because it lives outside of the kernel tree. Thanks a lot for testing and fixing this!

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Nov 28, 2023
horms pushed a commit to horms/kexec-tools that referenced this issue Dec 2, 2023
Normally vmlinux for LoongArch is of ET_EXEC type, while if built with
CONFIG_RELOCATABLE (this is PIE) and Clang, it will be of ET_DYN type.
Meanwhile, physical address field of segments in vmlinux has actually
the same value as virtual address field.

Similar to arm64, this patch allows to unconditionally skip the check
on LoongArch.

Link: ClangBuiltLinux/linux#1963
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Simon Horman <horms@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] loongarch This bug impacts ARCH=loongarch [PATCH] Accepted A submitted patch has been accepted upstream
Projects
None yet
Development

No branches or pull requests

3 participants