fpregs_assert_state_consistent() does nothing if TIF_NEED_FPU_LOAD is set.
But in that case the FPU *will* be loaded very soon; move the checks
after the load, thus ensuring that they are performed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kernel/fpu/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index c802321acb5d..28d1d25f62d4 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -860,10 +860,10 @@ void fpregs_lock_and_load(void)
fpregs_lock();
- fpregs_assert_state_consistent();
-
if (test_thread_flag(TIF_NEED_FPU_LOAD))
fpregs_restore_userregs();
+
+ fpregs_assert_state_consistent();
}
void fpu_load_guest_fpstate(struct fpu_guest *gfpu)
--
2.52.0