diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2007-04-16 16:19:44 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-04-20 15:58:37 +0200 |
commit | faea62346444ce5b1dba8fb5291d95b676522c42 (patch) | |
tree | d00e53763ca9b145348e5754aaf0cd4dcbb12123 /include/asm-mips/fpu.h | |
parent | [MIPS] Disallow CpU exception in kernel again. (diff) | |
download | linux-faea62346444ce5b1dba8fb5291d95b676522c42.tar.xz linux-faea62346444ce5b1dba8fb5291d95b676522c42.zip |
[MIPS] Retry {save,restore}_fp_context if failed in atomic context.
The save_fp_context()/restore_fp_context() might sleep on accessing
user stack and therefore might lose FPU ownership in middle of them.
If these function failed due to "in_atomic" test in do_page_fault,
touch the sigcontext area in non-atomic context and retry these
save/restore operation.
This is a replacement of a (broken) fix which was titled "Allow CpU
exception in kernel partially".
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips/fpu.h')
-rw-r--r-- | include/asm-mips/fpu.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h index 71436f90203f..b414a7d9db43 100644 --- a/include/asm-mips/fpu.h +++ b/include/asm-mips/fpu.h @@ -100,14 +100,19 @@ static inline void __own_fpu(void) set_thread_flag(TIF_USEDFPU); } -static inline void own_fpu(int restore) +static inline void own_fpu_inatomic(int restore) { - preempt_disable(); if (cpu_has_fpu && !__is_fpu_owner()) { __own_fpu(); if (restore) _restore_fp(current); } +} + +static inline void own_fpu(int restore) +{ + preempt_disable(); + own_fpu_inatomic(restore); preempt_enable(); } |