Skip to content

Commit

Permalink
Documentation/x86: Explain the purpose for dynamic features
Browse files Browse the repository at this point in the history
This summary will help to guide the proper use of the enabling model.

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/all/20230121001900.14900-2-chang.seok.bae%40intel.com
  • Loading branch information
ChangSeokBae authored and hansendc committed Mar 22, 2023
1 parent e8d018d commit ad9c29f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Documentation/x86/xstate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ are enabled by XCR0 as well, but the first use of related instruction is
trapped by the kernel because by default the required large XSTATE buffers
are not allocated automatically.

The purpose for dynamic features
--------------------------------

Legacy userspace libraries often have hard-coded, static sizes for
alternate signal stacks, often using MINSIGSTKSZ which is typically 2KB.
That stack must be able to store at *least* the signal frame that the
kernel sets up before jumping into the signal handler. That signal frame
must include an XSAVE buffer defined by the CPU.

However, that means that the size of signal stacks is dynamic, not static,
because different CPUs have differently-sized XSAVE buffers. A compiled-in
size of 2KB with existing applications is too small for new CPU features
like AMX. Instead of universally requiring larger stack, with the dynamic
enabling, the kernel can enforce userspace applications to have
properly-sized altstacks.

Using dynamically enabled XSTATE features in user space applications
--------------------------------------------------------------------

Expand Down

0 comments on commit ad9c29f

Please sign in to comment.