Skip to content

Commit ad9c29f

Browse files
ChangSeokBaehansendc
authored andcommitted
Documentation/x86: Explain the purpose for dynamic features
This summary will help to guide the proper use of the enabling model. Signed-off-by: Chang S. Bae <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: Tony Luck <[email protected]> Link: https://lore.kernel.org/all/20230121001900.14900-2-chang.seok.bae%40intel.com
1 parent e8d018d commit ad9c29f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Documentation/x86/xstate.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ are enabled by XCR0 as well, but the first use of related instruction is
1111
trapped by the kernel because by default the required large XSTATE buffers
1212
are not allocated automatically.
1313

14+
The purpose for dynamic features
15+
--------------------------------
16+
17+
Legacy userspace libraries often have hard-coded, static sizes for
18+
alternate signal stacks, often using MINSIGSTKSZ which is typically 2KB.
19+
That stack must be able to store at *least* the signal frame that the
20+
kernel sets up before jumping into the signal handler. That signal frame
21+
must include an XSAVE buffer defined by the CPU.
22+
23+
However, that means that the size of signal stacks is dynamic, not static,
24+
because different CPUs have differently-sized XSAVE buffers. A compiled-in
25+
size of 2KB with existing applications is too small for new CPU features
26+
like AMX. Instead of universally requiring larger stack, with the dynamic
27+
enabling, the kernel can enforce userspace applications to have
28+
properly-sized altstacks.
29+
1430
Using dynamically enabled XSTATE features in user space applications
1531
--------------------------------------------------------------------
1632

0 commit comments

Comments
 (0)