LoongArch: Ensure FP/SIMD registers in the core dump file is up to date
authorHuacai Chen <chenhuacai@loongson.cn>
Sat, 26 Aug 2023 14:21:57 +0000 (22:21 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 26 Aug 2023 14:21:57 +0000 (22:21 +0800)
commit656f9aec07dba7c61d469727494a5d1b18d0bef4
treeeb7b6532106a1984a66ca59d5c3b5a7f7030e87a
parentc337c849ab528241897ddfb6f334912ead0bfd66
LoongArch: Ensure FP/SIMD registers in the core dump file is up to date

This is a port of commit 379eb01c21795edb4c ("riscv: Ensure the value
of FP registers in the core dump file is up to date").

The values of FP/SIMD registers in the core dump file come from the
thread.fpu. However, kernel saves the FP/SIMD registers only before
scheduling out the process. If no process switch happens during the
exception handling, kernel will not have a chance to save the latest
values of FP/SIMD registers. So it may cause their values in the core
dump file incorrect. To solve this problem, force fpr_get()/simd_get()
to save the FP/SIMD registers into the thread.fpu if the target task
equals the current task.

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/fpu.h
arch/loongarch/kernel/ptrace.c