android_kernel_xiaomi_sm8450/arch
Feng Tang 4bc6a4fca1 x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4
commit 2c66ca3949dc701da7f4c9407f2140ae425683a5 upstream.

0-Day found a 34.6% regression in stress-ng's 'af-alg' test case, and
bisected it to commit b81fac906a8f ("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: b81fac906a8f ("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-08-30 16:23:17 +02:00
..
alpha alpha: remove __init annotation from exported page_is_ram() 2023-08-16 18:21:03 +02:00
arc ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard 2023-07-27 08:44:00 +02:00
arm ARM: dts: imx6dl: prtrvt, prtvt7, prti6q, prtwd2: fix USB related warnings 2023-08-26 15:26:42 +02:00
arm64 arm64: dts: rockchip: Disable HS400 for eMMC on ROCK Pi 4 2023-08-26 15:26:54 +02:00
c6x c6x: add support for TIF_NOTIFY_SIGNAL 2023-01-04 11:39:21 +01:00
csky csky: Fix function name in csky_alignment() and die() 2023-02-01 08:23:20 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:23:19 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:23:19 +01:00
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
m68k m68k/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
mips MIPS: cpu-features: Use boot_cpu_type for CPU type based features 2023-08-30 16:23:10 +02:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:45:37 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-17 11:48:03 +02:00
parisc init: Remove check_bugs() leftovers 2023-08-08 19:57:37 +02:00
powerpc powerpc/rtas_flash: allow user copy to flash block cache objects 2023-08-26 15:26:50 +02:00
riscv riscv,mmio: Fix readX()-to-delay() ordering 2023-08-16 18:20:59 +02:00
s390 KVM: s390: fix sthyi error handling 2023-08-11 11:57:47 +02:00
sh sh/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
sparc sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:37 +02:00
um um/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:37 +02:00
x86 x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4 2023-08-30 16:23:17 +02:00
xtensa init: Remove check_bugs() leftovers 2023-08-08 19:57:37 +02:00
.gitignore
Kconfig init: Provide arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00