Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1440028
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 08/13] pci: spread interrupt vectors in pci_alloc_irq_vectors |
| Date | 2016-07-10 06:00 +0200 |
| Message-ID | <rTe4p-3JN-1@gated-at.bofh.it> (permalink) |
| References | <rR7A5-3l0-13@gated-at.bofh.it> <rR7JM-3ot-23@gated-at.bofh.it> <rSflT-66A-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jul 07, 2016 at 01:05:01PM +0200, Alexander Gordeev wrote:
> irq_create_affinity_mask() bails out with no affinity in case of single
> vector, but alloc_descs() (see below (*)) assigns the whole affinity
> mask. It should be consistent instead.
I don't understand the comment. If we only have one vector (of any
kinds) there is no need to create an affinity mask, we'll leave the
interrupt to the existing irq balancing code.
> Actually, I just realized pci_alloc_irq_vectors() should probably call
> irq_create_affinity_mask() and handle it in a consistent way for all four
> cases: MSI-X, mulit-MSI, MSI and legacy.
That's what the earlier versions did, but you correctly pointed out
that we should call irq_create_affinity_mask only after we have reduced
the number of vectors to the number that the bridges can route, i.e.
that we have to move it into the pci_enable_msi(x)_range main loop.
> Optionally, the three latter could be dropped for now so you could proceed
> with NVMe.
NVMe cares for all these cases at least in theory.
> (*) In the future IRQ vs CPU mapping 1:N is possible/desirable so I suppose
> this piece of code worth a comment or better - a separate function. In fact,
> this algorithm already exists in alloc_descs(), which makes even more sense
> to factor it out:
>
> for (i = 0; i < cnt; i++) {
> if (affinity) {
> cpu = cpumask_next(cpu, affinity);
> if (cpu >= nr_cpu_ids)
> cpu = cpumask_first(affinity);
> node = cpu_to_node(cpu);
>
> /*
> * For single allocations we use the caller provided
> * mask otherwise we use the mask of the target cpu
> */
> mask = cnt == 1 ? affinity : cpumask_of(cpu);
> }
>
> [...]
While these two pieces of code look very similar there is an important
difference in why and how the mask is calculated. In alloc_descs()
the difference here is that cnt = 1 is the MSI-X case where the
passed in affinity is that for the MSI-X descriptor which is for
a single vector. in the MSI case where we have multiple vectors per
descriptor a different affinity is asigned for each vector based
of a single passed in mask.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
automatic interrupt affinity for MSI/MSI-X capable devices V3 Christoph Hellwig <hch@lst.de> - 2016-07-04 10:40 +0200
[PATCH 04/13] irq: Use affinity hint in irqdesc allocation Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[tip:irq/core] genirq: Use affinity hint in irqdesc allocation tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-04 12:40 +0200
[PATCH 02/13] irq: Introduce IRQD_AFFINITY_MANAGED flag Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[tip:irq/core] genirq: Introduce IRQD_AFFINITY_MANAGED flag tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-04 12:40 +0200
[PATCH 05/13] irq/msi: Make use of affinity aware allocations Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[tip:irq/core] genirq/msi: Make use of affinity aware allocations tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-04 12:40 +0200
[PATCH 11/13] blk-mq: allow the driver to pass in an affinity mask Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[PATCH 13/13] nvme: remove the post_scan callout Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[PATCH 08/13] pci: spread interrupt vectors in pci_alloc_irq_vectors Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
Re: [PATCH 08/13] pci: spread interrupt vectors in pci_alloc_irq_vectors Alexander Gordeev <agordeev@redhat.com> - 2016-07-07 13:10 +0200
Re: [PATCH 08/13] pci: spread interrupt vectors in pci_alloc_irq_vectors Christoph Hellwig <hch@lst.de> - 2016-07-10 06:00 +0200
Re: [PATCH 08/13] pci: spread interrupt vectors in pci_alloc_irq_vectors Alexander Gordeev <agordeev@redhat.com> - 2016-07-12 08:50 +0200
[PATCH 01/13] irq/msi: Remove unused MSI_FLAG_IDENTITY_MAP Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[tip:irq/core] genirq/msi: Remove unused MSI_FLAG_IDENTITY_MAP tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-04 12:40 +0200
[PATCH 12/13] nvme: switch to use pci_alloc_irq_vectors Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
Re: [PATCH 12/13] nvme: switch to use pci_alloc_irq_vectors Alexander Gordeev <agordeev@redhat.com> - 2016-07-07 21:40 +0200
Re: [PATCH 12/13] nvme: switch to use pci_alloc_irq_vectors Christoph Hellwig <hch@lst.de> - 2016-07-10 06:00 +0200
[PATCH 10/13] blk-mq: only allocate a single mq_map per tag_set Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[PATCH 09/13] blk-mq: don't redistribute hardware queues on a CPU hotplug event Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[PATCH 06/13] irq: add a helper spread an affinity mask for MSI/MSI-X vectors Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[tip:irq/core] genirq: Add a helper to spread an affinity mask for MSI/MSI-X vectors tip-bot for Christoph Hellwig <tipbot@zytor.com> - 2016-07-04 12:40 +0200
[PATCH 07/13] pci: Provide sensible irq vector alloc/free routines Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
Re: [PATCH 07/13] pci: Provide sensible irq vector alloc/free routines Alexander Gordeev <agordeev@redhat.com> - 2016-07-06 10:10 +0200
Re: [PATCH 07/13] pci: Provide sensible irq vector alloc/free routines Christoph Hellwig <hch@lst.de> - 2016-07-10 05:50 +0200
Re: [PATCH 07/13] pci: Provide sensible irq vector alloc/free routines Alexander Gordeev <agordeev@redhat.com> - 2016-07-11 12:40 +0200
Re: [PATCH 07/13] pci: Provide sensible irq vector alloc/free routines Christoph Hellwig <hch@lst.de> - 2016-07-12 11:20 +0200
Re: [PATCH 07/13] pci: Provide sensible irq vector alloc/free routines Alexander Gordeev <agordeev@redhat.com> - 2016-07-12 14:50 +0200
[PATCH 03/13] irq: Add affinity hint to irq allocation Christoph Hellwig <hch@lst.de> - 2016-07-04 10:50 +0200
[tip:irq/core] genirq: Add affinity hint to irq allocation tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-04 12:40 +0200
Re: automatic interrupt affinity for MSI/MSI-X capable devices V3 Thomas Gleixner <tglx@linutronix.de> - 2016-07-04 12:40 +0200
csiph-web