x86/fpu: Get rid of the FNSAVE optimization
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:02:00 +0000 (14:02 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 16:29:41 +0000 (18:29 +0200)
commit08ded2cd18a09749e67a14426aa7fd1b04ab1dc0
treecf46a31c1b58712349b0e5c8a7e5dad06b310659
parentebe7234b08a42d69bae94c4062a84777ea26ef99
x86/fpu: Get rid of the FNSAVE optimization

The FNSAVE support requires conditionals in quite some call paths because
FNSAVE reinitializes the FPU hardware. If the save has to preserve the FPU
register state then the caller has to conditionally restore it from memory
when FNSAVE is in use.

This also requires a conditional in context switch because the restore
avoidance optimization cannot work with FNSAVE. As this only affects 20+
years old CPUs there is really no reason to keep this optimization
effective for FNSAVE. It's about time to not optimize for antiques anymore.

Just unconditionally FRSTOR the save content to the registers and clean up
the conditionals all over the place.

Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121454.617369268@linutronix.de
arch/x86/include/asm/fpu/internal.h
arch/x86/kernel/fpu/core.c