Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1243724 > unrolled thread

Re: [PATCH] PCI/MSI: Export all remapped MSIs to sysfs attributes

Started byBjorn Helgaas <helgaas@kernel.org>
First post2015-10-10 00:40 +0200
Last post2015-10-11 11:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] PCI/MSI: Export all remapped MSIs to sysfs attributes Bjorn Helgaas <helgaas@kernel.org> - 2015-10-10 00:40 +0200
    Re: [PATCH] PCI/MSI: Export all remapped MSIs to sysfs attributes Thomas Gleixner <tglx@linutronix.de> - 2015-10-11 11:50 +0200

#1243724 — Re: [PATCH] PCI/MSI: Export all remapped MSIs to sysfs attributes

FromBjorn Helgaas <helgaas@kernel.org>
Date2015-10-10 00:40 +0200
SubjectRe: [PATCH] PCI/MSI: Export all remapped MSIs to sysfs attributes
Message-ID<qhOut-7eA-11@gated-at.bofh.it>
[+cc Neil, Thomas, linux-kernel]

Hi Romain,

On Thu, Sep 24, 2015 at 01:31:16AM +0200, Romain Bezut wrote:
> irqbalance uses these attributes to populate its internal database, which is
> then used to bind the irq on the appropriate NUMA node.
> 
> On a device accepting multiple MSIs and with interrupt remapping enabled,
> only the first irq entry is exported to msi_irqs directory.
> This results in irqbalance having no clue of the NUMA affinity for the extra
> irqs and starting to bind them on random nodes.
> 
> This patch exports all MSI interrupts as sysfs attributes when relevant.
> 
> Signed-off-by: Romain Bezut <rbezut@gmail.com>

This seems like it makes sense to me.  Do you have any bug reports
related to this problem?  If so, I'll mention them in the changelog.

Added Neil, Thomas, and linux-kernel since this is of interest to folks
beyond the usual linux-pci audience.

> ---
>  drivers/pci/msi.c | 31 +++++++++++++++++--------------
>  1 file changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index d449714..324a164 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -475,10 +475,11 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
>  	int ret = -ENOMEM;
>  	int num_msi = 0;
>  	int count = 0;
> +	int i;
>  
>  	/* Determine how many msi entries we have */
>  	for_each_pci_msi_entry(entry, pdev)
> -		++num_msi;
> +		num_msi += entry->nvec_used;
>  	if (!num_msi)
>  		return 0;
>  
> @@ -487,19 +488,21 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
>  	if (!msi_attrs)
>  		return -ENOMEM;
>  	for_each_pci_msi_entry(entry, pdev) {
> -		msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);
> -		if (!msi_dev_attr)
> -			goto error_attrs;
> -		msi_attrs[count] = &msi_dev_attr->attr;
> -
> -		sysfs_attr_init(&msi_dev_attr->attr);
> -		msi_dev_attr->attr.name = kasprintf(GFP_KERNEL, "%d",
> -						    entry->irq);
> -		if (!msi_dev_attr->attr.name)
> -			goto error_attrs;
> -		msi_dev_attr->attr.mode = S_IRUGO;
> -		msi_dev_attr->show = msi_mode_show;
> -		++count;
> +		for (i = 0; i < entry->nvec_used; i++) {
> +			msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);
> +			if (!msi_dev_attr)
> +				goto error_attrs;
> +			msi_attrs[count] = &msi_dev_attr->attr;
> +
> +			sysfs_attr_init(&msi_dev_attr->attr);
> +			msi_dev_attr->attr.name = kasprintf(GFP_KERNEL, "%d",
> +							    entry->irq + i);
> +			if (!msi_dev_attr->attr.name)
> +				goto error_attrs;
> +			msi_dev_attr->attr.mode = S_IRUGO;
> +			msi_dev_attr->show = msi_mode_show;
> +			++count;
> +		}
>  	}
>  
>  	msi_irq_group = kzalloc(sizeof(*msi_irq_group), GFP_KERNEL);
> -- 
> 2.4.9
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1244087

FromThomas Gleixner <tglx@linutronix.de>
Date2015-10-11 11:50 +0200
Message-ID<qilqp-4vD-3@gated-at.bofh.it>
In reply to#1243724
On Fri, 9 Oct 2015, Bjorn Helgaas wrote:
> On Thu, Sep 24, 2015 at 01:31:16AM +0200, Romain Bezut wrote:
> > irqbalance uses these attributes to populate its internal database, which is
> > then used to bind the irq on the appropriate NUMA node.
> > 
> > On a device accepting multiple MSIs and with interrupt remapping enabled,
> > only the first irq entry is exported to msi_irqs directory.
> > This results in irqbalance having no clue of the NUMA affinity for the extra
> > irqs and starting to bind them on random nodes.
> > 
> > This patch exports all MSI interrupts as sysfs attributes when relevant.
> > 
> > Signed-off-by: Romain Bezut <rbezut@gmail.com>
> 
> This seems like it makes sense to me.  Do you have any bug reports
> related to this problem?  If so, I'll mention them in the changelog.
> 
> Added Neil, Thomas, and linux-kernel since this is of interest to folks
> beyond the usual linux-pci audience.

Acked-by: Thomas Gleixner <tglx@linutronix.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web