aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2018-04-17 06:23:49 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2018-04-17 07:57:11 -0400
commitbf9a41377d14f565764022470e14aae72559589a (patch)
tree71960b60a82f84ceca0ff5e2f59c47cab23919d9
parent165d102905691891f85cb90736c25150b7b25d29 (diff)
KVM: arm/arm64: vgic: Kick new VCPU on interrupt migration
When vgic_prune_ap_list() finds an interrupt that needs to be migrated to a new VCPU, we should notify this VCPU of the pending interrupt, since it requires immediate action. Kick this VCPU once we have added the new IRQ to the list, but only after dropping the locks. Reported-by: Stefano Stabellini <sstabellini@kernel.org> Reviewed-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--virt/kvm/arm/vgic/vgic.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index e74baec76361..4b6d72939c42 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -594,6 +594,7 @@ retry:
594 594
595 list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) { 595 list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) {
596 struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB; 596 struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB;
597 bool target_vcpu_needs_kick = false;
597 598
598 spin_lock(&irq->irq_lock); 599 spin_lock(&irq->irq_lock);
599 600
@@ -664,11 +665,18 @@ retry:
664 list_del(&irq->ap_list); 665 list_del(&irq->ap_list);
665 irq->vcpu = target_vcpu; 666 irq->vcpu = target_vcpu;
666 list_add_tail(&irq->ap_list, &new_cpu->ap_list_head); 667 list_add_tail(&irq->ap_list, &new_cpu->ap_list_head);
668 target_vcpu_needs_kick = true;
667 } 669 }
668 670
669 spin_unlock(&irq->irq_lock); 671 spin_unlock(&irq->irq_lock);
670 spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock); 672 spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock);
671 spin_unlock_irqrestore(&vcpuA->arch.vgic_cpu.ap_list_lock, flags); 673 spin_unlock_irqrestore(&vcpuA->arch.vgic_cpu.ap_list_lock, flags);
674
675 if (target_vcpu_needs_kick) {
676 kvm_make_request(KVM_REQ_IRQ_PENDING, target_vcpu);
677 kvm_vcpu_kick(target_vcpu);
678 }
679
672 goto retry; 680 goto retry;
673 } 681 }
674 682