Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1384126 > unrolled thread

[PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)

Started byPaul Burton <paul.burton@imgtec.com>
First post2016-04-21 13:50 +0200
Last post2016-04-22 18:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...) Paul Burton <paul.burton@imgtec.com> - 2016-04-21 13:50 +0200
    Re: [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE,  ...) "Maciej W. Rozycki" <macro@imgtec.com> - 2016-04-22 18:10 +0200

#1384126 — [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)

FromPaul Burton <paul.burton@imgtec.com>
Date2016-04-21 13:50 +0200
Subject[PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)
Message-ID<rqlhn-8vU-9@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1385331 — Re: [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)

From"Maciej W. Rozycki" <macro@imgtec.com>
Date2016-04-22 18:10 +0200
SubjectRe: [PATCH 1/2] MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)
Message-ID<rqLOy-4Dw-17@gated-at.bofh.it>
In reply to#1384126
On Thu, 21 Apr 2016, Paul Burton wrote:

> 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.

Reviewed-by: Maciej W. Rozycki <macro@imgtec.com>

 Thanks!

  Maciej

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web