On Sat, Mar 10, 2007 at 01:28:11AM +0900, Atsushi Nemoto wrote:
> The save_fp_context()/restore_fp_context() might sleep on accessing
> user stack and therefore might lose FPU ownership in middle of them.
> Also we should not disable preempt around these functions. This patch
> files this problem by allowing CpU exception in kernel partially.
> * Introduce TIF_ALLOW_FP_IN_KERNEL thread flag. If the flag was set,
> CpU exception handler enables CU1 bit in interrupted kernel context
> and returns without enabling interrupt (preempt) to make sure keep
> FPU ownership until resume.
> * Introduce enable_fp_in_kernel() and disable_fp_in_kernel(). While
> we might lost FPU ownership in middle of CP0_STATUS manipulation
> (for example local_irq_disable()), we can not assume CU1 bit always
> reflects TIF_USEDFPU. Therefore enable_fp_in_kernel() must drop CU1
> bit if TIF_USEDFPU was cleared.
> * The resume() function must drop CU1 bit in CP0_STATUS which are to
> be saved.
Applied as well. Thanks,