Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 2/2] PCI: Align hibernate poweroff flow with suspend flow for bridges
Date: Wed, 16 Sep 2026 21:05:21 +0000	[thread overview]
Message-ID: <20260916210522.3A1111F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260916205340.2466679-3-mario.limonciello@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pci: missing secondary bus wait in restore_noirq on hibernation abort
--

commit 2ba69e2c07c28dfe82ab9450d201b37b5e9b14d7
Author: Mario Limonciello (AMD) <superm1@kernel.org>

    PCI: Align hibernate poweroff flow with suspend flow for bridges
    
    During S3 suspend, pci_pm_suspend_noirq() puts PCIe bridges with
    downstream devices into a low-power state (D3hot or D3cold) when the
    platform allows it.  The hibernate poweroff_noirq path never did this:
    it only called pci_prepare_to_sleep() for devices with no subordinate,
    so bridges with active children were left in D0.
    
    On many designs the platform firmware leaves bridges alone when the
    system enters S4. This prevents being able to meet various energy
    certification criteria for different parts of the world, particularly
    in designs with a dGPU.

> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 8334214f8c1ed..8d293ca66a0d9 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c

[ ... ]

> @@ -1272,16 +1275,26 @@ static int pci_pm_poweroff_noirq(struct device *dev)
>  	}
>  
>  	if (pm->poweroff_noirq) {
> +		pci_power_t prev = pci_dev->current_state;
>  		int error;
>  
>  		error = pm->poweroff_noirq(dev);
>  		suspend_report_result(dev, pm->poweroff_noirq, error);
>  		if (error)
>  			return error;
> +
> +		if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
> +		    && pci_dev->current_state != PCI_UNKNOWN) {
> +			pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
> +				      "PCI PM: State of device not saved by %pS\n",
> +				      pm->poweroff_noirq);
> +			goto Fixup;
> +		}
>  	}
>  
> -	if (!pci_dev->state_saved && !pci_has_subordinate(pci_dev))
> -		pci_prepare_to_sleep(pci_dev);
> +	skip_bus_pm = pci_pm_suspend_noirq_common(pci_dev);

[Severity: High]
Since this change puts PCIe bridges into low-power states (D3hot/D3cold) just
like S3 suspend, does the recovery path for an aborted poweroff also need
updating?

If hibernation aborts after this point, the system recovers by calling
dpm_resume_end(PMSG_RESTORE), which invokes pci_pm_restore_noirq() for all
devices.

While pci_pm_resume_noirq() properly checks if a bridge was previously in
D3cold and calls pci_pm_bridge_power_up_actions(), pci_pm_restore_noirq() lacks
this check:

drivers/pci/pci-driver.c:pci_pm_restore_noirq() {
	...
	pci_pm_default_resume_early(pci_dev);
	pci_fixup_device(pci_fixup_resume_early, pci_dev);

	if (pci_has_legacy_pm_support(pci_dev))
		return 0;
	...
}

Without a secondary bus wait, downstream devices accessed during their
subsequent restore_noirq callbacks might hit an untrained link, potentially
resulting in Master Aborts and device state corruption.

> +	if (skip_bus_pm)
> +		goto Fixup;
>  
>  	/*
>  	 * The reason for doing this here is the same as for the analogous code

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916205340.2466679-1-mario.limonciello@amd.com?part=2

      reply	other threads:[~2026-09-16 21:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 20:53 [PATCH v5 0/2] Unify PCI suspend and hibernate paths Mario Limonciello
2026-09-16 20:53 ` [PATCH v5 1/2] PCI/PM: Split out code from pci_pm_suspend_noirq() into helper Mario Limonciello
2026-09-16 21:02   ` sashiko-bot
2026-09-16 20:53 ` [PATCH v5 2/2] PCI: Align hibernate poweroff flow with suspend flow for bridges Mario Limonciello
2026-09-16 21:05   ` sashiko-bot [this message]

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=20260916210522.3A1111F00899@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --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