All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] x86: Support Intel Advanced Matrix Extensions (part 4)
@ 2021-10-21 22:55 Chang S. Bae
  2021-10-21 22:55 ` [PATCH 01/23] signal: Add an optional check for altstack size Chang S. Bae
                   ` (22 more replies)
  0 siblings, 23 replies; 60+ messages in thread
From: Chang S. Bae @ 2021-10-21 22:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: x86, tglx, dave.hansen, arjan, ravi.v.shankar, chang.seok.bae

This is the last part of the effort to support AMX. This series follows the
KVM part:
    https://lore.kernel.org/lkml/20211017151447.829495362@linutronix.de/

With AMX the FPU register state buffer which is part of
task_struct::thread::fpu is not going to be extended unconditionally for
all tasks on an AMX enabled system as that would waste minimum 8K per task.

AMX provides a mechanism to trap on first use. That trap will be utilized
to allocate a larger register state buffer when the task (process) has
permissions to use it. The default buffer task_struct will only carry
states up to AVX512.

The cost of XFD switching only matters for an AMX-enabled system. With the
cleanup of the KVM FPU handling, host-side XFD/AMX is completely
independent of guest-side XFD/AMX.

The per-task feature and size information helps to support dynamic features
organically compared to the old versions.

Each task has a unique sigframe length with dynamic features. sigaltstack()
has a new size checker to support a per-task sigframe size.

This version also fixes the syscall implementation and the XFD state
switching on hot paths.

Here is a summary of patches:

  - At first, add arch-specific sigaltstack size check

  - Establish a set of new syscalls to control dynamic XSTATE components

  - Update infrastructure to prepare dynamic features

  - Support XFD state and switching, and add buffer reallocation helpers

  - Finally, enable AMX with XFD #NM handling

This series is based on:

    git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu-3-kvm

and a revision of the version in the tglx tree -- some bug fixes, polish,
and addressing Dave Hansen's feedback (noted on each patch):

    git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu

This comes with a large selftest suite which is going to be posted
separately. A preview along with the full series is available here:

    git://github.com/intel/amx-linux.git amx

Thanks,
Chang

Chang S. Bae (15):
  x86/fpu/xstate: Provide xstate_calculate_size()
  x86/arch_prctl: Add controls for dynamic XSTATE components
  x86/fpu/signal: Prepare for variable sigframe length
  x86/fpu: Reset permission and fpstate on exec()
  x86/cpufeatures: Add eXtended Feature Disabling (XFD) feature bit
  x86/msr-index: Add MSRs for XFD
  x86/fpu: Add XFD state to fpstate
  x86/fpu: Update XFD state where required
  x86/fpu/xstate: Add XFD #NM handler
  x86/fpu/xstate: Add fpstate_realloc()/free()
  x86/fpu/xstate: Prepare XSAVE feature table for gaps in state
    component numbers
  x86/fpu/amx: Define AMX state components and have it used for
    boot-time checks
  x86/fpu: Calculate the default sizes independently
  x86/fpu: Add XFD handling for dynamic states
  x86/fpu/amx: Enable the AMX feature in 64-bit mode

Thomas Gleixner (8):
  signal: Add an optional check for altstack size
  x86/signal: Implement sigaltstack size validation
  x86/fpu: Add members to struct fpu to cache permission information
  x86/fpu: Add fpu_state_config::legacy_features
  x86/fpu: Add basic helpers for dynamically enabled features
  x86/signal: Use fpu::__state_user_size for sigalt stack validation
  x86/fpu: Prepare fpu_clone() for dynamically enabled features
  x86/fpu: Add sanity checks for XFD

 .../admin-guide/kernel-parameters.txt         |   9 +
 arch/Kconfig                                  |   3 +
 arch/x86/Kconfig                              |  17 +
 arch/x86/include/asm/cpufeatures.h            |   2 +
 arch/x86/include/asm/fpu/api.h                |  11 +
 arch/x86/include/asm/fpu/sched.h              |   2 +-
 arch/x86/include/asm/fpu/types.h              |  88 +++
 arch/x86/include/asm/fpu/xstate.h             |  21 +-
 arch/x86/include/asm/msr-index.h              |   2 +
 arch/x86/include/asm/proto.h                  |   2 +-
 arch/x86/include/uapi/asm/prctl.h             |   4 +
 arch/x86/kernel/cpu/cpuid-deps.c              |   2 +
 arch/x86/kernel/fpu/context.h                 |   2 +
 arch/x86/kernel/fpu/core.c                    |  93 ++-
 arch/x86/kernel/fpu/init.c                    |   9 +-
 arch/x86/kernel/fpu/internal.h                |   3 -
 arch/x86/kernel/fpu/signal.c                  |  70 +--
 arch/x86/kernel/fpu/xstate.c                  | 566 ++++++++++++++++--
 arch/x86/kernel/fpu/xstate.h                  |  61 +-
 arch/x86/kernel/process.c                     |  21 +-
 arch/x86/kernel/signal.c                      |  64 +-
 arch/x86/kernel/traps.c                       |  38 ++
 include/linux/signal.h                        |   6 +
 kernel/signal.c                               |  35 +-
 24 files changed, 1008 insertions(+), 123 deletions(-)


base-commit: 672f086122b67b299aa89c6b5f647c20ef84157f
--
2.17.1


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

end of thread, other threads:[~2021-10-28 13:10 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 22:55 [PATCH 00/23] x86: Support Intel Advanced Matrix Extensions (part 4) Chang S. Bae
2021-10-21 22:55 ` [PATCH 01/23] signal: Add an optional check for altstack size Chang S. Bae
2021-10-22  0:06   ` Bae, Chang Seok
2021-10-22 15:20   ` Eric W. Biederman
2021-10-22 20:58     ` Bae, Chang Seok
2021-10-22 22:51     ` Dave Hansen
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 02/23] x86/signal: Implement sigaltstack size validation Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 03/23] x86/fpu/xstate: Provide xstate_calculate_size() Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 04/23] x86/fpu: Add members to struct fpu to cache permission information Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 05/23] x86/fpu: Add fpu_state_config::legacy_features Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 06/23] x86/arch_prctl: Add controls for dynamic XSTATE components Chang S. Bae
2021-10-24 21:17   ` Borislav Petkov
2021-10-26  9:11     ` [PATCH] Documentation/x86: Add documentation for using dynamic XSTATE features Chang S. Bae
2021-10-26 16:16       ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-28 13:10       ` tip-bot2 for Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] x86/arch_prctl: Add controls for dynamic XSTATE components tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 07/23] x86/fpu: Add basic helpers for dynamically enabled features Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 08/23] x86/signal: Use fpu::__state_user_size for sigalt stack validation Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 09/23] x86/fpu/signal: Prepare for variable sigframe length Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 10/23] x86/fpu: Prepare fpu_clone() for dynamically enabled features Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 11/23] x86/fpu: Reset permission and fpstate on exec() Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 12/23] x86/cpufeatures: Add eXtended Feature Disabling (XFD) feature bit Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 13/23] x86/msr-index: Add MSRs for XFD Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 14/23] x86/fpu: Add XFD state to fpstate Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 15/23] x86/fpu: Add sanity checks for XFD Chang S. Bae
2021-10-25  8:11   ` Borislav Petkov
2021-10-25 20:15     ` Thomas Gleixner
2021-10-25  8:33   ` Mika Penttilä
2021-10-25 18:13     ` Thomas Gleixner
2021-10-25 19:57       ` Dave Hansen
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Thomas Gleixner
2021-10-21 22:55 ` [PATCH 16/23] x86/fpu: Update XFD state where required Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 17/23] x86/fpu/xstate: Add XFD #NM handler Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 18/23] x86/fpu/xstate: Add fpstate_realloc()/free() Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 19/23] x86/fpu/xstate: Prepare XSAVE feature table for gaps in state component numbers Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 20/23] x86/fpu/amx: Define AMX state components and have it used for boot-time checks Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 21/23] x86/fpu: Calculate the default sizes independently Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 22/23] x86/fpu: Add XFD handling for dynamic states Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2021-10-21 22:55 ` [PATCH 23/23] x86/fpu/amx: Enable the AMX feature in 64-bit mode Chang S. Bae
2021-10-26 16:16   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.