[RFC patch 13/15] arm64/entry: Move FPU restore out of exit_to_usermode() loop

From: Thomas Gleixner
Date: Thu Sep 19 2019 - 11:10:05 EST


Restoring the FPU is not required to be insided the loop. The final point
to do that is before returning to user space. Move it there.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/arm64/include/asm/entry-common.h | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

--- a/arch/arm64/include/asm/entry-common.h
+++ b/arch/arm64/include/asm/entry-common.h
@@ -7,8 +7,6 @@

#include <asm/daifflags.h>

-#define ARCH_EXIT_TO_USERMODE_WORK (_TIF_FOREIGN_FPSTATE)
-
static inline void local_irq_enable_exit_to_user(unsigned long ti_work)
{
if (ti_work & _TIF_NEED_RESCHED)
@@ -24,15 +22,14 @@ static inline void local_irq_disable_exi
}
#define local_irq_disable_exit_to_user local_irq_disable_exit_to_user

-static inline void arch_exit_to_usermode_work(struct pt_regs *regs,
- unsigned long ti_work)
+static inline void arch_exit_to_usermode(struct pt_regs *regs,
+ unsigned long ti_work)
{
- /* Must this be inside the work loop ? */
if (ti_work & _TIF_FOREIGN_FPSTATE)
fpsimd_restore_current_state();

}
-#define arch_exit_to_usermode_work arch_exit_to_usermode_work
+#define arch_exit_to_usermode arch_exit_to_usermode

enum ptrace_syscall_dir {
PTRACE_SYSCALL_ENTER = 0,