Re: [PATCH] arch/mips/kernel/traps: add CONFIG_MIPS_FP_SUPPORT when using handle_fpe

From: Maciej W. Rozycki
Date: Thu Apr 28 2022 - 05:00:28 EST


On Thu, 28 Apr 2022, Stephen Zhang wrote:

> > Please send me .config causing it and tell me what compiler and version
> > you have seen this error with. We rely on things being optimised away
> > heavily throughout the Linux kernel, so this is certainly something to
> > investigate. I have built such a config just fine, but maybe there's a
> > bug somewhere my setup does not trigger.
>
> Okay. The compiler we used is:
>
> Compiler gcc
> Compiler version 10
> Compiler string mips-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
> Cross-compile mips-linux-gnu
>
> the commit id of kernel is c00c5e1d157bec0ef0b0b59aa5482eb8dc7e8e49
>
> and the .config file is sent as an attachment.

Thanks.

The bug is in arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h,
which has:

#define cpu_has_fpu 1

(and similarly arch/mips/include/asm/mach-ip30/cpu-feature-overrides.h).
This is not supported, as noted in arch/mips/include/asm/cpu-features.h:

/* Don't override `cpu_has_fpu' to 1 or the "nofpu" option won't work. */

Perhaps we should explicitly undefine `cpu_has_fpu' if set to 1?

Maciej