linux/debian/patches/features/all/rt/0013-mips-properly-lock-acc...

35 lines
1.3 KiB
Diff

From: David Hildenbrand <dahi@linux.vnet.ibm.com>
Date: Mon, 11 May 2015 17:52:19 +0200
Subject: sched/preempt, MIPS: Properly lock access to the FPU
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.1/patches-4.1.3-rt3.tar.xz
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.
[upstream commit 76deabd1867d6d2895152f31fdec819e3505738b]
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
---
arch/mips/kernel/signal-common.h | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -28,12 +28,7 @@ extern void __user *get_sigframe(struct
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 */