KVM: arm/arm64: Simplify active_change_prepare and plug race
authorChristoffer Dall <cdall@linaro.org>
Sat, 6 May 2017 18:01:24 +0000 (20:01 +0200)
committerChristoffer Dall <cdall@linaro.org>
Tue, 23 May 2017 10:48:22 +0000 (12:48 +0200)
commitabd7229626b9339e378a8cfcdebe0c0943b06a7f
treee50cebd5e9f2e9386da1b39e7bfbc6138cd72b4b
parent3197191e5525ea7cf8b3fdd9afc75ab5779d21fd
KVM: arm/arm64: Simplify active_change_prepare and plug race

We don't need to stop a specific VCPU when changing the active state,
because private IRQs can only be modified by a running VCPU for the
VCPU itself and it is therefore already stopped.

However, it is also possible for two VCPUs to be modifying the active
state of SPIs at the same time, which can cause the thread being stuck
in the loop that checks other VCPU threads for a potentially very long
time, or to modify the active state of a running VCPU.  Fix this by
serializing all accesses to setting and clearing the active state of
interrupts using the KVM mutex.

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