Messages in this thread | | | From | "Chang S. Bae" <> | Subject | [PATCH 0/3] x86/fpu: Improve the init_fpstate setup code | Date | Wed, 24 Aug 2022 12:12:20 -0700 |
| |
Hi all,
This set of patches fixes the init_fpstate code. So this first version is sent to the maintainers hoping the fix is reviewable.
Thanks, Chang
== 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.
This also leads to a noisy splat with XRSTORS as it expects all the buffer memory accessible. This is mentioned in Intel SDM Vol.1 13.13 Memory Access By The XSAVE Feature Set: "An execution of an instruction in the XSAVE feature set may access any byte of any state component on which that execution operates."
== Other minor issues ==
The existing sanity check could help finding this issue as it checks whether the allocated init_fpstate is enough for the expected size or not. But what is currently measured is not matched -- the size without the AMX state.
Also, these size and features are better to be configured first before setting up the init image.
== Patchset ==
As AMX requires the compacted format, init_fpstate may exclude dynamic states. The series also includes other improvments: * Set up the init_fpstate buffer after its scope is clarified. * Fix the size that is validated against the static allocation.
Chang S. Bae (3): x86/fpu: Configure init_fpstate attributes orderly x86/fpu: Fix the init_fpstate size check with the actual size x86/fpu: Exclude dynamic states from init_fpstate
arch/x86/kernel/fpu/init.c | 8 -------- arch/x86/kernel/fpu/xstate.c | 33 ++++++++++++++------------------- 2 files changed, 14 insertions(+), 27 deletions(-)
base-commit: cf90f46223eef9d5f389b4b88ee2fc7914458b06 -- 2.17.1
| |