Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Hannes Reinecke

On 11/09/2016 02:15 AM, Christoph Hellwig wrote:

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: Christoph Hellwig 
Acked-by: Bjorn Helgaas 
---
 drivers/pci/msi.c |  6 --
 include/linux/interrupt.h |  4 ++--
 kernel/irq/affinity.c | 46 +-
 3 files changed, 31 insertions(+), 25 deletions(-)


Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
--
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Hannes Reinecke

On 11/09/2016 02:15 AM, Christoph Hellwig wrote:

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: Christoph Hellwig 
Acked-by: Bjorn Helgaas 
---
 drivers/pci/msi.c |  6 --
 include/linux/interrupt.h |  4 ++--
 kernel/irq/affinity.c | 46 +-
 3 files changed, 31 insertions(+), 25 deletions(-)


Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
--
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Bjorn Helgaas
On Mon, Nov 07, 2016 at 10:47:38AM -0800, Christoph Hellwig wrote:
> From: Christogh Hellwig 
> 
> 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 

s/Christogh/Christoph/ (also above, and maybe other patches too?)

Acked-by: Bjorn Helgaas 

> ---
>  drivers/pci/msi.c |  4 ++--
>  include/linux/interrupt.h |  4 ++--
>  kernel/irq/affinity.c | 46 +-
>  3 files changed, 29 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index c58d3c2..1761b8a 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -558,7 +558,7 @@ msi_setup_entry(struct pci_dev *dev, int nvec, bool 
> affinity)
>   u16 control;
>  
>   if (affinity) {
> - masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
> + masks = irq_create_affinity_masks(nvec, NULL);
>   if (!masks)
>   pr_err("Unable to allocate affinity masks, ignoring\n");
>   }
> @@ -697,7 +697,7 @@ static int msix_setup_entries(struct pci_dev *dev, void 
> __iomem *base,
>   int ret, i;
>  
>   if (affinity) {
> - masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
> + masks = irq_create_affinity_masks(nvec, NULL);
>   if (!masks)
>   pr_err("Unable to allocate affinity masks, ignoring\n");

Not caused by this patch, but can we use dev_err() here and above?


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Bjorn Helgaas
On Mon, Nov 07, 2016 at 10:47:38AM -0800, Christoph Hellwig wrote:
> From: Christogh Hellwig 
> 
> 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 

s/Christogh/Christoph/ (also above, and maybe other patches too?)

Acked-by: Bjorn Helgaas 

> ---
>  drivers/pci/msi.c |  4 ++--
>  include/linux/interrupt.h |  4 ++--
>  kernel/irq/affinity.c | 46 +-
>  3 files changed, 29 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index c58d3c2..1761b8a 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -558,7 +558,7 @@ msi_setup_entry(struct pci_dev *dev, int nvec, bool 
> affinity)
>   u16 control;
>  
>   if (affinity) {
> - masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
> + masks = irq_create_affinity_masks(nvec, NULL);
>   if (!masks)
>   pr_err("Unable to allocate affinity masks, ignoring\n");
>   }
> @@ -697,7 +697,7 @@ static int msix_setup_entries(struct pci_dev *dev, void 
> __iomem *base,
>   int ret, i;
>  
>   if (affinity) {
> - masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
> + masks = irq_create_affinity_masks(nvec, NULL);
>   if (!masks)
>   pr_err("Unable to allocate affinity masks, ignoring\n");

Not caused by this patch, but can we use dev_err() here and above?


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Christoph Hellwig
On Tue, Nov 08, 2016 at 05:27:52PM +0100, Thomas Gleixner wrote:
> On Tue, 8 Nov 2016, Christoph Hellwig wrote:
> 
> > On Tue, Nov 08, 2016 at 03:59:16PM +0100, Hannes Reinecke wrote:
> > >
> > > Which you don't in this patch:
> > 
> > True.  We will always in the end, but the split isn't right, we'll
> > need to pass the non-NULL argument starting in this patch.
> 
> No, in the previous one 

That too, but it's for different functions.  I have a rebased version
that does this, I'll run it through quick testing and will repost
it later today.


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Christoph Hellwig
On Tue, Nov 08, 2016 at 05:27:52PM +0100, Thomas Gleixner wrote:
> On Tue, 8 Nov 2016, Christoph Hellwig wrote:
> 
> > On Tue, Nov 08, 2016 at 03:59:16PM +0100, Hannes Reinecke wrote:
> > >
> > > Which you don't in this patch:
> > 
> > True.  We will always in the end, but the split isn't right, we'll
> > need to pass the non-NULL argument starting in this patch.
> 
> No, in the previous one 

That too, but it's for different functions.  I have a rebased version
that does this, I'll run it through quick testing and will repost
it later today.


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Christoph Hellwig wrote:

> On Tue, Nov 08, 2016 at 03:59:16PM +0100, Hannes Reinecke wrote:
> >
> > Which you don't in this patch:
> 
> True.  We will always in the end, but the split isn't right, we'll
> need to pass the non-NULL argument starting in this patch.

No, in the previous one 
 


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Christoph Hellwig wrote:

> On Tue, Nov 08, 2016 at 03:59:16PM +0100, Hannes Reinecke wrote:
> >
> > Which you don't in this patch:
> 
> True.  We will always in the end, but the split isn't right, we'll
> need to pass the non-NULL argument starting in this patch.

No, in the previous one 
 


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Hannes Reinecke

On 11/08/2016 03:55 PM, Christoph Hellwig wrote:

[please trim the f***king context in your replies, thanks..]

On Tue, Nov 08, 2016 at 09:15:27AM +0100, Hannes Reinecke wrote:

+irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 {
-   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec = 0;
+   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec;
+   int affv = nvecs - affd->pre_vectors - affd->post_vectors;
nodemask_t nodemsk = NODE_MASK_NONE;
struct cpumask *masks;
cpumask_var_t nmsk;

Check for NULL affd?


We expect all callers to pass a valid one.


Which you don't in this patch:

@@ -697,7 +697,7 @@ static int msix_setup_entries(struct pci_dev *dev, 
void __iomem *base,

 int ret, i;

 if (affinity) {
-masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
+masks = irq_create_affinity_masks(nvec, NULL);
 if (!masks)
 pr_err("Unable to allocate affinity masks, ignoring\n");
 }

Cheers,

Hannes
--
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Hannes Reinecke

On 11/08/2016 03:55 PM, Christoph Hellwig wrote:

[please trim the f***king context in your replies, thanks..]

On Tue, Nov 08, 2016 at 09:15:27AM +0100, Hannes Reinecke wrote:

+irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 {
-   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec = 0;
+   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec;
+   int affv = nvecs - affd->pre_vectors - affd->post_vectors;
nodemask_t nodemsk = NODE_MASK_NONE;
struct cpumask *masks;
cpumask_var_t nmsk;

Check for NULL affd?


We expect all callers to pass a valid one.


Which you don't in this patch:

@@ -697,7 +697,7 @@ static int msix_setup_entries(struct pci_dev *dev, 
void __iomem *base,

 int ret, i;

 if (affinity) {
-masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
+masks = irq_create_affinity_masks(nvec, NULL);
 if (!masks)
 pr_err("Unable to allocate affinity masks, ignoring\n");
 }

Cheers,

Hannes
--
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Christoph Hellwig
On Tue, Nov 08, 2016 at 03:59:16PM +0100, Hannes Reinecke wrote:
>
> Which you don't in this patch:

True.  We will always in the end, but the split isn't right, we'll
need to pass the non-NULL argument starting in this patch.


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Christoph Hellwig
On Tue, Nov 08, 2016 at 03:59:16PM +0100, Hannes Reinecke wrote:
>
> Which you don't in this patch:

True.  We will always in the end, but the split isn't right, we'll
need to pass the non-NULL argument starting in this patch.


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Christoph Hellwig
[please trim the f***king context in your replies, thanks..]

On Tue, Nov 08, 2016 at 09:15:27AM +0100, Hannes Reinecke wrote:
>> +irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
>>  {
>> -int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec = 0;
>> +int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec;
>> +int affv = nvecs - affd->pre_vectors - affd->post_vectors;
>>  nodemask_t nodemsk = NODE_MASK_NONE;
>>  struct cpumask *masks;
>>  cpumask_var_t nmsk;
> Check for NULL affd?

We expect all callers to pass a valid one.


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Christoph Hellwig
[please trim the f***king context in your replies, thanks..]

On Tue, Nov 08, 2016 at 09:15:27AM +0100, Hannes Reinecke wrote:
>> +irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
>>  {
>> -int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec = 0;
>> +int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec;
>> +int affv = nvecs - affd->pre_vectors - affd->post_vectors;
>>  nodemask_t nodemsk = NODE_MASK_NONE;
>>  struct cpumask *masks;
>>  cpumask_var_t nmsk;
> Check for NULL affd?

We expect all callers to pass a valid one.


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Hannes Reinecke

On 11/07/2016 07:47 PM, Christoph Hellwig wrote:

From: Christogh Hellwig 

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 
---
 drivers/pci/msi.c |  4 ++--
 include/linux/interrupt.h |  4 ++--
 kernel/irq/affinity.c | 46 +-
 3 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index c58d3c2..1761b8a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -558,7 +558,7 @@ msi_setup_entry(struct pci_dev *dev, int nvec, bool 
affinity)
u16 control;

if (affinity) {
-   masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
+   masks = irq_create_affinity_masks(nvec, NULL);
if (!masks)
pr_err("Unable to allocate affinity masks, ignoring\n");
}
@@ -697,7 +697,7 @@ static int msix_setup_entries(struct pci_dev *dev, void 
__iomem *base,
int ret, i;

if (affinity) {
-   masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
+   masks = irq_create_affinity_masks(nvec, NULL);
if (!masks)
pr_err("Unable to allocate affinity masks, ignoring\n");
}
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 092adfb..bca8f1c 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -290,7 +290,7 @@ extern int irq_set_affinity_hint(unsigned int irq, const 
struct cpumask *m);
 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);
+struct cpumask *irq_create_affinity_masks(int nvec, const struct irq_affinity 
*affd);
 int irq_calc_affinity_vectors(int maxvec, const struct irq_affinity *affd);

 #else /* CONFIG_SMP */
@@ -325,7 +325,7 @@ irq_set_affinity_notifier(unsigned int irq, struct 
irq_affinity_notify *notify)
 }

 static inline struct cpumask *
-irq_create_affinity_masks(const struct cpumask *affinity, int nvec)
+irq_create_affinity_masks(int nvec, const struct irq_affinity *affd)
 {
return NULL;
 }
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 8d92597..17360bd 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -51,16 +51,16 @@ static int get_nodes_in_cpumask(const struct cpumask *mask, 
nodemask_t *nodemsk)

 /**
  * irq_create_affinity_masks - Create affinity masks for multiqueue spreading
- * @affinity:  The affinity mask to spread. If NULL cpu_online_mask
- * is used
- * @nvecs: The number of vectors
+ * @nvecs: The total number of vectors
+ * @affd:  Description of the affinity requirements
  *
  * Returns the masks pointer or NULL if allocation failed.
  */
-struct cpumask *irq_create_affinity_masks(const struct cpumask *affinity,
- int nvec)
+struct cpumask *
+irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 {
-   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec = 0;
+   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec;
+   int affv = nvecs - affd->pre_vectors - affd->post_vectors;
nodemask_t nodemsk = NODE_MASK_NONE;
struct cpumask *masks;
cpumask_var_t nmsk;

Check for NULL affd?

Cheers,

Hannes
--
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 3/7] genirq/affinity: Handle pre/post vectors in irq_create_affinity_masks()

2016-11-08 Thread Hannes Reinecke

On 11/07/2016 07:47 PM, Christoph Hellwig wrote:

From: Christogh Hellwig 

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 
---
 drivers/pci/msi.c |  4 ++--
 include/linux/interrupt.h |  4 ++--
 kernel/irq/affinity.c | 46 +-
 3 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index c58d3c2..1761b8a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -558,7 +558,7 @@ msi_setup_entry(struct pci_dev *dev, int nvec, bool 
affinity)
u16 control;

if (affinity) {
-   masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
+   masks = irq_create_affinity_masks(nvec, NULL);
if (!masks)
pr_err("Unable to allocate affinity masks, ignoring\n");
}
@@ -697,7 +697,7 @@ static int msix_setup_entries(struct pci_dev *dev, void 
__iomem *base,
int ret, i;

if (affinity) {
-   masks = irq_create_affinity_masks(dev->irq_affinity, nvec);
+   masks = irq_create_affinity_masks(nvec, NULL);
if (!masks)
pr_err("Unable to allocate affinity masks, ignoring\n");
}
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 092adfb..bca8f1c 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -290,7 +290,7 @@ extern int irq_set_affinity_hint(unsigned int irq, const 
struct cpumask *m);
 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);
+struct cpumask *irq_create_affinity_masks(int nvec, const struct irq_affinity 
*affd);
 int irq_calc_affinity_vectors(int maxvec, const struct irq_affinity *affd);

 #else /* CONFIG_SMP */
@@ -325,7 +325,7 @@ irq_set_affinity_notifier(unsigned int irq, struct 
irq_affinity_notify *notify)
 }

 static inline struct cpumask *
-irq_create_affinity_masks(const struct cpumask *affinity, int nvec)
+irq_create_affinity_masks(int nvec, const struct irq_affinity *affd)
 {
return NULL;
 }
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 8d92597..17360bd 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -51,16 +51,16 @@ static int get_nodes_in_cpumask(const struct cpumask *mask, 
nodemask_t *nodemsk)

 /**
  * irq_create_affinity_masks - Create affinity masks for multiqueue spreading
- * @affinity:  The affinity mask to spread. If NULL cpu_online_mask
- * is used
- * @nvecs: The number of vectors
+ * @nvecs: The total number of vectors
+ * @affd:  Description of the affinity requirements
  *
  * Returns the masks pointer or NULL if allocation failed.
  */
-struct cpumask *irq_create_affinity_masks(const struct cpumask *affinity,
- int nvec)
+struct cpumask *
+irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 {
-   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec = 0;
+   int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec;
+   int affv = nvecs - affd->pre_vectors - affd->post_vectors;
nodemask_t nodemsk = NODE_MASK_NONE;
struct cpumask *masks;
cpumask_var_t nmsk;

Check for NULL affd?

Cheers,

Hannes
--
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)