Skip to contentSkip to conversation

x86/vtd: Fix S3 resume following c/s 650c31d3af

PATCH In review Andrew Cooper 2 participants 2 messages Aug 12, 2019 – Aug 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vtd: Fix S3 resume following c/s 650c31d3af

c/s 650c31d3af "x86/IRQ: fix locking around vector management" adjusted the locking in adjust_irq_affinity().

The S3 path ends up here via iommu_resume() before interrupts are enabled, at which point spin_lock_irq() which fail ASSERT(local_irq_is_enabled()); but with no working console.

Use spin_lock_irqsave() instead to cope with interrupts already being disabled.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>

I'm fairly confident that the AMD side of things is fine, because enable_iommu() is encompased by a spin_lock_irqsave() block.

---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/drivers/passthrough/vtd/iommu.c +3 -2
index 5d72270c5b..defa74fae3 100644
@@ -2135,15 +2135,16 @@ static void adjust_irq_affinity(struct acpi_drhd_unit *drhd)
                              : NUMA_NO_NODE;
     const cpumask_t *cpumask = NULL;
     struct irq_desc *desc;
+    unsigned long flags;
 
     if ( node < MAX_NUMNODES && node_online(node) &&
          cpumask_intersects(&node_to_cpumask(node), &cpu_online_map) )
         cpumask = &node_to_cpumask(node);
 
     desc = irq_to_desc(drhd->iommu->msi.irq);
-    spin_lock_irq(&desc->lock);
+    spin_lock_irqsave(&desc->lock, flags);
     dma_msi_set_affinity(desc, cpumask);
-    spin_unlock_irq(&desc->lock);
+    spin_unlock_irqrestore(&desc->lock, flags);
 }
 
 static int adjust_vtd_irq_affinities(void)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Tuesday, August 13, 2019 1:17 AM

c/s 650c31d3af "x86/IRQ: fix locking around vector management" adjusted the
locking in adjust_irq_affinity().

The S3 path ends up here via iommu_resume() before interrupts are enabled, at
which point spin_lock_irq() which fail ASSERT(local_irq_is_enabled()); but with no working console.

Quoted 4 lines

Use spin_lock_irqsave() instead to cope with interrupts already being disabled.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel