[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aIDbwNdWgtKcrfF_@wunner.de>
Date: Wed, 23 Jul 2025 14:55:28 +0200
From: Lukas Wunner <lukas@...ner.de>
To: Manivannan Sadhasivam <manivannan.sadhasivam@....qualcomm.com>
Cc: bhelgaas@...gle.com, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, Shuan He <heshuan@...edance.com>,
kwilczynski@...nel.org
Subject: Re: [PATCH] PCI: Remove redudant calls to
pci_create_sysfs_dev_files() and pci_proc_attach_device()
On Wed, Jul 23, 2025 at 04:41:24PM +0530, Manivannan Sadhasivam wrote:
> Both pci_create_sysfs_dev_files() and pci_proc_attach_device() are called
> from pci_bus_add_device(). Calling these APIs from other places is prone to
> a race condition as nothing prevents the callers from racing against
> each other.
>
> Moreover, the proper place to create SYSFS and PROCFS entries is during
> the 'pci_dev' creation. So there is no real need to call these APIs
> elsewhere.
The raison d'ĂȘtre for the call to pci_create_sysfs_dev_files() in
pci_sysfs_init() is that PCI_ROM_RESOURCEs may appear after device
enumeration but before the late_initcall stage:
https://lore.kernel.org/r/20231019200110.GA1410324@bhelgaas/
Your patch will regress those platforms.
The proper solution is to make the resource files in sysfs static
and call sysfs_update_group() from pci_sysfs_init().
Krzysztof has an old branch where he started working on this:
https://github.com/kwilczynski/linux/commits/kwilczynski/sysfs-static-resource-attributes/
Thanks,
Lukas
Powered by blists - more mailing lists