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

[Xen-devel] [PATCH v8 13/13] gic_remove_from_queues: take a lock on the right vcpu



At the moment gic_remove_from_queues doesn't handle the case where the
guest kernel disables an irq on a different vcpu compared to the one
currently receiving the interrupt.
Make sure to take the right vcpu lock before removing the irq from
lr_queue.

Document that the function should remove irqs from LR registers too.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xen/arch/arm/gic.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 2bfaba9..bb598eb 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -589,9 +589,16 @@ static inline void gic_add_to_lr_pending(struct vcpu *v, 
struct pending_irq *n)
 
 void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq)
 {
-    struct pending_irq *p = irq_to_pending(v, virtual_irq);
+    struct pending_irq *p;
     unsigned long flags;
 
+    /* TODO: do not assume SPI delivery on vcpu0 */
+    if ( virtual_irq >= 32 && v->vcpu_id != 0 )
+        v = v->domain->vcpu[0];
+
+    p = irq_to_pending(v, virtual_irq);
+
+    /* TODO: evict the irq from LRs */
     spin_lock_irqsave(&v->arch.vgic.lock, flags);
     if ( !list_empty(&p->lr_queue) )
         list_del_init(&p->lr_queue);
-- 
1.7.10.4


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


 


Rackspace

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