Skip to content

Commit f25ad76

Browse files
KAGA-KOKOgregkh
authored andcommitted
x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
commit b81fac9 upstream 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] Signed-off-by: Daniel Sneddon <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e269329 commit f25ad76

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
@@ -1575,8 +1575,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
15751575

15761576
sld_setup(c);
15771577

1578-
fpu__init_system();
1579-
15801578
#ifdef CONFIG_X86_32
15811579
/*
15821580
* Regardless of whether PCID is enumerated, the SDM says
@@ -2292,8 +2290,6 @@ void cpu_init(void)
22922290

22932291
doublefault_init_cpu_tss();
22942292

2295-
fpu__init_cpu();
2296-
22972293
if (is_uv_system())
22982294
uv_cpu_init();
22992295

@@ -2309,6 +2305,7 @@ void cpu_init_secondary(void)
23092305
*/
23102306
cpu_init_exception_handling();
23112307
cpu_init();
2308+
fpu__init_cpu();
23122309
}
23132310
#endif
23142311

@@ -2403,6 +2400,13 @@ void __init arch_cpu_finalize_init(void)
24032400
'0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
24042401
}
24052402

2403+
/*
2404+
* Must be before alternatives because it might set or clear
2405+
* feature bits.
2406+
*/
2407+
fpu__init_system();
2408+
fpu__init_cpu();
2409+
24062410
alternative_instructions();
24072411

24082412
if (IS_ENABLED(CONFIG_X86_64)) {

0 commit comments

Comments
 (0)