KVM: arm/arm64: PMU: Fix overflow interrupt injection
authorAndrew Jones <drjones@redhat.com>
Sat, 1 Jul 2017 16:26:54 +0000 (18:26 +0200)
committerMarc Zyngier <marc.zyngier@arm.com>
Tue, 25 Jul 2017 13:18:01 +0000 (14:18 +0100)
commitd9f89b4e9290e46cd9b273e9ad0bff0f93e86fae
tree94f2f88610beefb87a9995c91a9452a867990d3a
parent79962a5c8ba5b33f49d88a058e2124bf2ff3c034
KVM: arm/arm64: PMU: Fix overflow interrupt injection

kvm_pmu_overflow_set() is called from perf's interrupt handler,
making the call of kvm_vgic_inject_irq() from it introduced with
"KVM: arm/arm64: PMU: remove request-less vcpu kick" a really bad
idea, as it's quite easy to try and retake a lock that the
interrupted context is already holding. The fix is to use a vcpu
kick, leaving the interrupt injection to kvm_pmu_sync_hwstate(),
like it was doing before the refactoring. We don't just revert,
though, because before the kick was request-less, leaving the vcpu
exposed to the request-less vcpu kick race, and also because the
kick was used unnecessarily from register access handlers.

Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
arch/arm64/kvm/sys_regs.c
include/kvm/arm_pmu.h
virt/kvm/arm/pmu.c