Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1516468
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/7] genirq/affinity: Handle pre/post vectors in irq_calc_affinity_vectors() |
| Date | 2016-11-07 19:50 +0100 |
| Message-ID | <sAX9w-71s-31@gated-at.bofh.it> (permalink) |
| References | <sAX9w-71s-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Christogh Hellwig <hch@lst.de>
Only calculate the affinity for the main I/O vectors, and skip the
pre or post vectors specified by struct irq_affinity.
Also remove the irq_affinity cpumask argument that has never been used.
If we ever need it in the future we can pass it through struct
irq_affinity.
Signed-off-by: Christogh Hellwig <hch@lst.de>
---
drivers/pci/msi.c | 6 ++----
include/linux/interrupt.h | 4 ++--
kernel/irq/affinity.c | 24 ++++++++++--------------
3 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index ad70507..c58d3c2 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1091,8 +1091,7 @@ static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
for (;;) {
if (affinity) {
- nvec = irq_calc_affinity_vectors(dev->irq_affinity,
- nvec);
+ nvec = irq_calc_affinity_vectors(nvec, NULL);
if (nvec < minvec)
return -ENOSPC;
}
@@ -1140,8 +1139,7 @@ static int __pci_enable_msix_range(struct pci_dev *dev,
for (;;) {
if (affinity) {
- nvec = irq_calc_affinity_vectors(dev->irq_affinity,
- nvec);
+ nvec = irq_calc_affinity_vectors(nvec, NULL);
if (nvec < minvec)
return -ENOSPC;
}
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 7284bcd..092adfb 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -291,7 +291,7 @@ extern int
irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
struct cpumask *irq_create_affinity_masks(const struct cpumask *affinity, int nvec);
-int irq_calc_affinity_vectors(const struct cpumask *affinity, int maxvec);
+int irq_calc_affinity_vectors(int maxvec, const struct irq_affinity *affd);
#else /* CONFIG_SMP */
@@ -331,7 +331,7 @@ irq_create_affinity_masks(const struct cpumask *affinity, int nvec)
}
static inline int
-irq_calc_affinity_vectors(const struct cpumask *affinity, int maxvec)
+irq_calc_affinity_vectors(int maxvec, const struct irq_affinity *affd)
{
return maxvec;
}
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 17f51d63..8d92597 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -131,24 +131,20 @@ struct cpumask *irq_create_affinity_masks(const struct cpumask *affinity,
}
/**
- * irq_calc_affinity_vectors - Calculate to optimal number of vectors for a given affinity mask
- * @affinity: The affinity mask to spread. If NULL cpu_online_mask
- * is used
- * @maxvec: The maximum number of vectors available
+ * irq_calc_affinity_vectors - Calculate the optimal number of vectors
+ * @maxvec: The maximum number of vectors available
+ * @affd: Description of the affinity requirements
*/
-int irq_calc_affinity_vectors(const struct cpumask *affinity, int maxvec)
+int irq_calc_affinity_vectors(int maxvec, const struct irq_affinity *affd)
{
- int cpus, ret;
+ int resv = affd->pre_vectors + affd->post_vectors;
+ int vecs = maxvec - resv;
+ int cpus;
/* Stabilize the cpumasks */
get_online_cpus();
- /* If the supplied affinity mask is NULL, use cpu online mask */
- if (!affinity)
- affinity = cpu_online_mask;
-
- cpus = cpumask_weight(affinity);
- ret = (cpus < maxvec) ? cpus : maxvec;
-
+ cpus = cpumask_weight(cpu_online_mask);
put_online_cpus();
- return ret;
+
+ return min(cpus, vecs) + resv;
}
--
2.1.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
support for partial irq affinity assignment Christoph Hellwig <hch@lst.de> - 2016-11-07 19:50 +0100
[PATCH 1/7] genirq/affinity: Introduce struct irq_affinity Christoph Hellwig <hch@lst.de> - 2016-11-07 19:50 +0100
Re: [PATCH 1/7] genirq/affinity: Introduce struct irq_affinity Johannes Thumshirn <jthumshirn@suse.de> - 2016-11-08 09:20 +0100
Re: [PATCH 1/7] genirq/affinity: Introduce struct irq_affinity Hannes Reinecke <hare@suse.de> - 2016-11-08 09:20 +0100
Re: [PATCH 1/7] genirq/affinity: Introduce struct irq_affinity Bjorn Helgaas <helgaas@kernel.org> - 2016-11-08 22:30 +0100
Re: [PATCH 1/7] genirq/affinity: Introduce struct irq_affinity Christoph Hellwig <hch@lst.de> - 2016-11-08 23:40 +0100
[PATCH 5/7] pci/msi: Provide pci_alloc_irq_vectors_affinity() Christoph Hellwig <hch@lst.de> - 2016-11-07 19:50 +0100
Re: [PATCH 5/7] pci/msi: Provide pci_alloc_irq_vectors_affinity() Hannes Reinecke <hare@suse.de> - 2016-11-08 09:20 +0100
Re: [PATCH 5/7] pci/msi: Provide pci_alloc_irq_vectors_affinity() Johannes Thumshirn <jthumshirn@suse.de> - 2016-11-08 09:30 +0100
Re: [PATCH 5/7] pci/msi: Provide pci_alloc_irq_vectors_affinity() Bjorn Helgaas <helgaas@kernel.org> - 2016-11-08 22:20 +0100
Re: [PATCH 5/7] pci/msi: Provide pci_alloc_irq_vectors_affinity() Christoph Hellwig <hch@lst.de> - 2016-11-08 22:30 +0100
[PATCH 4/7] pci/msi: Propagate irq affinity description through the MSI code Christoph Hellwig <hch@lst.de> - 2016-11-07 19:50 +0100
Re: [PATCH 4/7] pci/msi: Propagate irq affinity description through the MSI code Hannes Reinecke <hare@suse.de> - 2016-11-08 09:20 +0100
Re: [PATCH 4/7] pci/msi: Propagate irq affinity description through the MSI code Johannes Thumshirn <jthumshirn@suse.de> - 2016-11-08 09:30 +0100
Re: [PATCH 4/7] pci/msi: Propagate irq affinity description through the MSI code Bjorn Helgaas <helgaas@kernel.org> - 2016-11-08 22:20 +0100
[PATCH 7/7] blk-mq: add a first_vec argument to blk_mq_pci_map_queues Christoph Hellwig <hch@lst.de> - 2016-11-07 19:50 +0100
Re: [PATCH 7/7] blk-mq: add a first_vec argument to blk_mq_pci_map_queues Johannes Thumshirn <jthumshirn@suse.de> - 2016-11-08 09:30 +0100
[PATCH 2/7] genirq/affinity: Handle pre/post vectors in irq_calc_affinity_vectors() Christoph Hellwig <hch@lst.de> - 2016-11-07 19:50 +0100
Re: [PATCH 2/7] genirq/affinity: Handle pre/post vectors in irq_calc_affinity_vectors() Hannes Reinecke <hare@suse.de> - 2016-11-08 09:20 +0100
Re: [PATCH 2/7] genirq/affinity: Handle pre/post vectors in irq_calc_affinity_vectors() Thomas Gleixner <tglx@linutronix.de> - 2016-11-08 15:50 +0100
[PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Christoph Hellwig <hch@lst.de> - 2016-11-07 19:50 +0100
Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Hannes Reinecke <hare@suse.de> - 2016-11-08 09:20 +0100
Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Christoph Hellwig <hch@lst.de> - 2016-11-08 16:00 +0100
Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Hannes Reinecke <hare@suse.de> - 2016-11-08 16:00 +0100
Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Christoph Hellwig <hch@lst.de> - 2016-11-08 16:10 +0100
Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Christoph Hellwig <hch@lst.de> - 2016-11-08 17:40 +0100
Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Thomas Gleixner <tglx@linutronix.de> - 2016-11-08 17:40 +0100
Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks() Bjorn Helgaas <helgaas@kernel.org> - 2016-11-08 22:30 +0100
[PATCH 6/7] pci: Remove the irq_affinity mask from struct pci_dev Christoph Hellwig <hch@lst.de> - 2016-11-07 20:00 +0100
Re: [PATCH 6/7] pci: Remove the irq_affinity mask from struct pci_dev Hannes Reinecke <hare@suse.de> - 2016-11-08 09:20 +0100
Re: [PATCH 6/7] pci: Remove the irq_affinity mask from struct pci_dev Johannes Thumshirn <jthumshirn@suse.de> - 2016-11-08 09:30 +0100
Re: [PATCH 6/7] pci: Remove the irq_affinity mask from struct pci_dev Bjorn Helgaas <helgaas@kernel.org> - 2016-11-08 22:10 +0100
csiph-web