kernel_optimize_test/arch
Vineet Gupta ca6dea44bd ARC: fp: set FPU_STATUS.FWE to enable FPU_STATUS update on context switch
commit 3a715e80400f452b247caa55344f4f60250ffbcf upstream.

FPU_STATUS register contains FP exception flags bits which are updated
by core as side-effect of FP instructions but can also be manually
wiggled such as by glibc C99 functions fe{raise,clear,test}except() etc.
To effect the update, the programming model requires OR'ing FWE
bit (31). This bit is write-only and RAZ, meaning it is effectively
auto-cleared after write and thus needs to be set everytime: which
is how glibc implements this.

However there's another usecase of FPU_STATUS update, at the time of
Linux task switch when incoming task value needs to be programmed into
the register. This was added as part of f45ba2bd6d ("ARCv2:
fpu: preserve userspace fpu state") which missed OR'ing FWE bit,
meaning the new value is effectively not being written at all.
This patch remedies that.

Interestingly, this snafu was not caught in interm glibc testing as the
race window which relies on a specific exception bit to be set/clear is
really small specially when it nvolves context switch.
Fortunately this was caught by glibc's math/test-fenv-tls test which
repeatedly set/clear exception flags in a big loop, concurrently in main
program and also in a thread.

Fixes: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/54
Fixes: f45ba2bd6d ("ARCv2: fpu: preserve userspace fpu state")
Cc: stable@vger.kernel.org	#5.6+
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-18 08:59:06 +02:00
..
alpha alpha: Send stop IPI to send to online CPUs 2021-08-12 13:22:20 +02:00
arc ARC: fp: set FPU_STATUS.FWE to enable FPU_STATUS update on context switch 2021-08-18 08:59:06 +02:00
arm ARM: omap2+: hwmod: fix potential NULL pointer access 2021-08-12 13:22:17 +02:00
arm64 arm64: dts: renesas: beacon: Fix USB ref clock references 2021-08-15 14:00:25 +02:00
c6x
csky csky: syscache: Fixup duplicate cache flush 2021-07-14 16:56:52 +02:00
h8300
hexagon hexagon: use common DISCARDS macro 2021-07-20 16:05:53 +02:00
ia64 mm/page_alloc: fix memory map initialization for descending nodes 2021-07-25 14:36:18 +02:00
m68k m68k: atari: Fix ATARI_KBD_CORE kconfig unmet dependency warning 2021-07-14 16:56:05 +02:00
microblaze
mips MIPS: Malta: Do not byte-swap accesses to the CBUS UART 2021-08-12 13:22:15 +02:00
nds32 nds32: fix up stack guard gap 2021-07-28 14:35:46 +02:00
nios2
openrisc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
parisc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
powerpc powerpc/pseries: Fix regression while building external modules 2021-08-04 12:46:45 +02:00
riscv bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2021-08-04 12:46:44 +02:00
s390 bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2021-08-04 12:46:44 +02:00
sh sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
sparc bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2021-08-04 12:46:44 +02:00
um um: fix error return code in winch_tramp() 2021-07-20 16:05:51 +02:00
x86 KVM: SVM: Fix off-by-one indexing when nullifying last used SEV VMCB 2021-08-15 14:00:24 +02:00
xtensa sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
.gitignore
Kconfig