All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Falcon" <thomas.falcon@intel.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/4] pcie/aspm: Enable all power-saving states during link state initialization
Date: Wed, 13 May 2026 00:40:20 +0000	[thread overview]
Message-ID: <20260513004021.31420C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511210936.562622-3-thomas.falcon@intel.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Data race and missing memory barriers in lazy initialization of `pcie_aspm_legacy_config_check()`
- [Medium] Implicit reliance on `dmi_get_bios_year()` error code evaluating as a chronological year
- [Low] Misleading log message claiming ASPM configuration occurs at 'build' time, and stale code comments
--

commit 5d1b20da84d0615c569d56fd7efaa7c241b6e329
Author: Thomas Falcon <thomas.falcon@intel.com>

pcie/aspm: Enable all power-saving states during link state initialization

This commit enables setting powersave and powersupersave states during
ASPM link state initialization. It restricts this behavior to systems
with a BIOS release during or after 2025 to simplify the enabling flow.

> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index cd23c1462502f..e93b724945341 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c

[ ... ]

> @@ -1057,6 +1058,23 @@ static void free_link_state(struct pcie_link_state *link)
>  	kfree(link);
>  }
>  
> +static bool pcie_aspm_legacy_config_check(void)
> +{
> +	static bool legacy_aspm_config;
> +	static bool checked;
> +
> +	if (checked)
> +		return legacy_aspm_config;
> +	if (dmi_get_bios_year() < 2025)
> +		legacy_aspm_config = true;

When dmi_get_bios_year() returns -ENXIO (-6) on systems without DMI support
(like Device Tree based ARM64 or PowerPC), won't it evaluate as less than
2025?

Does this unintentionally classify all non-DMI platforms as legacy systems
regardless of their actual age?

> +
> +	pr_info_once("ASPM configuration is determined at %s time\n",
> +		     legacy_aspm_config ? "build" : "boot");
> +	checked = true;

Are we missing memory barriers here?

During concurrent PCIe device enumeration, if one thread sets
legacy_aspm_config = true and then checked = true:

Thread A:
    legacy_aspm_config = true;
    checked = true;

Could weak memory ordering cause Thread B to observe checked == true but
read a stale uninitialized legacy_aspm_config value of false, leading to
a regression where unsupported systems bypass the legacy ASPM delay?

Also, this isn't a bug, but does ASPM configuration really occur at "build"
time on legacy systems, or is it deferred until runtime when the device
driver calls pci_enable_device()?

The log message might be misleading for system administrators.

> +
> +	return legacy_aspm_config;
> +}
> +
>  static int pcie_aspm_sanity_check(struct pci_dev *pdev)
>  {
>  	struct pci_dev *child;

[ ... ]

> @@ -1196,8 +1214,9 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
>  	 * the BIOS's expectation, we'll do so once pci_enable_device() is
>  	 * called.
>  	 */

This isn't a bug, but should the comment block above be updated to reflect
that POLICY_POWERSAVE configurations are now applied immediately on modern
systems instead of being deferred?

> -	if (aspm_policy != POLICY_POWERSAVE &&
> -	    aspm_policy != POLICY_POWER_SUPERSAVE) {
> +	if (!pcie_aspm_legacy_config_check() ||
> +	    (aspm_policy != POLICY_POWERSAVE &&
> +	     aspm_policy != POLICY_POWER_SUPERSAVE)) {
>  		pcie_config_aspm_path(link);
>  		pcie_set_clkpm(link, policy_to_clkpm_state(link));
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260511210936.562622-1-thomas.falcon@intel.com?part=2

  reply	other threads:[~2026-05-13  0:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 21:09 [RFC PATCH v2 0/4] pcie/aspm: Enable all advertised ASPM states by default Thomas Falcon
2026-05-11 21:09 ` [RFC PATCH v2 1/4] pcie/aspm: Add debug logging for aspm policy config Thomas Falcon
2026-05-13  0:25   ` sashiko-bot
2026-05-11 21:09 ` [RFC PATCH v2 2/4] pcie/aspm: Enable all power-saving states during link state initialization Thomas Falcon
2026-05-13  0:40   ` sashiko-bot [this message]
2026-05-11 21:09 ` [RFC PATCH v2 3/4] pcie/aspm: Enable all hardware power-saving states by default Thomas Falcon
2026-05-13  1:15   ` sashiko-bot
2026-05-11 21:09 ` [RFC PATCH v2 4/4] pcie/aspm: Remove CONFIG_PCIEASPM_* policy definitions Thomas Falcon
2026-05-13  1:54   ` 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=20260513004021.31420C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.falcon@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.