Thread (94 messages) 94 messages, 6 authors, 2016-05-05
STALE3684d

[PATCH v2 16/54] KVM: arm/arm64: vgic-new: Add IRQ sync/flush framework

From: Tom Hanson <hidden>
Date: 2016-05-05 16:23:32
Also in: kvm, kvmarm

On 04/28/2016 10:45 AM, Andre Przywara wrote:

...
quoted hunk ↗ jump to hunk
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index 4fb20fd..a656a12e5 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
...
+static void vgic_prune_ap_list(struct kvm_vcpu *vcpu)
+{
...
+		/* This interrupt looks like it has to be migrated. */
+
+		spin_unlock(&irq->irq_lock);
+		spin_unlock(&vgic_cpu->ap_list_lock);
If using the suggested (but not provided) higher level function from patch 14 this could be:
                 vgic_unlock_aplist_irq(, spinlock_t irq);
+
+		/*
+		 * Ensure locking order by always locking the smallest
+		 * ID first.
+		 */
+		if (vcpu->vcpu_id < target_vcpu->vcpu_id) {
+			vcpuA = vcpu;
+			vcpuB = target_vcpu;
+		} else {
+			vcpuA = target_vcpu;
+			vcpuB = vcpu;
+		}
+
+		spin_lock(&vcpuA->arch.vgic_cpu.ap_list_lock);
+		spin_lock(&vcpuB->arch.vgic_cpu.ap_list_lock);
And this whole block could be replaced by:
                 vgic_lock_cpu_aplist_pair(vcpuA, vcpuB)
+             spin_lock(&irq->irq_lock);
...
+		spin_unlock(&irq->irq_lock);
+		spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock);
+		spin_unlock(&vcpuA->arch.vgic_cpu.ap_list_lock);
And this could be:
                 vgic_unlock_cpu_aplist_pair(vcpuA, vcpuB)
+		goto retry;
+	}
+
+	spin_unlock(&vgic_cpu->ap_list_lock);
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help