From: Keith Busch <kbusch@kernel.org>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: Keith Busch <kbusch@meta.com>,
linux-pci@vger.kernel.org, bhelgaas@google.com,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCHv2 1/5] pci: make pci_stop_dev concurrent safe
Date: Wed, 2 Oct 2024 18:04:48 -0600 [thread overview]
Message-ID: <Zv3foGpzXKx8adcy@kbusch-mbp> (raw)
In-Reply-To: <20241002233937.jvudgfhxjqbspq6n@offworld>
On Wed, Oct 02, 2024 at 04:39:37PM -0700, Davidlohr Bueso wrote:
> > + set_bit(PCI_DEV_ADDED, &dev->priv_flags);
> > +}
>
> So set_bit does not imply any barriers.
Huh. Hannes told me the same thing just last weak, and I was thinking
"nah, it's an atomic operation." But I'm mistaken thinking that provides
a memory barrier.
> Does this matter in the future when breaking up
> pci_rescan_remove_lock? For example, what prevents things like:
We're still far from being able to remove the big pci rescan/remove
lock, but yes, that's the idea. This should be safe as-is since it is
still using that lock, I can add smp barriers to make the memroy
dependencies explicit.
> pci_bus_add_device() pci_stop_dev()
> pci_dev_assign_added()
> dev->priv_flags [S]
> pci_dev_test_and_clear_added() // true
> dev->priv_flags [L]
> device_attach(&dev->dev)
> device_release_driver(&dev->dev)
>
> ... I guess that implied barrier from that device_lock() in device_attach().
> I am not familiar with this code, but overall I think any locking rework should
> explain more about the ordering implications in the changes if the end result
Oh, goot point. This sequence shouldn't be possible with either the
existing or proposed bus locking, and I can certainly add more detailed
explanations.
next prev parent reply other threads:[~2024-10-03 0:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 19:28 [PATCHv2 0/5] pci cleanup/prep patches Keith Busch
2024-08-27 19:28 ` [PATCHv2 1/5] pci: make pci_stop_dev concurrent safe Keith Busch
2024-10-02 23:39 ` Davidlohr Bueso
2024-10-03 0:04 ` Keith Busch [this message]
2024-08-27 19:28 ` [PATCHv2 2/5] pci: make pci_destroy_dev " Keith Busch
2024-10-03 2:34 ` Davidlohr Bueso
2024-10-03 14:54 ` Keith Busch
2024-10-03 17:04 ` Davidlohr Bueso
2024-10-03 17:59 ` Keith Busch
2024-10-08 2:15 ` Davidlohr Bueso
2024-10-22 20:29 ` Keith Busch
2024-08-27 19:28 ` [PATCHv2 3/5] pci: move the walk bus lock to where its needed Keith Busch
2024-10-03 0:32 ` Davidlohr Bueso
2024-10-09 11:09 ` Ilpo Järvinen
2024-08-27 19:28 ` [PATCHv2 4/5] pci: walk bus recursively Keith Busch
2024-10-09 12:08 ` Ilpo Järvinen
2024-08-27 19:28 ` [PATCHv2 5/5] pci: unexport pci_walk_bus_locked Keith Busch
2024-10-03 0:35 ` Davidlohr Bueso
2024-10-09 12:20 ` Ilpo Järvinen
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=Zv3foGpzXKx8adcy@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=bhelgaas@google.com \
--cc=dave@stgolabs.net \
--cc=kbusch@meta.com \
--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