This function is a misnomer on two levels:
1) it doesn't really manipulate TS on modern CPUs anymore, its
primary purpose is to save FPU state, used:
- when executing fork()/clone(): to copy current FPU state
to the child's FPU state.
- when handling math exceptions: to generate the math error
si_code in the signal frame.
2) even on legacy CPUs it doesn't actually 'unlazy', if then
it lazies the FPU state: as a side effect of the old FNSAVE
instruction which clears (destroys) FPU state it's necessary
to set CR0::TS.
So rename it to fpu__save() to better reflect its purpose.
Reviewed-by: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
struct fpu *dfpu = &dst->thread.fpu;
struct fpu *sfpu = &src->thread.fpu;
- unlazy_fpu(src);
+ fpu__save(src);
memcpy(dfpu->state, sfpu->state, xstate_size);
}
}
return current->thread.fpu.has_fpu;
}
-extern void unlazy_fpu(struct task_struct *tsk);
+extern void fpu__save(struct task_struct *tsk);
#endif /* __ASSEMBLY__ */
}
EXPORT_SYMBOL(__kernel_fpu_end);
-void unlazy_fpu(struct task_struct *tsk)
+void fpu__save(struct task_struct *tsk)
{
preempt_disable();
if (__thread_has_fpu(tsk)) {
}
preempt_enable();
}
-EXPORT_SYMBOL(unlazy_fpu);
+EXPORT_SYMBOL(fpu__save);
unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu;
unsigned int xstate_size;
if (tsk_used_math(tsk)) {
if (cpu_has_fpu && tsk == current)
- unlazy_fpu(tsk);
+ fpu__save(tsk);
task_disable_lazy_fpu_restore(tsk);
return 0;
}
/*
* Save the info for the exception handler and clear the error.
*/
- unlazy_fpu(task);
+ fpu__save(task);
task->thread.trap_nr = trapnr;
task->thread.error_code = error_code;
info.si_signo = SIGFPE;