mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)
@ 2016-04-21 11:43 Paul Burton
  2016-04-21 11:43 ` [PATCH 2/2] MIPS: Force CPUs to lose FP context during mode switches Paul Burton
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Burton @ 2016-04-21 11:43 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle
  Cc: Paul Burton, stable # v4 . 0+,
	Adam Buchbinder, linux-kernel, James Hogan

Whilst a PR_SET_FP_MODE prctl is performed there are decisions made
based upon whether the task is executing on the current CPU. This may
change if we're preempted, so disable preemption to avoid such changes
for the lifetime of the mode switch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: 9791554b45a2 ("MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS")
Cc: stable <stable@vger.kernel.org> # v4.0+
---

 arch/mips/kernel/process.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 92880ce..ce55ea0 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -601,6 +601,9 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
 	if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6)
 		return -EOPNOTSUPP;
 
+	/* Proceed with the mode switch */
+	preempt_disable();
+
 	/* Save FP & vector context, then disable FPU & MSA */
 	if (task->signal == current->signal)
 		lose_fpu(1);
@@ -659,6 +662,7 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
 
 	/* Allow threads to use FP again */
 	atomic_set(&task->mm->context.fp_mode_switching, 0);
+	preempt_enable();
 
 	return 0;
 }
-- 
2.8.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-10 20:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21 11:43 [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...) Paul Burton
2016-04-21 11:43 ` [PATCH 2/2] MIPS: Force CPUs to lose FP context during mode switches Paul Burton
2016-04-22 16:06   ` Maciej W. Rozycki
2016-04-22 16:00 ` [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...) Maciej W. Rozycki
2016-05-10 19:32 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®