[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v2 02/22] ARM: vGIC: route/remove_irq: replace rank lock with IRQ lock



So far the rank lock is protecting the physical IRQ routing for a
particular virtual IRQ (though this doesn't seem to be documented
anywhere). So although these functions don't really touch the rank
structure, the lock prevents them from running concurrently.
This seems a bit like a kludge, so as we now have our newly introduced
per-IRQ lock, we can use that instead to get a more natural protection
(and remove the first rank user).

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
---
 xen/arch/arm/gic.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 6c803bf..2c99d71 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -139,9 +139,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int 
virq,
     unsigned long flags;
     /* Use vcpu0 to retrieve the pending_irq struct. Given that we only
      * route SPIs to guests, it doesn't make any difference. */
-    struct vcpu *v_target = vgic_get_target_vcpu(d->vcpu[0], virq);
-    struct vgic_irq_rank *rank = vgic_rank_irq(v_target, virq);
-    struct pending_irq *p = irq_to_pending(v_target, virq);
+    struct pending_irq *p = irq_to_pending(d->vcpu[0], virq);
     int res = -EBUSY;
 
     ASSERT(spin_is_locked(&desc->lock));
@@ -150,7 +148,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int 
virq,
     ASSERT(virq < vgic_num_irqs(d));
     ASSERT(!is_lpi(virq));
 
-    vgic_lock_rank(v_target, rank, flags);
+    vgic_irq_lock(p, flags);
 
     if ( p->desc ||
          /* The VIRQ should not be already enabled by the guest */
@@ -168,7 +166,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int 
virq,
     res = 0;
 
 out:
-    vgic_unlock_rank(v_target, rank, flags);
+    vgic_irq_unlock(p, flags);
 
     return res;
 }
@@ -177,9 +175,7 @@ out:
 int gic_remove_irq_from_guest(struct domain *d, unsigned int virq,
                               struct irq_desc *desc)
 {
-    struct vcpu *v_target = vgic_get_target_vcpu(d->vcpu[0], virq);
-    struct vgic_irq_rank *rank = vgic_rank_irq(v_target, virq);
-    struct pending_irq *p = irq_to_pending(v_target, virq);
+    struct pending_irq *p = irq_to_pending(d->vcpu[0], virq);
     unsigned long flags;
 
     ASSERT(spin_is_locked(&desc->lock));
@@ -187,7 +183,7 @@ int gic_remove_irq_from_guest(struct domain *d, unsigned 
int virq,
     ASSERT(p->desc == desc);
     ASSERT(!is_lpi(virq));
 
-    vgic_lock_rank(v_target, rank, flags);
+    vgic_irq_lock(p, flags);
 
     if ( d->is_dying )
     {
@@ -207,7 +203,7 @@ int gic_remove_irq_from_guest(struct domain *d, unsigned 
int virq,
         if ( test_bit(_IRQ_INPROGRESS, &desc->status) ||
              !test_bit(_IRQ_DISABLED, &desc->status) )
         {
-            vgic_unlock_rank(v_target, rank, flags);
+            vgic_irq_unlock(p, flags);
             return -EBUSY;
         }
     }
@@ -217,7 +213,7 @@ int gic_remove_irq_from_guest(struct domain *d, unsigned 
int virq,
 
     p->desc = NULL;
 
-    vgic_unlock_rank(v_target, rank, flags);
+    vgic_irq_unlock(p, flags);
 
     return 0;
 }
-- 
2.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.