x86/fpu: Use restore_init_xstate() instead of math_state_restore() on kthread exec
authorOleg Nesterov <oleg@redhat.com>
Wed, 11 Mar 2015 17:34:49 +0000 (18:34 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 23 Mar 2015 09:13:58 +0000 (10:13 +0100)
Change flush_thread() to do user_fpu_begin() and restore_init_xstate()
instead of math_state_restore().

Note: "TODO: cleanup this horror" is still valid. We do not need
init_fpu() at all, we only need fpu_alloc() and memset(0). But this
needs other changes, in particular user_fpu_begin() should set
used_math().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Link: http://lkml.kernel.org/r/20150311173449.GE5032@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/process.c

index dcaf4b00d0b463c2d47e499684c3ff0d660281a4..6b058296a4569109ee0129af5ca827d61ee16aab 100644 (file)
@@ -143,7 +143,8 @@ void flush_thread(void)
                /* kthread execs. TODO: cleanup this horror. */
                if (WARN_ON(init_fpu(current)))
                        force_sig(SIGKILL, current);
-               math_state_restore();
+               user_fpu_begin();
+               restore_init_xstate();
        }
 }