Star64_linux/arch/x86
Feng Tang 91b56fc98b x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4
commit 2c66ca3949 upstream.

0-Day found a 34.6% regression in stress-ng's 'af-alg' test case, and
bisected it to commit b81fac906a ("x86/fpu: Move FPU initialization into
arch_cpu_finalize_init()"), which optimizes the FPU init order, and moves
the CR4_OSXSAVE enabling into a later place:

   arch_cpu_finalize_init
       identify_boot_cpu
	   identify_cpu
	       generic_identify
                   get_cpu_cap --> setup cpu capability
       ...
       fpu__init_cpu
           fpu__init_cpu_xstate
               cr4_set_bits(X86_CR4_OSXSAVE);

As the FPU is not yet initialized the CPU capability setup fails to set
X86_FEATURE_OSXSAVE. Many security module like 'camellia_aesni_avx_x86_64'
depend on this feature and therefore fail to load, causing the regression.

Cure this by setting X86_FEATURE_OSXSAVE feature right after OSXSAVE
enabling.

[ tglx: Moved it into the actual BSP FPU initialization code and added a comment ]

Fixes: b81fac906a ("x86/fpu: Move FPU initialization into arch_cpu_finalize_init()")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/202307192135.203ac24e-oliver.sang@intel.com
Link: https://lore.kernel.org/lkml/20230823065747.92257-1-feng.tang@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-05 01:25:09 +08:00
..
boot x86/boot: Wrap literal addresses in absolute_pointer() 2023-08-20 15:21:09 +08:00
configs x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs 2023-04-19 17:44:29 +08:00
crypto crypto: x86/ghash - fix unaligned access in ghash_setkey() 2023-04-19 17:59:43 +08:00
entry x86/mm: Fix VDSO and VVAR placement on 5-level paging machines 2023-08-20 16:01:40 +08:00
events perf/ibs: Fix interface via core pmu events 2023-08-20 15:24:17 +08:00
hyperv x86/hyperv: Remove unregister syscore call from Hyper-V cleanup 2023-04-19 17:57:57 +08:00
ia32
include x86/fpu: Invalidate FPU state correctly on exec() 2023-09-05 01:25:09 +08:00
kernel x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4 2023-09-05 01:25:09 +08:00
kvm Revert "KVM: x86: enable TDP MMU by default" 2023-09-05 01:25:07 +08:00
lib x86/retpoline,kprobes: Fix position of thunk sections with CONFIG_LTO_CLANG 2023-08-28 23:27:08 +08:00
math-emu x86: Prepare asm files for straight-line-speculation 2023-04-19 17:48:43 +08:00
mm x86/mm: Use mm_alloc() in poking_init() 2023-08-20 16:01:29 +08:00
net x86/extable: Extend extable functionality 2023-04-19 17:51:46 +08:00
pci x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot 2023-06-06 18:05:16 +08:00
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2023-04-19 17:52:50 +08:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2023-04-19 17:56:42 +08:00
purgatory x86/purgatory: remove PGO flags 2023-08-20 15:23:41 +08:00
ras
realmode x86/mm: Flush global TLB when switching to trampoline page-table 2023-04-19 17:44:22 +08:00
tools
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-04-19 18:00:28 +08:00
video
xen x86/xen: Fix secondary processors' FPU initialization 2023-08-20 16:01:29 +08:00
.gitignore
Kbuild
Kconfig x86/srso: Add a Speculative RAS Overflow mitigation 2023-08-20 16:01:29 +08:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2023-04-19 17:52:06 +08:00
Makefile x86/realmode: build with -D__DISABLE_EXPORTS 2023-04-19 17:51:29 +08:00
Makefile.um
Makefile_32.cpu x86/build: Do not add -falign flags unconditionally for clang 2021-09-19 10:35:53 +09:00