Unverified Commit e0484d4e authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!789 x86 FPU/AMX bug fix since kernel v5.18

Merge Pull Request from: @Linwang_68f8 
 
 **Content:** 
This PR involves x86/FPU and dynamitic feature (AMX) related bug fixes since kernel V5.18.

There are 15 patches in total in this patch set:
1. x86/fpu: Cure supervisor mode (ENQCMD) fallout
The (re)enabling of ENQCMD or the enabling of any supervisor only state results in a possible inconsistency of the host and guest FPU XSTATE layout on systems which support that feature.
d6d6d50f x86/fpu/xstate: Consolidate size calculations
781c64bf x86/fpu/xstate: Handle supervisor states in XSTATE permissions
7aa5128b x86/fpu/xsave: Handle compacted offsets correctly with supervisor states
6afbb58c x86/fpu: Cache xfeature flags from CPUID
35a77d45 x86/fpu/xsave: Initialize offset/size cache early
d47f71f6 x86/fpu: Remove unused supervisor only offsets
a9f84fb7 x86/fpu: Remove redundant XCOMP_BV initialization

2. x86/fpu: Improve the init_fpstate setup code
Background:
The init_fpstate is an XSAVE image that records init states during the boot time. It is presumed to cover all the supported and enabled features. The setup code has been recently optimized to capture legacy states only as all of the other init states are all zeros.
Problem with AMX state:
When AMX is enabled, this buffer is too small to include AMX TILE_DATA (8KB) as it is statically allocated with about a page. But, the buffer is formatted to have them all although using the compacted format.
471f0aa7 x86/fpu: Fix copy_xstate_to_uabi() to copy init states correctly
a401f45e x86/fpu: Exclude dynamic states from init_fpstate
d3e021ad x86/fpu: Fix the init_fpstate size check with the actual size
c32d7cab x86/fpu: Configure init_fpstate attributes orderly

3. x86/fpu/xstate: Follow up on the init_fpstate fallout again
When copying the non-initialized dynamic state from the task xstate, the code unconditionally retrieves the address in init_fpstate which is needless. Consequently, this triggers a false-positive warning which meaninglessly confuses users.
62faca1c selftests/x86/amx: Add a ptrace test
b1588884 x86/fpu/xstate: Prevent false-positive warning in __copy_xstate_uabi_buf()
2ba8a7ab selftests/x86/amx: Use provided __cpuid_count() macro
a23039c7 selftests: Provide local define of __cpuid_count()

 **Intel-kernel issue:** 
#I73H0T: https://gitee.com/openeuler/intel-kernel/issues/I73H0T

 **Test environment:** 
openEuler 22.03 SP1 + backporting kernel

 **Test cases:** 
dmesg checking to make sure no fpu corruption found.
kernel self-test.
TMUL functional testing.
Context switch testing.
oneDNN/BenchDNN.


 **Known issue:** 
N/A

 **Default config change:** 
N/A 
 
Link:https://gitee.com/openeuler/kernel/pulls/789

 

Reviewed-by: default avatarJason Zeng <jason.zeng@intel.com>
Reviewed-by: default avatarAichun Shi <aichun.shi@intel.com>
Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents aaae3642 64d3811e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment