From: David Matlack <dmatlack@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 05/11] PCI: liveupdate: Keep bus numbers constant during Live Update
Date: Thu, 14 May 2026 18:39:22 +0000 [thread overview]
Message-ID: <agYW2pLTsjwuNBg2@google.com> (raw)
In-Reply-To: <20260514013646.C4F8BC19425@smtp.kernel.org>
On 2026-05-14 01:36 AM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Bridge bus numbers are inadvertently cleared for 'broken' topologies during Live Update, modifying the hardware fabric and disrupting active memory transactions.
> --
>
> commit 0f468978660735d49ff81fb445992a21db06f9ce
> Author: David Matlack <dmatlack@google.com>
>
> PCI: liveupdate: Keep bus numbers constant during Live Update
>
> During Live Update, preserved devices must be allowed to continue performing
> memory transactions. This commit modifies the PCI core to always inherit
> bridge bus numbers when any devices are preserved, avoiding topology
> changes that could disrupt ongoing operations.
>
> > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> > index b5fdc5017f921..08ea9324647ba 100644
> > --- a/drivers/pci/probe.c
> > +++ b/drivers/pci/probe.c
>
> [ ... ]
>
> > @@ -1497,8 +1505,7 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,
> > * do in the second pass.
> > */
> > if (!pass) {
> > - if (pcibios_assign_all_busses() || broken)
> > -
> > + if (assign_new_buses || broken)
> > /*
> > * Temporarily disable forwarding of the
> > * configuration cycles on all bridges in
> > @@ -1512,6 +1519,12 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,
> > goto out;
> > }
>
> Does this code accidentally clear the secondary and subordinate bus numbers
> for bridges with a "broken" configuration during a Live Update?
>
> In the first pass (!pass), if the bridge topology is invalid (broken == 1),
> the code enters the if (assign_new_buses || broken) branch and executes a
> pci_write_config_dword() that disables configuration cycles.
>
> Since the pci_liveupdate_inherit_buses() safety check happens after this
> block, the hardware fabric gets modified before the early return. Can this
> disrupt ongoing memory transactions for preserved downstream devices?
No, it is on purpose, not accidental.
If the bridges bus secondary and/or subordinate bus numbers are
misconfigured during a Live Update then the options are:
1. Proceed with enumeration with the misconfigured
secondary/subordinate numbers.
2. Clear the misconfigured numbers and refuse to enumerate further.
3. Clear the misconfigured numbers and then assign new bus numbers.
(1) seems like a bad idea to try to proceed with a misconfigured bridge.
(3) could lead to the bus numbers assigned to preserved endpoints
changing, which could lead to corruption (e.g. memory transactions being
routed to the wrong devices). (2) seems like the only sane option.
>
> > + if (pci_liveupdate_inherit_buses()) {
> > + pci_err(dev, "Cannot reconfigure bridge during Live Update!\n");
> > + pci_err(dev, "Downstream devices will not be enumerated!\n");
> > + goto out;
> > + }
> > +
> > /* Clear errors */
> > pci_write_config_word(dev, PCI_STATUS, 0xffff);
> >
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260512184846.119396-1-dmatlack@google.com?part=5
next prev parent reply other threads:[~2026-05-14 18:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 18:48 [PATCH v5 00/11] PCI: liveupdate: PCI core support for Live Update David Matlack
2026-05-12 18:48 ` [PATCH v5 01/11] PCI: liveupdate: Set up FLB handler for the PCI core David Matlack
2026-05-12 18:48 ` [PATCH v5 02/11] PCI: liveupdate: Track outgoing preserved PCI devices David Matlack
2026-05-14 0:31 ` sashiko-bot
2026-05-14 18:16 ` David Matlack
2026-05-12 18:48 ` [PATCH v5 03/11] PCI: liveupdate: Track incoming " David Matlack
2026-05-14 1:05 ` sashiko-bot
2026-05-14 18:27 ` David Matlack
2026-05-12 18:48 ` [PATCH v5 04/11] PCI: liveupdate: Document driver binding responsibilities David Matlack
2026-05-12 18:48 ` [PATCH v5 05/11] PCI: liveupdate: Keep bus numbers constant during Live Update David Matlack
2026-05-14 1:36 ` sashiko-bot
2026-05-14 18:39 ` David Matlack [this message]
2026-05-12 18:48 ` [PATCH v5 06/11] PCI: liveupdate: Auto-preserve upstream bridges across " David Matlack
2026-05-14 2:05 ` sashiko-bot
2026-05-14 18:41 ` David Matlack
2026-05-12 18:48 ` [PATCH v5 07/11] PCI: liveupdate: Inherit ACS flags in incoming preserved devices David Matlack
2026-05-14 2:37 ` sashiko-bot
2026-05-14 18:46 ` David Matlack
2026-05-12 18:48 ` [PATCH v5 08/11] PCI: liveupdate: Inherit ARI Forwarding Enable on preserved bridges David Matlack
2026-05-12 18:48 ` [PATCH v5 09/11] PCI: liveupdate: Freeze preservation status during shutdown David Matlack
2026-05-14 3:14 ` sashiko-bot
2026-05-14 18:48 ` David Matlack
2026-05-12 18:48 ` [PATCH v5 10/11] PCI: liveupdate: Do not disable bus mastering on preserved devices during kexec David Matlack
2026-05-12 18:48 ` [PATCH v5 11/11] Documentation: PCI: Add documentation for Live Update David Matlack
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=agYW2pLTsjwuNBg2@google.com \
--to=dmatlack@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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