Linux PCI subsystem development
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 09/11] PCI: liveupdate: Freeze preservation status during shutdown
Date: Thu, 14 May 2026 18:48:55 +0000	[thread overview]
Message-ID: <agYZF7W-hRtj_IX6@google.com> (raw)
In-Reply-To: <20260514031440.483F0C19425@smtp.kernel.org>

On 2026-05-14 03:14 AM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [High] Preservation rollback fails if the device is concurrently frozen, breaking bridge hierarchy invariants.
> - [Low] Syntax error in the !CONFIG_PCI_LIVEUPDATE stub for pci_liveupdate_freeze().
> --
> 
> commit f49768e50767ced554fd83ab7e5016423c3d87a2
> Author: David Matlack <dmatlack@google.com>
> 
> PCI: liveupdate: Freeze preservation status during shutdown
> 
> Freeze a device's outgoing preservation status (preserved or not preserved)
> during shutdown. This enables the PCI core and drivers to safely make
> decisions based on the device's preservation status during shutdown.
> 
> > diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c
> > index 6ab03bd548b37..825166a579130 100644
> > --- a/drivers/pci/liveupdate.c
> > +++ b/drivers/pci/liveupdate.c
> > @@ -334,6 +334,11 @@ static int pci_liveupdate_unpreserve_device(struct pci_ser *ser, struct pci_dev
> >  
> >  	guard(write_lock)(&dev->liveupdate.lock);
> >  
> > +	if (dev->liveupdate.frozen) {
> > +		pci_WARN(dev, 1, "Cannot unpreserve device after it is frozen!\n");
> > +		return -EINVAL;
> > +	}
> 
> During preservation rollback, can this check leave a child device preserved
> while its parent is not?
> 
> If pci_liveupdate_preserve_path() successfully preserves a child device,
> but fails to preserve the parent bridge, it attempts to roll back by calling
> pci_liveupdate_unpreserve_device() on the child.
> 
> If a concurrent system shutdown calls pci_liveupdate_freeze() on the child
> device before this rollback occurs, this check will return -EINVAL and
> fail the rollback.
> 
> Does this result in a broken topology being passed to the incoming kernel?

Hm yes that race does look possible. Will fix in v6.

> 
> [ ... ]
> 
> > diff --git a/drivers/pci/liveupdate.h b/drivers/pci/liveupdate.h
> > index fd7693c7ddd21..30deaa673efed 100644
> > --- a/drivers/pci/liveupdate.h
> > +++ b/drivers/pci/liveupdate.h
> [ ... ]
> > @@ -26,6 +27,10 @@ static inline void pci_liveupdate_cleanup_device(struct pci_dev *dev)
> >  {
> >  }
> >  
> > +static inline void pci_liveupdate_freeze(struct pci_dev *dev);
> > +{
> > +}
> 
> Does this stray semicolon after the function signature cause a compilation
> error for kernels built without CONFIG_PCI_LIVEUPDATE?

Yup, Mike Rapoport and kernel-test-robot also flagged this off-list.
Will fix in v6.

> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260512184846.119396-1-dmatlack@google.com?part=9

  reply	other threads:[~2026-05-14 18:49 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
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 [this message]
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=agYZF7W-hRtj_IX6@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