Loading arch/x86/kernel/i387.c +6 −5 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ void kernel_fpu_enable(void) * be set (so that the clts/stts pair does nothing that is * visible in the interrupted kernel thread). * * Except for the eagerfpu case when we return 1 unless we've already * been eager and saved the state in kernel_fpu_begin(). * Except for the eagerfpu case when we return true; in the likely case * the thread has FPU but we are not going to set/clear TS. */ static inline bool interrupted_kernel_fpu_idle(void) { Loading @@ -50,7 +50,7 @@ static inline bool interrupted_kernel_fpu_idle(void) return false; if (use_eager_fpu()) return __thread_has_fpu(current); return true; return !__thread_has_fpu(current) && (read_cr0() & X86_CR0_TS); Loading Loading @@ -93,8 +93,9 @@ void __kernel_fpu_begin(void) if (__thread_has_fpu(me)) { __save_init_fpu(me); } else if (!use_eager_fpu()) { } else { this_cpu_write(fpu_owner_task, NULL); if (!use_eager_fpu()) clts(); } } Loading arch/x86/kernel/process.c +7 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ void flush_thread(void) flush_ptrace_hw_breakpoint(tsk); memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); drop_init_fpu(tsk); /* * Free the FPU state for non xsave platforms. They get reallocated Loading @@ -137,6 +138,12 @@ void flush_thread(void) */ if (!use_eager_fpu()) free_thread_xstate(tsk); else if (!used_math()) { /* kthread execs. TODO: cleanup this horror. */ if (WARN_ON(init_fpu(current))) force_sig(SIGKILL, current); math_state_restore(); } } static void hard_disable_TSC(void) Loading arch/x86/kernel/xsave.c +1 −12 Original line number Diff line number Diff line Loading @@ -688,7 +688,7 @@ void eager_fpu_init(void) { static __refdata void (*boot_func)(void) = eager_fpu_init_bp; clear_used_math(); WARN_ON(used_math()); current_thread_info()->status = 0; if (eagerfpu == ENABLE) Loading @@ -703,17 +703,6 @@ void eager_fpu_init(void) boot_func(); boot_func = NULL; } /* * This is same as math_state_restore(). But use_xsave() is * not yet patched to use math_state_restore(). */ init_fpu(current); __thread_fpu_begin(current); if (cpu_has_xsave) xrstor_state(init_xstate_buf, -1); else fxrstor_checking(&init_xstate_buf->i387); } /* Loading Loading
arch/x86/kernel/i387.c +6 −5 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ void kernel_fpu_enable(void) * be set (so that the clts/stts pair does nothing that is * visible in the interrupted kernel thread). * * Except for the eagerfpu case when we return 1 unless we've already * been eager and saved the state in kernel_fpu_begin(). * Except for the eagerfpu case when we return true; in the likely case * the thread has FPU but we are not going to set/clear TS. */ static inline bool interrupted_kernel_fpu_idle(void) { Loading @@ -50,7 +50,7 @@ static inline bool interrupted_kernel_fpu_idle(void) return false; if (use_eager_fpu()) return __thread_has_fpu(current); return true; return !__thread_has_fpu(current) && (read_cr0() & X86_CR0_TS); Loading Loading @@ -93,8 +93,9 @@ void __kernel_fpu_begin(void) if (__thread_has_fpu(me)) { __save_init_fpu(me); } else if (!use_eager_fpu()) { } else { this_cpu_write(fpu_owner_task, NULL); if (!use_eager_fpu()) clts(); } } Loading
arch/x86/kernel/process.c +7 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ void flush_thread(void) flush_ptrace_hw_breakpoint(tsk); memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); drop_init_fpu(tsk); /* * Free the FPU state for non xsave platforms. They get reallocated Loading @@ -137,6 +138,12 @@ void flush_thread(void) */ if (!use_eager_fpu()) free_thread_xstate(tsk); else if (!used_math()) { /* kthread execs. TODO: cleanup this horror. */ if (WARN_ON(init_fpu(current))) force_sig(SIGKILL, current); math_state_restore(); } } static void hard_disable_TSC(void) Loading
arch/x86/kernel/xsave.c +1 −12 Original line number Diff line number Diff line Loading @@ -688,7 +688,7 @@ void eager_fpu_init(void) { static __refdata void (*boot_func)(void) = eager_fpu_init_bp; clear_used_math(); WARN_ON(used_math()); current_thread_info()->status = 0; if (eagerfpu == ENABLE) Loading @@ -703,17 +703,6 @@ void eager_fpu_init(void) boot_func(); boot_func = NULL; } /* * This is same as math_state_restore(). But use_xsave() is * not yet patched to use math_state_restore(). */ init_fpu(current); __thread_fpu_begin(current); if (cpu_has_xsave) xrstor_state(init_xstate_buf, -1); else fxrstor_checking(&init_xstate_buf->i387); } /* Loading