linux/arch/arm64
Dave Martin b3eb56b629 KVM: arm64/sve: Fix SVE trap restoration for non-current tasks
Commit e6b673b ("KVM: arm64: Optimise FPSIMD handling to reduce
guest/host thrashing") attempts to restore the configuration of
userspace SVE trapping via a call to fpsimd_bind_task_to_cpu(), but
the logic for determining when to do this is not correct.

The patch makes the errnoenous assumption that the only task that
may try to enter userspace with the currently loaded FPSIMD/SVE
register content is current.  This may not be the case however:  if
some other user task T is scheduled on the CPU during the execution
of the KVM run loop, and the vcpu does not try to use the registers
in the meantime, then T's state may be left there intact.  If T
happens to be the next task to enter userspace on this CPU then the
hooks for reloading the register state and configuring traps will
be skipped.

(Also, current never has SVE state at this point anyway and should
always have the trap enabled, as a side-effect of the ioctl()
syscall needed to reach the KVM run loop in the first place.)

This patch instead restores the state of the EL0 trap from the
state observed at the most recent vcpu_load(), ensuring that the
trap is set correctly for the loaded context (if any).

Fixes: e6b673b741 ("KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2018-06-21 09:14:44 +01:00
..
boot ARM: SoC: late updates 2018-06-11 18:19:45 -07:00
configs ARM: SoC platform updates 2018-06-11 17:49:09 -07:00
crypto crypto: clarify licensing of OpenSSL asm code 2018-05-31 00:13:44 +08:00
include KVM: arm64/sve: Fix SVE trap restoration for non-current tasks 2018-06-21 09:14:44 +01:00
kernel Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
kvm KVM: arm64/sve: Fix SVE trap restoration for non-current tasks 2018-06-21 09:14:44 +01:00
lib arm64: export tishift functions to modules 2018-05-21 19:00:48 +01:00
mm treewide: use PHYS_ADDR_MAX to avoid type casting ULLONG_MAX 2018-06-15 07:55:25 +09:00
net bpf, arm64: save 4 bytes in prologue when ebpf insns came from cbpf 2018-05-14 19:11:45 -07:00
xen arm64: mm: Add additional parameter to uaccess_ttbr0_disable 2018-01-17 13:57:49 +01:00
Kconfig Kbuild: rename HAVE_CC_STACKPROTECTOR config variable 2018-06-15 07:15:28 +09:00
Kconfig.debug arm64: relocation testing module 2017-04-04 17:03:32 +01:00
Kconfig.platforms arm64: dts: renesas: Add Renesas R8A77990 Kconfig support 2018-05-16 10:44:01 +02:00
Makefile arm64: move GCC version check for ARCH_SUPPORTS_INT128 to Kconfig 2018-06-08 18:56:02 +09:00