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 07/11] PCI: liveupdate: Inherit ACS flags in incoming preserved devices
Date: Thu, 14 May 2026 18:46:25 +0000	[thread overview]
Message-ID: <agYYgQc-gjs7-III@google.com> (raw)
In-Reply-To: <20260514023718.1A7A4C19425@smtp.kernel.org>

On 2026-05-14 02:37 AM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [High] Modifying pci_dev state while holding only a read lock in pci_liveupdate_init_acs().
> - [High] Intel SPT PCH root ports bypass the ACS quirk rejection check, causing their custom ACS control registers to be permanently lost on the new kernel.
> --
> 
> commit 9befbb904977419650ee202e0854fc1452e0a9de
> Author: David Matlack <dmatlack@google.com>
> 
> PCI: liveupdate: Inherit ACS flags in incoming preserved devices
> 
> This commit updates the live update process to inherit Access Control
> Services (ACS) flags on incoming preserved devices. It caches the
> inherited ACS controls established by the previous kernel so they do
> not change after a reset.
> 
> > diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c
> > index d8e06afde2c76..e3cd6d76636c3 100644
> > --- a/drivers/pci/liveupdate.c
> > +++ b/drivers/pci/liveupdate.c
> [ ... ]
> > @@ -361,6 +373,16 @@ static int pci_liveupdate_preserve_device_new(struct pci_ser *ser, struct pci_de
> >  {
> >  	int i;
> >  
> > +	/*
> > +	 * Do not preserve a devices that rely on device-specific ACS
> > +	 * equivalents (for now) since that would complicate keeping ACS
> > +	 * flags constant across Live Update.
> > +	 */
> > +	if (dev->dev_flags & PCI_DEV_FLAGS_ACS_ENABLED_QUIRK) {
> > +		pci_warn(dev, "Refusing to preserve device that relies on ACS quirks\n");
> > +		return -EINVAL;
> > +	}
> 
> Can Intel SPT PCH root ports bypass this check?
> 
> Looking at pci_quirk_enable_intel_spt_pch_acs(), it does not appear to set
> the PCI_DEV_FLAGS_ACS_ENABLED_QUIRK flag.
> 
> If these ports bypass the check and are preserved, pci_liveupdate_init_acs()
> will only cache the standard PCI_ACS_CTRL register, ignoring the
> device-specific INTEL_SPT_ACS_CTRL register.
> 
> When the new kernel calls pci_enable_acs(), pci_liveupdate_inherit_acs()
> will restore the standard register and return true, skipping the
> pci_dev_specific_enable_acs() path entirely.
> 
> Will this cause a regression where the custom ACS configuration is lost?

Yes looks like it, I will account for Intel SPT PCH root ports in v6.

> 
> [ ... ]
> > @@ -671,6 +694,32 @@ void pci_liveupdate_finish(struct pci_dev *dev)
> >  }
> >  EXPORT_SYMBOL_GPL(pci_liveupdate_finish);
> >  
> > +void pci_liveupdate_init_acs(struct pci_dev *dev)
> > +{
> > +	guard(read_lock)(&dev->liveupdate.lock);
> > +
> > +	if (!dev->acs_cap || !dev->liveupdate.incoming)
> > +		return;
> > +
> > +	pci_read_config_word(dev, dev->acs_cap + PCI_ACS_CTRL, &dev->liveupdate.acs_ctrl);
> > +}
> 
> Does this mutate dev->liveupdate.acs_ctrl while holding a read lock?
> 
> Since pci_read_config_word() writes the read value into the acs_ctrl
> pointer, should this use write_lock to avoid a data race regression?

Yes, will fix.

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

  reply	other threads:[~2026-05-14 18:46 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 [this message]
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=agYYgQc-gjs7-III@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