diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2007-04-16 10:19:44 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-04-20 09:58:37 -0400 |
commit | faea62346444ce5b1dba8fb5291d95b676522c42 (patch) | |
tree | d00e53763ca9b145348e5754aaf0cd4dcbb12123 /include/asm-mips/fpu.h | |
parent | 5323180db75d562a287cb2020b07c9422df13df6 (diff) |
[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 71436f90203..b414a7d9db4 100644 --- a/include/asm-mips/fpu.h +++ b/include/asm-mips/fpu.h | |||
@@ -100,14 +100,19 @@ static inline void __own_fpu(void) | |||
100 | set_thread_flag(TIF_USEDFPU); | 100 | set_thread_flag(TIF_USEDFPU); |
101 | } | 101 | } |
102 | 102 | ||
103 | static inline void own_fpu(int restore) | 103 | static inline void own_fpu_inatomic(int restore) |
104 | { | 104 | { |
105 | preempt_disable(); | ||
106 | if (cpu_has_fpu && !__is_fpu_owner()) { | 105 | if (cpu_has_fpu && !__is_fpu_owner()) { |
107 | __own_fpu(); | 106 | __own_fpu(); |
108 | if (restore) | 107 | if (restore) |
109 | _restore_fp(current); | 108 | _restore_fp(current); |
110 | } | 109 | } |
110 | } | ||
111 | |||
112 | static inline void own_fpu(int restore) | ||
113 | { | ||
114 | preempt_disable(); | ||
115 | own_fpu_inatomic(restore); | ||
111 | preempt_enable(); | 116 | preempt_enable(); |
112 | } | 117 | } |
113 | 118 | ||