From: Oliver Neukum <oneukum@suse.com>
To: Alexander Stein <alexander.stein@ew.tq-group.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Oliver Neukum <oneukum@suse.com>
Cc: Korneliusz Osmenda <korneliuszo@gmail.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] Guard pci_create_sysfs_dev_files with atomic value
Date: Thu, 16 Mar 2023 12:17:32 +0100 [thread overview]
Message-ID: <612dfdd2-7de1-12a7-c47c-7569c3466224@suse.com> (raw)
In-Reply-To: <6131694.LvFx2qVVIh@steina-w>
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
next prev parent reply other threads:[~2023-03-16 11:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 9:15 [PATCH v2 1/1] Guard pci_create_sysfs_dev_files with atomic value Alexander Stein
2023-03-16 9:18 ` Alexander Stein
2023-03-16 9:23 ` Oliver Neukum
2023-03-16 9:33 ` Alexander Stein
2023-03-16 11:17 ` Oliver Neukum [this message]
2023-03-16 11:58 ` Alexander Stein
2023-03-16 12:23 ` Oliver Neukum
2023-03-16 13:16 ` Alexander Stein
2023-03-16 14:01 ` Oliver Neukum
2023-03-16 15:00 ` Alexander Stein
2023-03-21 9:09 ` Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=612dfdd2-7de1-12a7-c47c-7569c3466224@suse.com \
--to=oneukum@suse.com \
--cc=alexander.stein@ew.tq-group.com \
--cc=bhelgaas@google.com \
--cc=korneliuszo@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox