]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/fpu: Remove init_task FPU state dependencies, add debugging warning for PF_KTHREA...
authorIngo Molnar <mingo@kernel.org>
Wed, 9 Apr 2025 21:11:26 +0000 (23:11 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 14 Apr 2025 06:18:29 +0000 (08:18 +0200)
commit22aafe3bcb67472effdea1ccf0df20280192bbaf
tree809bc2c253bb1b7ae02ade81b6431f66e2e96951
parentc360bdc593b8a8b6e94166026728764085919cff
x86/fpu: Remove init_task FPU state dependencies, add debugging warning for PF_KTHREAD tasks

init_task's FPU state initialization was a bit of a hack:

__x86_init_fpu_begin = .;
. = __x86_init_fpu_begin + 128*PAGE_SIZE;
__x86_init_fpu_end = .;

But the init task isn't supposed to be using the FPU context
in any case, so remove the hack and add in some debug warnings.

As Linus noted in the discussion, the init task (and other
PF_KTHREAD tasks) *can* use the FPU via kernel_fpu_begin()/_end(),
but they don't need the context area because their FPU use is not
preemptible or reentrant, and they don't return to user-space.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chang S. Bae <chang.seok.bae@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20250409211127.3544993-8-mingo@kernel.org
arch/x86/include/asm/processor.h
arch/x86/kernel/fpu/core.c
arch/x86/kernel/fpu/init.c
arch/x86/kernel/fpu/xstate.c
arch/x86/kernel/vmlinux.lds.S