From: Stefano Stabellini Subject: [PATCH v8 13/13] gic_remove_from_queues: take a lock on the right vcpu Date: Thu, 22 May 2014 13:32:30 +0100 Message-ID: <1400761950-25035-13-git-send-email-stefano.stabellini@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org 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 --- 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