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

[Xen-changelog] [xen stable-4.8] arm: remove irq from inflight, then change physical affinity



commit 9e6b2ddf3306cc8245ef882c52d8e887967fa8cb
Author:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
AuthorDate: Wed Apr 5 13:28:42 2017 -0700
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Mon Jun 12 14:36:21 2017 -0700

    arm: remove irq from inflight, then change physical affinity
    
    This patch fixes a potential race that could happen when
    gic_update_one_lr and vgic_vcpu_inject_irq run simultaneously.
    
    When GIC_IRQ_GUEST_MIGRATING is set, we must make sure that the irq has
    been removed from inflight before changing physical affinity, to avoid
    concurrent accesses to p->inflight, as vgic_vcpu_inject_irq will take a
    different vcpu lock.
    
    Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
    master-commit-id: 31bc6a93a096bab21211e0e2c7c284ee4aec5402
---
 xen/arch/arm/gic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index a5348f2..86e5104 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -504,6 +504,13 @@ static void gic_update_one_lr(struct vcpu *v, int i)
             gic_raise_guest_irq(v, irq, p->priority);
         else {
             list_del_init(&p->inflight);
+            /*
+             * Remove from inflight, then change physical affinity. It
+             * makes sure that when a new interrupt is received on the
+             * next pcpu, inflight is already cleared. No concurrent
+             * accesses to inflight.
+             */
+            smp_wmb();
             if ( test_and_clear_bit(GIC_IRQ_GUEST_MIGRATING, &p->status) )
             {
                 struct vcpu *v_target = vgic_get_target_vcpu(v, irq);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.8

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

 


Rackspace

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