Skip to content

Commit b244614

Browse files
MJNowakowskiralfbaechle
authored andcommitted
MIPS: Avoid a BUG warning during prctl(PR_SET_FP_MODE, ...)
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. Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com> Cc: linux-mips@linux-mips.org Cc: stable@vger.kernel.org # 4.0+ Patchwork: https://patchwork.linux-mips.org/patch/14125/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 801f823 commit b244614

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/mips/kernel/process.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,14 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
605605
return -EOPNOTSUPP;
606606

607607
/* Avoid inadvertently triggering emulation */
608-
if ((value & PR_FP_MODE_FR) && cpu_has_fpu &&
609-
!(current_cpu_data.fpu_id & MIPS_FPIR_F64))
608+
if ((value & PR_FP_MODE_FR) && raw_cpu_has_fpu &&
609+
!(raw_current_cpu_data.fpu_id & MIPS_FPIR_F64))
610610
return -EOPNOTSUPP;
611-
if ((value & PR_FP_MODE_FRE) && cpu_has_fpu && !cpu_has_fre)
611+
if ((value & PR_FP_MODE_FRE) && raw_cpu_has_fpu && !cpu_has_fre)
612612
return -EOPNOTSUPP;
613613

614614
/* FR = 0 not supported in MIPS R6 */
615-
if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6)
615+
if (!(value & PR_FP_MODE_FR) && raw_cpu_has_fpu && cpu_has_mips_r6)
616616
return -EOPNOTSUPP;
617617

618618
/* Proceed with the mode switch */

0 commit comments

Comments
 (0)