Re: [RFC][PATCH] Add sysfs entry that displays MSI-X IRQs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-10-28 at 14:08 +1100, Vincent Rizza wrote:
> Hello,
> Currently when MSI-X mode is enabled for a pci device, there's no sysfs entry
> that displays the IRQs. They're listed in /proc/interrupts but when you put two
> identical devices in your system there's no way of telling which device is using
> which IRQ. The value in the "irq" entry is the non-msix irq so in the patch 
> below I've created a "msix" entry that lists a MSI-X IRQ per line.
> 
> Any comments are welcomed. :)
> 
> 
> Signed-off-by: Vincent Rizza <vinnie@xxxxxxx>
> Signed-off-by: Brett Grandbois <brettg@xxxxxxx>
> Signed-off-by: Greg Banks <gnb@xxxxxxx>
> ---
> drivers/pci/pci-sysfs.c |   20 ++++++++++++++++++++
> 1 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 110022d..6c5c8eb 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -18,6 +18,7 @@
> #include <linux/kernel.h>
> #include <linux/sched.h>
> #include <linux/pci.h>
> +#include <linux/msi.h>
> #include <linux/stat.h>
> #include <linux/topology.h>
> #include <linux/mm.h>
> @@ -45,6 +46,22 @@ pci_config_attr(subsystem_device, "0x%04x\n");
> pci_config_attr(class, "0x%06x\n");
> pci_config_attr(irq, "%u\n");
> 
> +#ifdef CONFIG_PCI_MSI
> +static ssize_t msix_show(struct device *dev,
> +                        struct device_attribute *attr, char *buf)
> +{
> +       struct pci_dev *pdev = to_pci_dev(dev);
> +       struct msi_desc *entry;
> +       u32 total = 0;
> +
> +       list_for_each_entry(entry, &pdev->msi_list, list) {
> +               total += sprintf(buf + total, "%u\n", entry->irq);
> +       }
> +
> +       return total;
> +}
> +#endif

Is there anything to stop this being called while we're deleting entries
from the list in msi_free_irqs() ?

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux