linux-stable/arch/mips/kernel
Paul Burton 1975ed43ce
MIPS: Ensure emulated FP sets PF_USED_MATH
Emulated floating point instructions don't ensure that the PF_USED_MATH
flag is set for the task. This results in a couple of inconsistencies:

  - ptrace will return the default initial state of FP registers rather
    than the values actually stored in struct thread_struct, hiding
    state that has been updated by emulated floating point instructions.

  - If a task migrates to a CPU with an FPU after having emulated
    floating point instructions then its floating point register state
    will be reset to the default ~0 bit pattern, losing state from the
    emulated instructions.

Fix this by calling init_fp_ctx() from fpu_emulator_cop1Handler() to
consistently initialize FP state if it was previously uninitialized,
setting the PF_USED_MATH flag in the process.

All callers of fpu_emulator_cop1Handler() either call lose_fpu(1) before
it in order to save any live FPU registers to struct thread_struct, or
in the case of do_cpu() already know that the task does not own an FPU
so lose_fpu(1) would be a no-op. Since we know that saving FP context
will be unnecessary in the case where FP context was just initialized we
move this call into fpu_emulator_cop1Handler() too, providing
consistency & avoiding needless duplication.

Calls to own_fpu(1) are common after return from
fpu_emulator_cop1Handler() too, but this would not be a no-op in the
do_cpu() case so these are left as-is. A potential future improvement
could be to have fpu_emulator_cop1Handler() restore FPU state
automatically only if it saved it, though this may not be optimal if
some callers are better off without their current calls to own_fpu(1).
One potential example of this could be mipsr2_decoder() which as-is
could end up saving & restoring FP context repeatedly & unnecessarily if
emulating multiple FP instructions.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/21003/
Cc: linux-mips@linux-mips.org
2018-11-09 10:23:14 -08:00
..
.gitignore
8250-platform.c
asm-offsets.c Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
binfmt_elfn32.c y2038: globally rename compat_time to old_time32 2018-08-27 14:48:48 +02:00
binfmt_elfo32.c y2038: globally rename compat_time to old_time32 2018-08-27 14:48:48 +02:00
bmips_5xxx_init.S MIPS: BCM5xxx: Remove dead init_fpu code 2018-11-08 11:20:57 -08:00
bmips_vec.S
branch.c MIPS: Simplify FP context initialization 2018-11-09 10:23:13 -08:00
cacheinfo.c
cevt-bcm1480.c
cevt-ds1287.c
cevt-gt641xx.c
cevt-r4k.c
cevt-sb1250.c
cevt-txx9.c
cmpxchg.c Update MIPS email addresses 2017-11-03 09:02:30 -07:00
cps-vec-ns16550.S Update MIPS email addresses 2017-11-03 09:02:30 -07:00
cps-vec.S MIPS: CPS: Fix MIPS_ISA_LEVEL_RAW fallout 2018-02-05 11:53:06 +00:00
cpu-bugs64.c MIPS: Remove GCC_IMM_ASM & GCC_REG_ACCUM macros 2018-11-07 16:25:30 -08:00
cpu-probe.c MIPS: Loongson: Add Loongson-3A R3.1 basic support 2018-07-23 17:53:34 -07:00
crash.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
crash_dump.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
csrc-bcm1480.c
csrc-ioasic.c
csrc-r4k.c
csrc-sb1250.c
early_printk.c mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
early_printk_8250.c mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
elf.c Update MIPS email addresses 2017-11-03 09:02:30 -07:00
entry.S MIPS: Add syscall detection for restartable sequences 2018-06-19 21:13:56 -07:00
ftrace.c MIPS: ftrace: Remove pointer comparison to 0 in prepare_ftrace_return 2018-01-18 21:59:24 +00:00
genex.S MIPS: Fix ejtag handler on SMP 2018-06-24 09:27:27 -07:00
gpio_txx9.c
head.S MIPS/head: Store ELF appended dtb in a global variable too 2018-09-25 16:27:24 -07:00
i8253.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
idle.c MIPS: Annotate cpu_wait implementations with __cpuidle 2018-06-28 14:18:54 -07:00
irq-gt641xx.c
irq-msc01.c
irq-rm7000.c
irq.c
irq_txx9.c
jump_label.c
kgdb.c
kprobes.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
linux32.c MIPS: Delete unused code in linux32.c 2018-08-01 13:20:27 -07:00
machine_kexec.c MIPS: kdump: Mark cpu back online before rebooting 2018-09-28 10:09:03 -07:00
Makefile MIPS: Cleanup DSP ASE detection 2018-10-16 15:30:21 -07:00
mcount.S mips: ftrace: fix static function graph tracing 2018-06-19 15:00:12 -07:00
mips-cm.c MIPS: CM: Drop WARN_ON(vp != 0) 2018-01-10 16:47:25 +01:00
mips-cpc.c MIPS: CPC: Map registers using DT in mips_cpc_default_phys_base() 2018-02-08 14:02:01 +00:00
mips-mt-fpaff.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mips-mt.c MIPS: MT: Remove obsolete cache flush repeat code 2018-09-26 14:06:21 -07:00
mips-r2-to-r6-emul.c MIPS: Ensure emulated FP sets PF_USED_MATH 2018-11-09 10:23:14 -08:00
mips_machine.c
module.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2017-07-15 10:59:54 -07:00
octeon_switch.S Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
perf_event.c
perf_event_mipsxx.c MIPS: perf: Fix perf with MT counting other threads 2018-05-15 15:53:44 +01:00
pm-cps.c MIPS: pm-cps: Block system suspend when a JTAG probe is present 2018-03-09 13:53:26 +00:00
pm.c
probes-common.h MIPS: Update email address for Marcin Nowakowski 2017-11-02 10:58:43 +00:00
proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
process.c MIPS: VDSO: Always map near top of user memory 2018-09-28 12:09:00 -07:00
prom.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
ptrace.c MIPS: Simplify FP context initialization 2018-11-09 10:23:13 -08:00
ptrace32.c MIPS: Correct the 64-bit DSP accumulator register size 2018-07-19 13:47:21 -07:00
r4k_fpu.S MIPS: Simplify FP context initialization 2018-11-09 10:23:13 -08:00
r4k_switch.S Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
r2300_fpu.S MIPS: Simplify FP context initialization 2018-11-09 10:23:13 -08:00
r2300_switch.S Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
relocate.c MIPS: Remove no-op/identity casts 2018-08-31 11:49:20 -07:00
relocate_kernel.S MIPS: kexec: fix typos 2018-06-24 09:26:01 -07:00
reset.c MIPS: Hang more efficiently on halt/powerdown/restart 2018-03-09 11:22:43 +00:00
rtlx-cmp.c
rtlx-mt.c
rtlx.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
scall32-o32.S MIPS: Wire up io_pgetevents syscall 2018-06-19 21:14:29 -07:00
scall64-64.S MIPS: Wire up io_pgetevents syscall 2018-06-19 21:14:29 -07:00
scall64-n32.S MIPS: Wire up io_pgetevents syscall 2018-06-19 21:14:29 -07:00
scall64-o32.S MIPS: Wire up io_pgetevents syscall 2018-06-19 21:14:29 -07:00
segment.c
setup.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
signal-common.h
signal.c Here are the main MIPS changes for 4.19. 2018-08-13 19:24:32 -07:00
signal32.c compat: Move compat_timespec/ timeval to compat_time.h 2018-04-19 13:29:54 +02:00
signal_n32.c MIPS: Remove nabi_no_regargs 2018-08-01 13:20:15 -07:00
signal_o32.c MIPS: Remove nabi_no_regargs 2018-08-01 13:20:15 -07:00
smp-bmips.c MIPS: kexec: Make a framework for both jumping and halting on nonboot CPUs 2018-09-22 10:31:50 -07:00
smp-cmp.c MIPS: smp-cmp: Fix vpe_id build error 2017-11-01 23:23:00 +00:00
smp-cps.c MIPS: kexec: CPS systems to halt nonboot CPUs 2018-09-22 10:32:33 -07:00
smp-mt.c MIPS: Use mips_gic_present() in place of gic_present 2017-09-04 13:53:14 +02:00
smp-up.c MIPS: SMP: Allow boot_secondary SMP op to return errors 2017-08-30 00:57:27 +02:00
smp.c MIPS changes for 4.15 2017-11-15 11:36:08 -08:00
spinlock_test.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
spram.c
stacktrace.c
sync-r4k.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscall.c mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() 2018-04-02 20:16:11 +02:00
sysrq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
time.c MIPS: Convert update_persistent_clock() to update_persistent_clock64() 2018-05-14 23:58:23 +01:00
topology.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c MIPS: Ensure emulated FP sets PF_USED_MATH 2018-11-09 10:23:14 -08:00
unaligned.c MIPS: Ensure emulated FP sets PF_USED_MATH 2018-11-09 10:23:14 -08:00
uprobes.c Uprobe: Additional argument arch_uprobe to uprobe_write_opcode() 2018-08-13 20:08:33 -04:00
vdso.c MIPS: VDSO: Always map near top of user memory 2018-09-28 12:09:00 -07:00
vmlinux.lds.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vpe-cmp.c
vpe-mt.c
vpe.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
watch.c MIPS: Watch: Avoid duplication of bits in mips_read_watch_registers 2018-01-23 15:46:01 +00:00