Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Manivannan Sadhasivam" <mani@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 4/8] PCI/ASPM: Improve the kernel-doc for pci_{enable,disable}_link_state*() APIs
Date: Wed, 08 Jul 2026 14:37:59 +0000	[thread overview]
Message-ID: <20260708143759.BC52E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-pci-aspm-fix-v3-4-6bd72451746e@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The kernel-doc for pci_enable_link_state_locked() incorrectly advises callers to use an incompatible API, which can lead to a recursive read lock deadlock.
- [Medium] The commit message claims to fix the kernel-doc for `pci_disable_link_state()`, but no such change is included in the patch.
--

--- Patch [4]: [PATCH v3 4/8] PCI/ASPM: Improve the kernel-doc for pci_{enable,disable}_link_state*() APIs ---
commit 544fcb510ac42577bcfc280750b6446d3bc52764
Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

PCI/ASPM: Improve the kernel-doc for pci_{enable,disable}_link_state*() APIs

This commit updates the kernel-doc comments for the PCI ASPM link state
management functions. It standardizes the format for the enable APIs and
adds missing documentation for the locked disable API.

> Add kernel-doc for pci_disable_link_state_locked() API and fix the
> kernel-doc for pci_disable_link_state() API.

[Severity: Medium]
Is the commit message accurate about fixing the kernel-doc for
pci_disable_link_state()?

Looking at the diff, it does not appear that pci_disable_link_state() was
modified in this patch, and its return format seems to remain as "Return: 0
or a negative errno" instead of the standard format applied to the other
functions.

> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 6d6862fd2ebb7..5e7e199c78d26 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c

[ ... ]

> @@ -1574,19 +1588,22 @@ int pci_enable_link_state(struct pci_dev *pdev, int state)
>  EXPORT_SYMBOL(pci_enable_link_state);
>  
>  /**
> - * pci_enable_link_state_locked - Clear and set the default device link state
> - * so that the link may be allowed to enter the specified states. Note that if
> - * the BIOS didn't grant ASPM control to the OS, this does nothing because we
> - * can't touch the LNKCTL register. Also note that this does not enable states
> - * disabled by pci_disable_link_state(). Return 0 or a negative errno.
> + * pci_enable_link_state_locked - Enable device's link state
> + * @pdev: PCI device
> + * @state: Mask of ASPM link states to enable
> + *
> + * Enable device's link state, so the link will enter the specified states.
> + * Note that if the BIOS didn't grant ASPM control to the OS, this does
> + * nothing because we can't touch the LNKCTL register. Also note that this
> + * does not enable states disabled by pci_disable_link_state(). Use
> + * pci_force_enable_link_state() for that.

[Severity: High]
Does suggesting pci_force_enable_link_state() here introduce a deadlock risk?

The context for this function requires the caller to hold the pci_bus_sem
read lock. However, pci_force_enable_link_state() is an unlocked API that
internally calls down_read(&pci_bus_sem).

If a developer follows this documentation and replaces
pci_enable_link_state_locked() with pci_force_enable_link_state() while
holding pci_bus_sem, could this cause a recursive read lock deadlock if a
writer is queued in between the two acquisitions?

>  *
>  * Note: The device will be transitioned to D0 state if the PCI-PM L1 Substates
>  * are getting enabled.
>  *
> - * @pdev: PCI device
> - * @state: Mask of ASPM link states to enable
> - *
>  * Context: Caller holds pci_bus_sem read lock.
> + *
> + * Return: 0 on success, a negative errno otherwise.
>  */
>  int pci_enable_link_state_locked(struct pci_dev *pdev, int state)
>  {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-pci-aspm-fix-v3-0-6bd72451746e@kernel.org?part=4

  reply	other threads:[~2026-07-08 14:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 14:30 [PATCH v3 0/8] PCI/ASPM: Add pci_force_enable_link_state() API and convert Atheros drivers Manivannan Sadhasivam
2026-07-08 14:30 ` [PATCH v3 1/8] PCI/ASPM: Always disable ASPM when driver requests it Manivannan Sadhasivam
2026-07-08 14:44   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 2/8] PCI/ASPM: Add pci_force_enable_link_state() API Manivannan Sadhasivam
2026-07-08 14:44   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 3/8] PCI/ASPM: Transition the device to D0 (if required) when enabling ASPM link states Manivannan Sadhasivam
2026-07-08 14:50   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 4/8] PCI/ASPM: Improve the kernel-doc for pci_{enable,disable}_link_state*() APIs Manivannan Sadhasivam
2026-07-08 14:37   ` sashiko-bot [this message]
2026-07-08 14:30 ` [PATCH v3 5/8] PCI/ASPM: Return enabled ASPM states from pcie_aspm_enabled() API Manivannan Sadhasivam
2026-07-08 14:36   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 6/8] wifi: ath12k: Use pci_{enable/disable}_link_state() APIs to enable/disable ASPM states Manivannan Sadhasivam
2026-07-08 14:49   ` sashiko-bot
2026-07-10 20:25   ` Bjorn Helgaas
2026-07-08 14:30 ` [PATCH v3 7/8] wifi: ath11k: " Manivannan Sadhasivam
2026-07-08 14:47   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 8/8] wifi: ath10k: " Manivannan Sadhasivam
2026-07-08 14:51   ` 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=20260708143759.BC52E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@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