Skip to contentSkip to conversation

Patch "MIPS: Avoid a BUG warning during prctl(PR_SET_FP_MODE, ...)" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 27, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

MIPS: Avoid a BUG warning during prctl(PR_SET_FP_MODE, ...)

to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-avoid-a-bug-warning-during-prctl-pr_set_fp_mode.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From b244614a60ab7ce54c12a9cbe15cfbf8d79d0967 Mon Sep 17 00:00:00 2001

From: Marcin Nowakowski <[email protected]>
Date: Wed, 31 Aug 2016 12:33:23 +0200
Subject: MIPS: Avoid a BUG warning during prctl(PR_SET_FP_MODE, ...)

From: Marcin Nowakowski <[email protected]>

commit b244614a60ab7ce54c12a9cbe15cfbf8d79d0967 upstream.

cpu_has_fpu macro uses smp_processor_id() and is currently executed with preemption enabled, that triggers the warning at runtime.

It is assumed throughout the kernel that if any CPU has an FPU, then all CPUs would have an FPU as well, so it is safe to perform the check with preemption enabled - change the code to use raw_ variant of the check to avoid the warning.

Patchwork: https://patchwork.linux-mips.org/patch/14125/

---
 arch/mips/kernel/process.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/kernel/process.c +4 -4
@@ -591,14 +591,14 @@ int mips_set_process_fp_mode(struct task
 		return -EOPNOTSUPP;
 
 	/* Avoid inadvertently triggering emulation */
-	if ((value & PR_FP_MODE_FR) && cpu_has_fpu &&
-	    !(current_cpu_data.fpu_id & MIPS_FPIR_F64))
+	if ((value & PR_FP_MODE_FR) && raw_cpu_has_fpu &&
+	    !(raw_current_cpu_data.fpu_id & MIPS_FPIR_F64))
 		return -EOPNOTSUPP;
-	if ((value & PR_FP_MODE_FRE) && cpu_has_fpu && !cpu_has_fre)
+	if ((value & PR_FP_MODE_FRE) && raw_cpu_has_fpu && !cpu_has_fre)
 		return -EOPNOTSUPP;
 
 	/* FR = 0 not supported in MIPS R6 */
-	if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6)
+	if (!(value & PR_FP_MODE_FR) && raw_cpu_has_fpu && cpu_has_mips_r6)
 		return -EOPNOTSUPP;
 
 	/* Proceed with the mode switch */

Patches currently in stable-queue which might be from [email protected] are

queue-4.7/mips-avoid-a-bug-warning-during-prctl-pr_set_fp_mode.patch