Introduce CET supervisor state support
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest6 patches 7 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | x86/fpu/xstate: Always preserve non-user xfeatures/flags in __state_permarch/ | +11 | 0 replies | |
| 2/6 | x86/fpu/xstate: Add CET supervisor mode state supportarch/ arch/ arch/ | +20 | 0 replies | |
| 3/6 | x86/fpu/xstate: Introduce XFEATURE_MASK_KERNEL_DYNAMIC xfeature setarch/ arch/ | +5 | 0 replies | |
| 4/6 | x86/fpu/xstate: Introduce fpu_guest_cfg for guest FPU configurationarch/ arch/ arch/ | +22 | 0 replies | |
| 5/6 | x86/fpu/xstate: Create guest fpstate with guest specific configarch/ | +30 | 0 replies | |
| 6/6 | x86/fpu/xstate: Warn if CET supervisor state is detected in normal fpstatearch/ | +2 | 0 replies |
Reviews trailers per patch
5 of 6 patches have a Reviewed-by or Acked-by.
| Patch | Rick Edgecombe | Maxim Levitsky |
|---|---|---|
| 1/6 | R-b | R-b |
| 2/6 | R-b | R-b |
| 3/6 | R-b | |
| 4/6 | R-b | R-b |
| 5/6 | R-b | R-b |
| 6/6 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/6] Introduce CET supervisor state support
This series spins off from CET KVM virtualization enabling series [1]. The purpose is to get these preparation work resolved ahead of KVM part landing. There was a discussion about introducing CET supervisor state support [2] [3].
CET supervisor state, i.e., IA32_PL{0,1,2}_SSP, are xsave-managed MSRs, it can be enabled via IA32_XSS[bit 12]. KVM relies on host side CET supervisor state support to fully enable guest CET MSR contents storage. The benefits are: 1) No need to manually save/restore the 3 MSRs when vCPU fpu context is sched in/out. 2) Omit manually swapping the three MSRs at VM-Exit/VM-Entry for guest/host. 3) Make guest CET user/supervisor states managed in a consistent manner within host kernel FPU framework.
This series tries to:
1) Fix existing issue regarding enabling guest supervisor states support.
2) Add CET supervisor state support in core kernel.
3) Introduce new FPU config for guest fpstate setup.
With the preparation work landed, for guest fpstate, we have xstate_bv[12] == xcomp_bv[12] == 1 and CET supervisor state is saved/reloaded when xsaves/xrstors executes on guest fpstate.
For non-guest/normal fpstate, we have xstate_bv[12] == xcomp_bv[12] == 0, then HW can optimize xsaves/xrstors operations.
Patch1: Preserve guest supervisor xfeatures in __state_perm.
Patch2: Enable CET supervisor xstate support.
Patch3: Introduce kernel dynamic xfeature set.
Patch4: Initialize fpu_guest_cfg settings.
Patch5: Create guest fpstate with fpu_guest_cfg.
Patch6: Check invalid fpstate config before executes xsaves.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
[3]: https://lore.kernel.org/all/[email protected]/
Sean Christopherson (1):
x86/fpu/xstate: Always preserve non-user xfeatures/flags in
__state_perm
Yang Weijiang (5):
x86/fpu/xstate: Add CET supervisor mode state support x86/fpu/xstate: Introduce XFEATURE_MASK_KERNEL_DYNAMIC xfeature set x86/fpu/xstate: Introduce fpu_guest_cfg for guest FPU configuration x86/fpu/xstate: Create guest fpstate with guest specific config x86/fpu/xstate: Warn if CET supervisor state is detected in normal
fpstate
arch/x86/include/asm/fpu/types.h | 16 ++++++++-- arch/x86/include/asm/fpu/xstate.h | 11 ++++--- arch/x86/kernel/fpu/core.c | 53 ++++++++++++++++++++++++------- arch/x86/kernel/fpu/xstate.c | 35 +++++++++++++++----- arch/x86/kernel/fpu/xstate.h | 2 ++ 5 files changed, 90 insertions(+), 27 deletions(-)
base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0
Signature · 1 line
2.43.0