[RFC PATCH 00/10] x86: Allocate AVX512 xstate ondemand

From: Jiaxun Yang
Date: Thu Dec 02 2021 - 19:36:50 EST


This series makes allocation of AVX512 xstate buffer ondemand.
It can save some memory (~2k for a thread not using AVX512).

Also we are going to have heterogeneous processors that
only some cores support AVX512, it can be helpful when
dealing with such processors.

Patch 1~6 are some preparations.
Patch 7 moves reallocation of xstate buffer to save_fpregs_to_fpstate.
Patch 8~10 are some cleanup and enablement work.

Tested on a Skylake-X system with AVX512 intensive y-cruncher and numpy,
the performance impact seems neglectable.

Any sugguestions are welcomed.

Cheers!
---
Jiaxun Yang
Year 1 ECS Undergraduate
University of Edinburgh

Jiaxun Yang (10):
x86/fpu: Remove duplicated declaration of __fpu_state_size_dynamic
x86/fpu: Split fpu_xfd_enabled from fpu_state_size_dynamic
x86/fpu: Calculate xsave state addr on fly
x86/fpu: Remove xstate_comp_offsets cache
x86/fpu: Cache xstate_is_aligned
x86/fpu/xcr: Return all enabled xfeature if CPU doesn't support
x86/fpu: Rellocate fpstate on save_fpregs_to_fpstate
x86/fpu: Don't keep state_size in perm struct
x86/fpu: Split out XFEATURE_MASK_KERNEL_DYNAMIC
x86/fpu: Mark AVX512 xfeatures as kernel dynamic

arch/x86/include/asm/fpu/types.h | 8 -
arch/x86/include/asm/fpu/xcr.h | 16 +-
arch/x86/include/asm/fpu/xstate.h | 19 +-
arch/x86/kernel/fpu/core.c | 21 ++-
arch/x86/kernel/fpu/xstate.c | 281 ++++++++++++++----------------
arch/x86/kernel/fpu/xstate.h | 3 +-
6 files changed, 181 insertions(+), 167 deletions(-)

--
2.30.2