From: "David Matlack" <dmatlack@google.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"David Matlack" <dmatlack@google.com>
Cc: linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rafael J. Wysocki (Intel)" <rafael@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"Alex Williamson" <alex@shazbot.org>,
LKML <linux-kernel@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH v2 07/16] PCI: Serialize bridge window sizing and resource assignment
Date: Tue, 24 Nov 2026 11:47:47 -0800 [thread overview]
Message-ID: <DN3P8HO01T16.1XHR8MD7J5JSJ@google.com> (raw)
In-Reply-To: <42d7af61-bf69-b440-8685-5d9cec4863dd@linux.intel.com>
On Tue Nov 24, 2026 at 6:10 AM PST, Ilpo Järvinen wrote:
> I don't immediately see anything preventing from moving it into the host
> bridge struct, I'll look into this.
Thanks!
> Not sure if it really helps much currently because pci_bus_sem is also
> held but that might eventually change (there's the series which
> attempted to split that into a separate lock in each bus, I don't
> remember why that work stalled).
A lock per bus seems hard to get right, since a sizing pass or a BAR
resize can span many buses and you'd have to lock up and down the
hierarchy. Per host bridge avoids that.
> ...I already have another (unsubmitted) series that adds
> pci_rescan_remove_lock around host bridge setups because they too can race
> with a sysfs /rescan leading to adding devices more than once, etc.
That would have saved me a lot of head scratching. Please Cc me when you
post it. I'm happy to review it and test it with Live Update.
> Now I actually started to wonder why couldn't pci_rescan_remove_lock also
> be per host bridge?? (+ a separate lock to protect root buses list)
I've been thinking the same thing. Both pci_bus_sem and
pci_rescan_remove_lock could move into struct pci_host_bridge, with a
small global lock for the root buses list as you said.
A big benefit of a per-host-bridge pci_rescan_remove_lock is that it
makes it obvious which lock to take during boot-time scans: the lock of
the host bridge being set up, which nothing else can be holding yet. It
would also solve the re-entrancy problem, at least for VMD.
vmd_remove() could always take the VMD domain's own lock, which is a
different lock from the parent domain's, whether or not the caller
holds the parent's.
Eventually, the per-host-bridge pci_bus_sem and res_setup_lock could be
merged into a single rwsem, with sizing and assignment taking it for
write.
Thanks,
David
next prev parent reply other threads:[~2026-11-24 19:47 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 13:46 [PATCH v2 00/16] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-20 13:46 ` [PATCH v2 01/16] PCI: Add pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-20 13:53 ` sashiko-bot
2026-11-20 13:46 ` [PATCH v2 02/16] alpha/PCI: Convert to pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-20 13:55 ` sashiko-bot
2026-11-20 13:46 ` [PATCH v2 03/16] PCI: Use guard() for pci_bus_sem in pci_do_resource_release_and_resize() Ilpo Järvinen
2026-11-20 13:54 ` sashiko-bot
2026-11-20 13:46 ` [PATCH v2 04/16] PCI: Add pci_assign_unassigned_slot_resources() Ilpo Järvinen
2026-11-20 13:53 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 05/16] PCI: acpiphp: Use pci_assign_unassigned_slot_resources() Ilpo Järvinen
2026-11-20 13:54 ` sashiko-bot
2026-11-20 14:33 ` Rafael J. Wysocki (Intel)
2026-11-20 13:47 ` [PATCH v2 06/16] PCI: Hold pci_bus_sem across sizing and assignment entrypoints Ilpo Järvinen
2026-11-20 13:55 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 07/16] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-20 14:00 ` sashiko-bot
2026-11-24 0:54 ` David Matlack
2026-11-24 14:10 ` Ilpo Järvinen
2026-11-24 19:47 ` David Matlack [this message]
2026-11-20 13:47 ` [PATCH v2 08/16] PCI: Make internal sizing and assignment functions static Ilpo Järvinen
2026-11-20 13:52 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 09/16] EDAC/i82875p: Convert to pci_assign_unassigned_bus_resources() Ilpo Järvinen
2026-11-20 13:56 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 10/16] platform/x86: asus-wmi: " Ilpo Järvinen
2026-11-20 13:53 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 11/16] platform/x86: eeepc-laptop: " Ilpo Järvinen
2026-11-20 13:55 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 12/16] parisc/PCI: " Ilpo Järvinen
2026-11-20 13:59 ` sashiko-bot
2026-11-21 22:27 ` Helge Deller
2026-11-20 13:47 ` [PATCH v2 13/16] PCI: octep_hp: " Ilpo Järvinen
2026-11-20 13:58 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 14/16] PCI: ftpci100: " Ilpo Järvinen
2026-11-20 13:57 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 15/16] PCI: hv: " Ilpo Järvinen
2026-11-20 13:56 ` sashiko-bot
2026-11-20 13:47 ` [PATCH v2 16/16] PCI: Remove pci_bus_assign_resources() Ilpo Järvinen
2026-11-20 13:55 ` sashiko-bot
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=DN3P8HO01T16.1XHR8MD7J5JSJ@google.com \
--to=dmatlack@google.com \
--cc=alex@shazbot.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=stable@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