public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] x86/fpu: Improve the init_fpstate setup code
@ 2022-08-24 19:12 Chang S. Bae
  2022-08-24 19:12 ` [PATCH 1/3] x86/fpu: Configure init_fpstate attributes orderly Chang S. Bae
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Chang S. Bae @ 2022-08-24 19:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, chang.seok.bae

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


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-02-27 21:16 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-24 19:12 [PATCH 0/3] x86/fpu: Improve the init_fpstate setup code Chang S. Bae
2022-08-24 19:12 ` [PATCH 1/3] x86/fpu: Configure init_fpstate attributes orderly Chang S. Bae
2022-10-03 21:18   ` Neel Natu
2022-10-17 13:47   ` [tip: x86/urgent] " tip-bot2 for Chang S. Bae
2022-08-24 19:12 ` [PATCH 2/3] x86/fpu: Fix the init_fpstate size check with the actual size Chang S. Bae
2022-10-17 13:47   ` [tip: x86/urgent] " tip-bot2 for Chang S. Bae
2022-08-24 19:12 ` [PATCH 3/3] x86/fpu: Exclude dynamic states from init_fpstate Chang S. Bae
2022-10-17 13:47   ` [tip: x86/urgent] " tip-bot2 for Chang S. Bae
2022-10-18 22:13 ` [PATCH 0/1] x86/fpu: Follow up on the init_fpstate fix Chang S. Bae
2022-10-18 22:13   ` [PATCH 1/1] x86/fpu: Fix copy_xstate_to_uabi() to copy init states correctly Chang S. Bae
2022-10-20 16:57     ` Dave Hansen
2022-10-20 18:52       ` Chang S. Bae
2022-10-21 18:58     ` [PATCH v2] " Chang S. Bae
2022-10-21 22:25       ` [tip: x86/urgent] " tip-bot2 for Chang S. Bae
2022-10-22  6:23         ` Ingo Molnar
2022-10-22 13:02           ` Chang S. Bae
2023-02-27 21:05   ` [PATCH 0/2] x86/fpu/xstate: Follow up on the init_fpstate fallout again Chang S. Bae
2023-02-27 21:05     ` [PATCH 1/2] x86/fpu/xstate: Prevent false-positive warning in __copy_xstate_uabi_buf() Chang S. Bae
2023-02-27 21:05     ` [PATCH 2/2] selftests/x86/amx: Add a ptrace test Chang S. Bae

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox