WSL2-Linux-Kernel/arch/arc/kernel
Vineet Gupta 3a715e8040 ARC: fp: set FPU_STATUS.FWE to enable FPU_STATUS update on context switch
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>
2021-08-03 18:58:33 -07:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Makefile arc: ptrace: hard-code "arc" instead of UTS_MACHINE 2020-04-12 22:27:09 -07:00
arc_hostlink.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
arcksyms.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
asm-offsets.c ARC: add support for DSP-enabled userspace applications 2020-03-16 10:30:49 -07:00
ctx_sw.c ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
ctx_sw_asm.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
devtree.c ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
disasm.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
entry-arcv2.S ARCv2: entry: simplify return to Delay Slot via interrupt 2019-07-08 09:24:45 +01:00
entry-compact.S ARC: entry: EV_Trap expects r10 (vs. r9) to have exception cause 2019-07-08 09:24:44 +01:00
entry.S ARC: entry: fix off-by-one error in syscall number validation 2021-05-10 12:38:59 -07:00
fpu.c ARC: fp: set FPU_STATUS.FWE to enable FPU_STATUS update on context switch 2021-08-03 18:58:33 -07:00
head.S ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline 2020-11-02 11:45:09 -08:00
intc-arcv2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
intc-compact.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
irq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
jump_label.c ARC: ARCv2: jump label: implement jump label patching 2019-11-08 16:14:32 -08:00
kgdb.c ARC: kgdb: add 'fallthrough' to prevent a warning 2021-05-10 12:38:59 -07:00
kprobes.c kprobes: Do not increment probe miss count in the fault handler 2021-06-03 15:47:26 +02:00
mcip.c ARCv2: IDU-intc: Add support for edge-triggered interrupts 2019-08-26 22:34:59 +05:30
module.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
perf_event.c ARC: perf: redo the pct irq missing in device-tree handling 2020-10-22 10:57:58 -07:00
process.c arc: Fix typos/spellos 2021-05-10 12:38:59 -07:00
ptrace.c arc: switch to ->regset_get() 2020-07-27 14:31:09 -04:00
reset.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
setup.c ARCv2: boot log: detect newer/upconing HS3x/HS4x releases 2020-06-16 12:56:37 -07:00
signal.c ARCv2: save ABI registers across signal handling 2021-06-10 17:21:38 -07:00
smp.c sched/core: Initialize the idle task with preemption disabled 2021-05-12 13:01:45 +02:00
stacktrace.c sched: Introduce task_is_running() 2021-06-18 11:43:07 +02:00
sys.c ARC: wireup clone3 syscall 2020-01-15 16:08:12 -08:00
traps.c Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2019-07-08 21:48:15 -07:00
troubleshoot.c arch/arc/kernel/troubleshoot: use vma_lookup() instead of find_vma() 2021-06-29 10:53:51 -07:00
unaligned.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
unwind.c arc: Prefer unsigned int to bare use of unsigned 2021-08-03 18:58:33 -07:00
vmlinux.lds.S ARC: Fix CONFIG_STACKDEPOT 2021-08-03 18:58:33 -07:00