From: "Woods, Brian" <Brian.Woods@amd.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "kevin.tian@intel.com" <kevin.tian@intel.com>,
"Wei Liu" <wl@xen.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@amd.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Woods, Brian" <Brian.Woods@amd.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v4 06/13] x86/IOMMU: don't restrict IRQ affinities to online CPUs
Date: Wed, 24 Jul 2019 19:53:44 +0000 [thread overview]
Message-ID: <20190724195341.GC25253@amd.com> (raw)
In-Reply-To: <923083ba-66f9-a88b-8909-a2f5e2808a69@suse.com>
On Tue, Jul 16, 2019 at 07:40:57AM +0000, Jan Beulich wrote:
> 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@suse.com>
Acked-by: Brian Woods <brian.woods@amd.com>
> ---
> 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);
--
Brian Woods
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-07-24 19:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 7:24 [Xen-devel] [PATCH v4 00/13] x86: IRQ management adjustments Jan Beulich
2019-07-16 7:37 ` [Xen-devel] [PATCH v4 01/13] x86/IRQ: deal with move-in-progress state in fixup_irqs() Jan Beulich
2019-07-19 13:20 ` Andrew Cooper
2019-07-16 7:37 ` [Xen-devel] [PATCH v4 02/13] x86/IRQ: deal with move cleanup count " Jan Beulich
2019-07-16 7:38 ` [Xen-devel] [PATCH v4 03/13] x86/IRQ: desc->affinity should strictly represent the requested value Jan Beulich
2019-07-19 13:25 ` Andrew Cooper
2019-07-16 7:38 ` [Xen-devel] [PATCH v4 04/13] x86/IRQ: consolidate use of ->arch.cpu_mask Jan Beulich
2019-07-16 7:39 ` [Xen-devel] [PATCH v4 05/13] x86/IRQ: fix locking around vector management Jan Beulich
2019-07-16 7:40 ` [Xen-devel] [PATCH v4 06/13] x86/IOMMU: don't restrict IRQ affinities to online CPUs Jan Beulich
2019-07-16 9:12 ` Roger Pau Monné
2019-07-16 10:20 ` Jan Beulich
2019-07-16 11:17 ` Roger Pau Monné
2019-07-19 13:27 ` Andrew Cooper
2019-07-24 0:53 ` Tian, Kevin
2019-07-24 19:53 ` Woods, Brian [this message]
2019-07-16 7:41 ` [Xen-devel] [PATCH v4 07/13] x86/IRQ: target online CPUs when binding guest IRQ Jan Beulich
2019-07-16 7:42 ` [Xen-devel] [PATCH v4 08/13] x86/IRQs: correct/tighten vector check in _clear_irq_vector() Jan Beulich
2019-07-16 7:42 ` [Xen-devel] [PATCH v4 09/13] x86/IRQ: make fixup_irqs() skip unconnected internally used interrupts Jan Beulich
2019-07-16 7:43 ` [Xen-devel] [PATCH v4 10/13] x86/IRQ: drop redundant cpumask_empty() from move_masked_irq() Jan Beulich
2019-07-16 7:43 ` [Xen-devel] [PATCH v4 11/13] x86/IRQ: tighten vector checks Jan Beulich
2019-07-16 7:44 ` [Xen-devel] [PATCH v4 12/13] x86/IRQ: eliminate some on-stack cpumask_t instances Jan Beulich
2019-07-16 7:45 ` [Xen-devel] [PATCH v4 13/13] x86/IRQ: move {,_}clear_irq_vector() Jan Beulich
2019-07-19 12:36 ` [Xen-devel] [PATCH v4 00/13] x86: IRQ management adjustments Andrew Cooper
2019-07-19 13:04 ` Jan Beulich
2019-07-19 13:13 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190724195341.GC25253@amd.com \
--to=brian.woods@amd.com \
--cc=JBeulich@suse.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=kevin.tian@intel.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.