]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
KVM: arm/arm64: vgic: Do not cond_resched_lock() with IRQs disabled
authorJulien Thierry <julien.thierry@arm.com>
Mon, 26 Nov 2018 18:26:44 +0000 (18:26 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837257
commit 2e2f6c3c0b08eed3fcf7de3c7684c940451bdeb1 upstream.

To change the active state of an MMIO, halt is requested for all vcpus of
the affected guest before modifying the IRQ state. This is done by calling
cond_resched_lock() in vgic_mmio_change_active(). However interrupts are
disabled at this point and we cannot reschedule a vcpu.

We actually don't need any of this, as kvm_arm_halt_guest ensures that
all the other vcpus are out of the guest. Let's just drop that useless
code.

Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Suggested-by: Christoffer Dall <christoffer.dall@arm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
virt/kvm/arm/vgic/vgic-mmio.c

index 8f1aed1cb42eb28b2e9251fb309d524208947d45..1ce41c91457a4ed20e9db2039ffcca372787c9f9 100644 (file)
@@ -206,22 +206,6 @@ static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
         */
        requester_vcpu = kvm_arm_get_running_vcpu();
 
-       /*
-        * If this virtual IRQ was written into a list register, we
-        * have to make sure the CPU that runs the VCPU thread has
-        * synced back the LR state to the struct vgic_irq.
-        *
-        * As long as the conditions below are true, we know the VCPU thread
-        * may be on its way back from the guest (we kicked the VCPU thread in
-        * vgic_change_active_prepare)  and still has to sync back this IRQ,
-        * so we release and re-acquire the spin_lock to let the other thread
-        * sync back the IRQ.
-        */
-       while (irq->vcpu && /* IRQ may have state in an LR somewhere */
-              irq->vcpu != requester_vcpu && /* Current thread is not the VCPU thread */
-              irq->vcpu->cpu != -1) /* VCPU thread is running */
-               cond_resched_lock(&irq->irq_lock);
-
        irq->active = new_active_state;
        if (new_active_state)
                vgic_queue_irq_unlock(vcpu->kvm, irq, flags);