x86/fpu: Cure supervisor mode (ENQCMD) fallout
Status from this message: The following commit has been merged into the x86/urgent branch of tip:
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | x86/fpu: Remove redundant XCOMP_BV initializationarch/ | +0 | 0 replies | |
| 2/7 | x86/fpu: Remove unused supervisor only offsetsarch/ | +0 | 0 replies | |
| 3/7 | x86/fpu/xsave: Initialize offset/size cache earlyarch/ | +5 | 0 replies | |
| 4/7 | x86/fpu: Cache xfeature flags from CPUIDarch/ | +13 | 0 replies | |
| 5/7 | x86/fpu/xsave: Handle compacted offsets correctly with supervisor statesarch/ | +41 | 0 replies | |
| 6/7 | x86/fpu/xstate: Handle supervisor states in XSTATE permissionsarch/ | +3 | 0 replies | |
| 7/7 | x86/fpu/xstate: Consolidate size calculationsarch/ | +5 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [patch 0/7] x86/fpu: Cure supervisor mode (ENQCMD) fallout
Folks!
The (re)enabling of ENQCMD or the enabling of any supervisor only state results in a possible inconsistency of the host and guest FPU XSTATE layout on systems which support that feature.
The reason is that on the host the FPU state has to include supervisor features while the guest FPU state is strictly user features only.
The problem is restricted to a few places:
1) The size calculation in the dynamic state permission PRCTL which lacks adding the supervisor state size for calculating the kernel buffer size.
2) The offset calculations in the copy to/from UABI functions which use precalculated offsets which are only valid for the host.
The cure is to use runtime calculation for the offsets based on the XCOMP_BV bitmask in the XSTATE header in case of compacted buffers. For non-compacted format nothing changes.
The following series addresses this and it turns out to be an overall valuable cleanup and simplification of the code:
core.c | 3 xstate.c | 211 ++++++++++++++++++--------------------------------------------- 2 files changed, 62 insertions(+), 152 deletions(-)
The result of the consolidation of the buffer size calculation (last patch in the series) is a significant reduction of cycles spent for initializing XSTATE due to the avoidance of a gazillion redundant CPUID invocations:
Before: XSTATE init: 174344 cycles
After: XSTATE init: 73890 cycles
It builds, boots on host and guest, but is not yet extensively tested. Testing with a AMX + PASID enabled machine has not been done at all as I don't have easy access to such a beast.
The series is based on:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
and available from git:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu
Thanks,
tglx