OSDN Git Service

MIPS: Properly disable FPU in start_thread()
authorJames Hogan <james.hogan@imgtec.com>
Mon, 1 Feb 2016 13:50:36 +0000 (13:50 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 1 Feb 2016 22:36:03 +0000 (23:36 +0100)
commit76e5846d3bdf59eb1010d5607003da2dc3910bb1
tree2d65784119d5a2b61b6af9b0c255ad111110cb35
parentf4dce1ffd2e30fa31756876ef502ce6d2324be35
MIPS: Properly disable FPU in start_thread()

start_thread() (called for execve(2)) clears the TIF_USEDFPU flag
without atomically disabling the FPU. With a preemptive kernel, an
unfortunately timed preemption after this could result in another
task (or KVM guest) being scheduled in with the FPU still enabled, since
lose_fpu_inatomic() only turns it off if TIF_USEDFPU is set.

Use lose_fpu(0) instead of the separate FPU / MSA management, which
should do the right thing (drop FPU properly and atomically without
saving state) and will be more future proof.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12302/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/process.c