Skip to content

Commit 76deabd

Browse files
David HildenbrandIngo Molnar
authored andcommitted
sched/preempt, MIPS: Properly lock access to the FPU
Let's always disable preemption and pagefaults when locking the fpu, so we can be sure that the owner won't change in between. This is a preparation for pagefault_disable() not touching preemption anymore. Reviewed-and-tested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: David.Laight@ACULAB.COM Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: airlied@linux.ie Cc: akpm@linux-foundation.org Cc: benh@kernel.crashing.org Cc: bigeasy@linutronix.de Cc: borntraeger@de.ibm.com Cc: daniel.vetter@intel.com Cc: heiko.carstens@de.ibm.com Cc: herbert@gondor.apana.org.au Cc: hocko@suse.cz Cc: hughd@google.com Cc: mst@redhat.com Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: schwidefsky@de.ibm.com Cc: yang.shi@windriver.com Link: http://lkml.kernel.org/r/1431359540-32227-15-git-send-email-dahi@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 5f76eea commit 76deabd

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

arch/mips/kernel/signal-common.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ extern void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
2828
extern int fpcsr_pending(unsigned int __user *fpcsr);
2929

3030
/* Make sure we will not lose FPU ownership */
31-
#ifdef CONFIG_PREEMPT
32-
#define lock_fpu_owner() preempt_disable()
33-
#define unlock_fpu_owner() preempt_enable()
34-
#else
35-
#define lock_fpu_owner() pagefault_disable()
36-
#define unlock_fpu_owner() pagefault_enable()
37-
#endif
31+
#define lock_fpu_owner() ({ preempt_disable(); pagefault_disable(); })
32+
#define unlock_fpu_owner() ({ pagefault_enable(); preempt_enable(); })
3833

3934
#endif /* __SIGNAL_COMMON_H */

0 commit comments

Comments
 (0)