[+cc Koen, Dexuan from this old thread: https://lore.kernel.org/all/20200716110423.xtfyb3n6tn5ixedh@pali/] On Mon, Jan 31, 2022 at 12:56:18PM +0100, Krzysztof Hałasa wrote: > Bjorn Helgaas <helgaas@xxxxxxxxxx> writes: > > > Thanks. e1d3f3268b0e and related patches converted individual files > > ("config", "rom", "vpd", etc) to static attributes, but since the > > problem you're seeing is with a directory, it's likely different. > > > > I opened this bugzilla report to try to keep this from getting lost: > > https://bugzilla.kernel.org/show_bug.cgi?id=215515 > > Ok, thanks. Koen collected some interesting logs at https://lore.kernel.org/all/cd4812f0-1de3-0582-936c-ba30906595af@xxxxxxxxxxxx/ They're from v5.10, which was before all of Krzysztof W's nice work converting to static attributes, but Koen's log shows the error happening in the pci_sysfs_init() initcall, which is *after* imx6_pcie_probe(): imx6_pcie_probe # probably device initcall (level 6) ... pci_create_sysfs_dev_files pci_sysfs_init # late initcall (level 7) pci_create_sysfs_dev_files "sysfs: cannot create duplicate filename" Krzysztof, you're running v5.14, which includes Krzysztof W's work, but that shouldn't affect the imx6_pcie_probe()/pci_sysfs_init() ordering. Your log shows the error in imx6_pcie_probe(). Would you mind adding the patch below and attaching a complete dmesg log to the bugzilla? Bjorn diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 7bbf2673c7f2..6a2b62fe7704 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1200,6 +1200,9 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine) res_attr->attr.mode = 0600; res_attr->size = pci_resource_len(pdev, num); res_attr->private = (void *)(unsigned long)num; + pci_info(pdev, "pci_create_attr:"); + print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1, + res_attr, 64, true); retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr); if (retval) kfree(res_attr); @@ -1380,6 +1383,9 @@ static const struct attribute_group pci_dev_reset_attr_group = { int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev) { + pci_info(pdev, "pci_create_sysfs_dev_files\n"); + dump_stack(); + if (!sysfs_initialized) return -EACCES;