[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <612dfdd2-7de1-12a7-c47c-7569c3466224@suse.com>
Date: Thu, 16 Mar 2023 12:17:32 +0100
From: Oliver Neukum <oneukum@...e.com>
To: Alexander Stein <alexander.stein@...tq-group.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Oliver Neukum <oneukum@...e.com>
Cc: Korneliusz Osmenda <korneliuszo@...il.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] Guard pci_create_sysfs_dev_files with atomic value
On 16.03.23 10:33, Alexander Stein wrote:
> Hi Oliver,
Hi,
>
> Admittedly
> I would like to get rid of these two pathes for creating sysfs files in the
> first place, but I do not know the pci subsystem very well.
> IMHO for_each_pci_dev(pdev) in pci_sysfs_init is part of the problem as it
> unconditionally iterates over the bus, without any locks, thus creating sysfs
> files for each device added to the bus.
> Any ideas?
First of all, this existing code is a mess.
If I understand you have the issue that your driver adds a bridge
in dw_pcie_host_init() and the generic code in pci_create_sysfs_dev_files()
populates the directory before or while your driver does so and
the devices are effectively discovered twice.
It seems to me that you must not add a bridge before pci_create_sysfs_dev_files()
has finished. Now you could add a wait_queue and a flag and wait for it to
finish. But that is not very elegant. From which initcall is your driver
probed?
Regards
Oliver
Powered by blists - more mailing lists