Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit b81fac9

Browse files
committed
x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough. Nothing requires that the FPU is set up early. It has to be initialized before fork_init() because the task_struct size depends on the FPU register buffer size. Move the initialization to arch_cpu_finalize_init() which is the perfect place to do so. No functional change. This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment. Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1703db2 commit b81fac9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

arch/x86/kernel/cpu/common.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,8 +1604,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
16041604

16051605
sld_setup(c);
16061606

1607-
fpu__init_system();
1608-
16091607
#ifdef CONFIG_X86_32
16101608
/*
16111609
* Regardless of whether PCID is enumerated, the SDM says
@@ -2287,8 +2285,6 @@ void cpu_init(void)
22872285

22882286
doublefault_init_cpu_tss();
22892287

2290-
fpu__init_cpu();
2291-
22922288
if (is_uv_system())
22932289
uv_cpu_init();
22942290

@@ -2304,6 +2300,7 @@ void cpu_init_secondary(void)
23042300
*/
23052301
cpu_init_exception_handling();
23062302
cpu_init();
2303+
fpu__init_cpu();
23072304
}
23082305
#endif
23092306

@@ -2396,6 +2393,13 @@ void __init arch_cpu_finalize_init(void)
23962393
'0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
23972394
}
23982395

2396+
/*
2397+
* Must be before alternatives because it might set or clear
2398+
* feature bits.
2399+
*/
2400+
fpu__init_system();
2401+
fpu__init_cpu();
2402+
23992403
alternative_instructions();
24002404

24012405
if (IS_ENABLED(CONFIG_X86_64)) {

0 commit comments

Comments
 (0)