From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Swati Sharma <swati2.sharma@intel.com>
Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org,
"David E. Box" <david.e.box@linux.intel.com>
Subject: Re: [Intel-gfx] [PATCH] [topic/core-for-CI] PCI/ASPM: pci_enable_link_state: Add argument to acquire bus lock
Date: Thu, 30 Mar 2023 10:42:05 -0400 [thread overview]
Message-ID: <ZCWfvbuozZGia/M+@intel.com> (raw)
In-Reply-To: <20230330121135.15414-1-swati2.sharma@intel.com>
On Thu, Mar 30, 2023 at 05:41:35PM +0530, Swati Sharma wrote:
> From: "David E. Box" <david.e.box@linux.intel.com>
>
> The VMD driver calls pci_enabled_link_state as a callback from
> pci_bus_walk. Both will acquire the pci_bus_sem lock leading to a lockdep
> warning. Add an argument to pci_enable_link_state to set whether the lock
> should be acquired. In the VMD driver, set the argument to false since the
> lock will already be obtained by pci_bus_walk.
>
> Still, review comments needs to be addressed. However, this fix
> is helping to unblock CI execution for now.
>
> References: https://gitlab.freedesktop.org/drm/intel/-/issues/8316
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Fixes: de82f60f9c86 ("PCI/ASPM: Add pci_enable_link_state()")
> Link: https://lore.kernel.org/linux-pci/ZBjko%2FifunIwsK2v@intel.com/
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
to get this into topic/core-for-CI
> ---
> drivers/pci/controller/vmd.c | 2 +-
> drivers/pci/pcie/aspm.c | 9 ++++++---
> include/linux/pci.h | 5 +++--
> 3 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 990630ec57c6..45aa35744eae 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -737,7 +737,7 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata)
> if (!(features & VMD_FEAT_BIOS_PM_QUIRK))
> return 0;
>
> - pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL);
> + pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL, false);
>
> pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR);
> if (!pos)
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 66d7514ca111..5b5a600bb864 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -1147,8 +1147,9 @@ EXPORT_SYMBOL(pci_disable_link_state);
> *
> * @pdev: PCI device
> * @state: Mask of ASPM link states to enable
> + * @sem: Boolean to acquire/release pci_bus_sem
> */
> -int pci_enable_link_state(struct pci_dev *pdev, int state)
> +int pci_enable_link_state(struct pci_dev *pdev, int state, bool sem)
> {
> struct pcie_link_state *link = pcie_aspm_get_link(pdev);
>
> @@ -1165,7 +1166,8 @@ int pci_enable_link_state(struct pci_dev *pdev, int state)
> return -EPERM;
> }
>
> - down_read(&pci_bus_sem);
> + if (sem)
> + down_read(&pci_bus_sem);
> mutex_lock(&aspm_lock);
> link->aspm_default = 0;
> if (state & PCIE_LINK_STATE_L0S)
> @@ -1186,7 +1188,8 @@ int pci_enable_link_state(struct pci_dev *pdev, int state)
> link->clkpm_default = (state & PCIE_LINK_STATE_CLKPM) ? 1 : 0;
> pcie_set_clkpm(link, policy_to_clkpm_state(link));
> mutex_unlock(&aspm_lock);
> - up_read(&pci_bus_sem);
> + if (sem)
> + up_read(&pci_bus_sem);
>
> return 0;
> }
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index b50e5c79f7e3..1fe4557e87b9 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1708,7 +1708,7 @@ extern bool pcie_ports_native;
> #ifdef CONFIG_PCIEASPM
> int pci_disable_link_state(struct pci_dev *pdev, int state);
> int pci_disable_link_state_locked(struct pci_dev *pdev, int state);
> -int pci_enable_link_state(struct pci_dev *pdev, int state);
> +int pci_enable_link_state(struct pci_dev *pdev, int state, bool sem);
> void pcie_no_aspm(void);
> bool pcie_aspm_support_enabled(void);
> bool pcie_aspm_enabled(struct pci_dev *pdev);
> @@ -1717,7 +1717,8 @@ static inline int pci_disable_link_state(struct pci_dev *pdev, int state)
> { return 0; }
> static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
> { return 0; }
> -static inline int pci_enable_link_state(struct pci_dev *pdev, int state)
> +static inline int
> +pci_enable_link_state(struct pci_dev *pdev, int state, bool sem)
> { return 0; }
> static inline void pcie_no_aspm(void) { }
> static inline bool pcie_aspm_support_enabled(void) { return false; }
> --
> 2.25.1
>
next prev parent reply other threads:[~2023-03-30 14:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 12:11 [Intel-gfx] [PATCH] [topic/core-for-CI] PCI/ASPM: pci_enable_link_state: Add argument to acquire bus lock Swati Sharma
2023-03-30 12:53 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for PCI/ASPM: pci_enable_link_state: Add argument to acquire bus lock (rev2) Patchwork
2023-03-30 12:53 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-03-30 13:10 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-03-30 14:42 ` Rodrigo Vivi [this message]
2023-03-30 15:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for PCI/ASPM: pci_enable_link_state: Add argument to acquire bus lock (rev3) Patchwork
2023-03-30 15:57 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-03-30 16:07 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-03-31 11:55 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=ZCWfvbuozZGia/M+@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=david.e.box@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=swati2.sharma@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.