[patch 00/41] x86/fpu: Spring cleaning and PKRU sanitizing

From: Thomas Gleixner
Date: Fri Jun 11 2021 - 12:44:02 EST


This is a follow up to these patch series:

- [patch V2 00/14] x86/fpu: Mop up XSAVES and related damage
https://lore.kernel.org/r/20210605234742.712464974@xxxxxxxxxxxxx

- [PATCH 00/18] x86/pkeys: stop managing PKRU with XSAVE
https://lore.kernel.org/r/20210603230803.31660AFE@xxxxxxxxxxxxxxxxxx

- [PATCH 0/2] x86/fpu: Clean up "dynamic" APIs
https://lore.kernel.org/r/cover.1623388344.git.luto@xxxxxxxxxx

The analysis of the subtle bugs in the FPU code triggered a larger
discussion about the general state of this code. The above patch series are
all related to this and the following series combines them into one because
the already started consolidation work and the PKRU rework collided all
over the place.

The main parts of this series are:

- Simplification and removal/replacement of redundant and/or
overengineered code.

- Name space cleanup as the existing names were just a permanent source
of confusion.

- Clear seperation of user ABI and kernel internal state handling.

- Removal of PKRU from being XSTATE managed in the kernel because PKRU
has to be eagerly restored on context switch and keeping it in sync
in the xstate buffer is just pointless overhead and fragile.

The kernel still XSAVEs PKRU on context switch but the value in the
buffer is not longer used and never restored from the buffer.

This still needs to be cleaned up, but the series is already 40+
patches large and the cleanup of this is not a functional problem.

The functional issues of PKRU management are fully addressed with the
series as is.

It applies on top of

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master

and is also available via git:

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

Thanks,

tglx
---
arch/x86/events/intel/lbr.c | 6
arch/x86/include/asm/fpu/internal.h | 155 ++++-------
arch/x86/include/asm/fpu/xstate.h | 61 +++-
arch/x86/include/asm/pgtable.h | 57 ----
arch/x86/include/asm/pkeys.h | 9
arch/x86/include/asm/processor.h | 9
arch/x86/include/asm/special_insns.h | 14 -
arch/x86/kernel/cpu/common.c | 29 --
arch/x86/kernel/fpu/core.c | 243 ++++++++++++------
arch/x86/kernel/fpu/init.c | 4
arch/x86/kernel/fpu/regset.c | 116 ++++----
arch/x86/kernel/fpu/signal.c | 59 ++--
arch/x86/kernel/fpu/xstate.c | 456 +++++++++++------------------------
arch/x86/kernel/process.c | 19 +
arch/x86/kernel/process_64.c | 28 ++
arch/x86/kvm/svm/sev.c | 1
arch/x86/kvm/x86.c | 52 ++-
arch/x86/mm/extable.c | 2
arch/x86/mm/fault.c | 2
arch/x86/mm/pkeys.c | 22 -
b/arch/x86/include/asm/pkru.h | 62 ++++
include/linux/pkeys.h | 4
22 files changed, 671 insertions(+), 739 deletions(-)