Re: [PATCH v2 1/2] PCI/MSI: Fix the confusing IRQ sysfs ABI for MSI-X

From: Marc Zyngier
Date: Mon Aug 23 2021 - 06:33:22 EST


On Sat, 21 Aug 2021 23:41:17 +0100,
Barry Song <21cnbao@xxxxxxxxx> wrote:

[...]

> > So probably we should set this ABI invisible when devices are using
> > MSI or MSI-X?
>
> i mean something like the below,
>
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 5d63df7..1323841 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -26,6 +26,7 @@
> #include <linux/slab.h>
> #include <linux/vgaarb.h>
> #include <linux/pm_runtime.h>
> +#include <linux/msi.h>
> #include <linux/of.h>
> #include "pci.h"
>
> @@ -1437,6 +1438,16 @@ static umode_t pci_dev_attrs_are_visible(struct
> kobject *kobj,
> if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
> return 0;
>
> +#ifdef CONFIG_PCI_MSI
> + /*
> + * if devices are MSI and MSI-X, IRQ sysfs ABI is meaningless
> + * and broken
> + */
> + if (a == &dev_attr_irq.attr)
> + if (first_pci_msi_entry(pdev))
> + return 0;
> +#endif
> +
> return a->mode;
> }

I don't think you can break what we have today. Whatever change we
make to the kernel internals, the userspace view must stay unchanged.

M.

--
Without deviation from the norm, progress is not possible.