v3
2026-09-17
x86 identify_cpu 重构与修复 · v3
v3 重构 x86 identify_cpu():拆出 init_cpu_info、内联 generic_identify,并修复 boot CPU 能力被临时清空。
原始补丁链接
子 Patch(5)
1/5
x86/cpu: Factor init_cpu_info() out of identify_cpu()
[x86/cpu: Factor init_cpu_info() out of identify_cpu()] identify_cpu() unconditionally resets the struct cpuinfo_x86 fields to their default values and clears the capability arrays with memset() befor
2/5
x86/cpu: Initialize boot CPU cpuinfo defaults early
[x86/cpu: Initialize boot CPU cpuinfo defaults early] early_identify_cpu() clears the capability array, the CPUID table and extended_cpuid_level, but the architectural defaults for the rest of struct
3/5
x86/cpu: Inline generic_identify() into identify_cpu()
[x86/cpu: Inline generic_identify() into identify_cpu()] generic_identify() has exactly one call site: at the top of identify_cpu(). Fold it into identify_cpu() so that a single function does the job
4/5
x86/cpu: Move 32-bit SEP setup into identify_cpu()
[x86/cpu: Move 32-bit SEP setup into identify_cpu()] identify_boot_cpu() and identify_secondary_cpu() both call enable_sep_cpu() under CONFIG_X86_32 immediately after identify_cpu(). Do it once and d
5/5
x86/cpu: Don't transiently clear the boot CPU's capabilities
[x86/cpu: Don’t transiently clear the boot CPU’s capabilities] On the boot CPU identify_cpu() runs from arch_cpu_finalize_init(), with interrupts enabled and before alternatives are patched. So cpu_fe