diff mbox series

[6/6] PCI/ASPM: Add lockdep assert to link state helper

Message ID 20231114135553.32301-7-johan+linaro@kernel.org
State New
Headers show
Series PCI: Fix deadlocks when enabling ASPM | expand

Commit Message

Johan Hovold Nov. 14, 2023, 1:55 p.m. UTC
Add a lockdep assert to the locked disable link state helper which
should only be called with a pci_bus_sem read lock held.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/pci/pcie/aspm.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Manivannan Sadhasivam Nov. 17, 2023, 10:36 a.m. UTC | #1
On Tue, Nov 14, 2023 at 02:55:53PM +0100, Johan Hovold wrote:
> Add a lockdep assert to the locked disable link state helper which
> should only be called with a pci_bus_sem read lock held.
> 
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  drivers/pci/pcie/aspm.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 19b7256d2dc9..ef2e7a186f57 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -1090,6 +1090,8 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool locked
>  
>  int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
>  {
> +	lockdep_assert_held_read(&pci_bus_sem);
> +
>  	return __pci_disable_link_state(pdev, state, true);
>  }
>  EXPORT_SYMBOL(pci_disable_link_state_locked);
> -- 
> 2.41.0
>
diff mbox series

Patch

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 19b7256d2dc9..ef2e7a186f57 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -1090,6 +1090,8 @@  static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool locked
 
 int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
 {
+	lockdep_assert_held_read(&pci_bus_sem);
+
 	return __pci_disable_link_state(pdev, state, true);
 }
 EXPORT_SYMBOL(pci_disable_link_state_locked);