linux/virt/kvm/arm
Christoffer Dall 13e59ece5b KVM: arm/arm64: Fix incorrect timer_is_pending logic
After the recently introduced support for level-triggered mapped
interrupt, I accidentally left the VCPU thread busily going back and
forward between the guest and the hypervisor whenever the guest was
blocking, because I would always incorrectly report that a timer
interrupt was pending.

This is because the timer->irq.level field is not valid for mapped
interrupts, where we offload the level state to the hardware, and as a
result this field is always true.

Luckily the problem can be relatively easily solved by not checking the
cached signal state of either timer in kvm_timer_should_fire() but
instead compute the timer state on the fly, which we do already if the
cached signal state wasn't high.  In fact, the only reason for checking
the cached signal state was a tiny optimization which would only be
potentially faster when the polling loop detects a pending timer
interrupt, which is quite unlikely.

Instead of duplicating the logic from kvm_arch_timer_handler(), we
enlighten kvm_timer_should_fire() to report something valid when the
timer state is loaded onto the hardware.  We can then call this from
kvm_arch_timer_handler() as well and avoid the call to
__timer_snapshot_state() in kvm_arch_timer_get_input_level().

Reported-by: Tomasz Nowicki <tn@semihalf.com>
Tested-by: Tomasz Nowicki <tn@semihalf.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2018-01-31 10:10:17 +01:00
..
hyp KVM: arm/arm64: Detangle kvm_mmu.h from kvm_hyp.h 2018-01-08 15:20:43 +01:00
vgic KVM: arm/arm64: Support VGIC dist pend/active changes for mapped IRQs 2018-01-02 10:05:46 +01:00
aarch32.c KVM: arm/arm64: Unify 32bit fault injection 2017-11-06 16:23:20 +01:00
arch_timer.c KVM: arm/arm64: Fix incorrect timer_is_pending logic 2018-01-31 10:10:17 +01:00
arm.c KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED 2018-01-23 16:47:15 +01:00
mmio.c KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00
mmu.c KVM: arm/arm64: Drop vcpu parameter from guest cache maintenance operartions 2018-01-08 15:20:46 +01:00
perf.c KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00
pmu.c KVM: arm/arm64: PMU: Fix overflow interrupt injection 2017-07-25 14:18:01 +01:00
psci.c KVM: arm/arm64: change exit request to sleep request 2017-06-04 16:53:55 +02:00
trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00