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

[Xen-devel] [PATCH v4 06/13] x86/IOMMU: don't restrict IRQ affinities to online CPUs


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Tue, 16 Jul 2019 07:40:57 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ma06aoY4nak3zDqj07tDPotoYKZ79Aybw397VBzTmFY=; b=bWN1IEj3OKO4NQdMUqVS0loCFCcoA+G/Y6BRDYhPsirjYn3Emp8JKhIVgDHx3PHWZ8v6cO6ndohgi+URhbiWdHGUbYZQhZXKZ/6QjiClqdvvzG1cN6D2M55RQiegk1k/u6FWmbyazVu3yVQo2CnGxtVP4I2yOAunkrmx8jewxGbO4GNEm4tc/nZQZbRJJjnMn24SCJATXMna87uq0q7eGsX+aiC35uNriQwv9l5N+DCMukSNef+5GyJjURkfwBxXSc4InZ/8KpTyl9pmVrdQO+vf697reicDe2aXEv1vCWsvbcaYYjtkVvj9NomoI0OGvso6P9mkC1v2fTGeaJVtbg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PpTDzwK2L8TCOqyYzqTKkBPah+VL4a78lVqXvKMy23L8M4uiRaVsPMamzkaIVgO0ljZNrew16zR1ayBHjH8GEotrtk65aJtoT+vmzojN5aWZ/JeXri8sRCI91PmXs9BSCoxwLS3164t0Uf4TLJfKgGmLk4CgaHHSW+O9qnmDWHgQR3VhC74iq2MNJqUh63pkdwt31nUXKxCLdFC52UVtyyeZxiXC2PX5+KUY3kYlLAlU6aNGzPhnugi1RI0qy+vUDmemvMnVZbydca/Dgd5K9yz1g0g/r4Gv+hpQ68DtWT8c9JeHZHgu2WRpzQ90iAdE2fQrE4LZdd0KF5hlCC9ClQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: "kevin.tian@xxxxxxxxx" <kevin.tian@xxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>, Brian Woods <brian.woods@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 16 Jul 2019 07:48:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVO6nO1yIoPbw3sE+gj0c0leZLnQ==
  • Thread-topic: [PATCH v4 06/13] x86/IOMMU: don't restrict IRQ affinities to online CPUs

In line with "x86/IRQ: desc->affinity should strictly represent the
requested value" the internally used IRQ(s) also shouldn't be restricted
to online ones. Make set_desc_affinity() (set_msi_affinity() then does
by implication) cope with a NULL mask being passed (just like
assign_irq_vector() does), and have IOMMU code pass NULL instead of
&cpu_online_map (when, for VT-d, there's no NUMA node information
available).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v4: New.

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -796,18 +796,26 @@ unsigned int set_desc_affinity(struct ir
      unsigned long flags;
      cpumask_t dest_mask;
  
-    if (!cpumask_intersects(mask, &cpu_online_map))
+    if ( mask && !cpumask_intersects(mask, &cpu_online_map) )
          return BAD_APICID;
  
      spin_lock_irqsave(&vector_lock, flags);
-    ret = _assign_irq_vector(desc, mask);
+    ret = _assign_irq_vector(desc, mask ?: TARGET_CPUS);
      spin_unlock_irqrestore(&vector_lock, flags);
  
-    if (ret < 0)
+    if ( ret < 0 )
          return BAD_APICID;
  
-    cpumask_copy(desc->affinity, mask);
-    cpumask_and(&dest_mask, mask, desc->arch.cpu_mask);
+    if ( mask )
+    {
+        cpumask_copy(desc->affinity, mask);
+        cpumask_and(&dest_mask, mask, desc->arch.cpu_mask);
+    }
+    else
+    {
+        cpumask_setall(desc->affinity);
+        cpumask_copy(&dest_mask, desc->arch.cpu_mask);
+    }
      cpumask_and(&dest_mask, &dest_mask, &cpu_online_map);
  
      return cpu_mask_to_apicid(&dest_mask);
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -888,7 +888,7 @@ static void enable_iommu(struct amd_iomm
  
      desc = irq_to_desc(iommu->msi.irq);
      spin_lock(&desc->lock);
-    set_msi_affinity(desc, &cpu_online_map);
+    set_msi_affinity(desc, NULL);
      spin_unlock(&desc->lock);
  
      amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED);
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2133,11 +2133,11 @@ static void adjust_irq_affinity(struct a
      const struct acpi_rhsa_unit *rhsa = drhd_to_rhsa(drhd);
      unsigned int node = rhsa ? pxm_to_node(rhsa->proximity_domain)
                               : NUMA_NO_NODE;
-    const cpumask_t *cpumask = &cpu_online_map;
+    const cpumask_t *cpumask = NULL;
      struct irq_desc *desc;
  
      if ( node < MAX_NUMNODES && node_online(node) &&
-         cpumask_intersects(&node_to_cpumask(node), cpumask) )
+         cpumask_intersects(&node_to_cpumask(node), &cpu_online_map) )
          cpumask = &node_to_cpumask(node);
  
      desc = irq_to_desc(drhd->iommu->msi.irq);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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