Commit-ID:  76deabd1867d6d2895152f31fdec819e3505738b
Gitweb:     http://git.kernel.org/tip/76deabd1867d6d2895152f31fdec819e3505738b
Author:     David Hildenbrand <d...@linux.vnet.ibm.com>
AuthorDate: Mon, 11 May 2015 17:52:19 +0200
Committer:  Ingo Molnar <mi...@kernel.org>
CommitDate: Tue, 19 May 2015 08:39:18 +0200

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 <t...@linutronix.de>
Signed-off-by: David Hildenbrand <d...@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>
Cc: david.lai...@aculab.com
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: airl...@linux.ie
Cc: a...@linux-foundation.org
Cc: b...@kernel.crashing.org
Cc: bige...@linutronix.de
Cc: borntrae...@de.ibm.com
Cc: daniel.vet...@intel.com
Cc: heiko.carst...@de.ibm.com
Cc: herb...@gondor.apana.org.au
Cc: ho...@suse.cz
Cc: hu...@google.com
Cc: m...@redhat.com
Cc: pau...@samba.org
Cc: r...@linux-mips.org
Cc: schwidef...@de.ibm.com
Cc: yang....@windriver.com
Link: 
http://lkml.kernel.org/r/1431359540-32227-15-git-send-email-d...@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 arch/mips/kernel/signal-common.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 06805e0..0b85f82 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -28,12 +28,7 @@ extern void __user *get_sigframe(struct ksignal *ksig, 
struct pt_regs *regs,
 extern int fpcsr_pending(unsigned int __user *fpcsr);
 
 /* Make sure we will not lose FPU ownership */
-#ifdef CONFIG_PREEMPT
-#define lock_fpu_owner()       preempt_disable()
-#define unlock_fpu_owner()     preempt_enable()
-#else
-#define lock_fpu_owner()       pagefault_disable()
-#define unlock_fpu_owner()     pagefault_enable()
-#endif
+#define lock_fpu_owner()       ({ preempt_disable(); pagefault_disable(); })
+#define unlock_fpu_owner()     ({ pagefault_enable(); preempt_enable(); })
 
 #endif /* __SIGNAL_COMMON_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to