* [PATCH] PCI: Add missing lockdep assertion in pci_cfg_access_trylock()
@ 2024-06-04 13:38 Niklas Schnelle
2024-06-04 14:23 ` Niklas Schnelle
0 siblings, 1 reply; 2+ messages in thread
From: Niklas Schnelle @ 2024-06-04 13:38 UTC (permalink / raw)
To: Bjorn Helgaas, Dan Williams, Dave Jiang
Cc: linux-pci, linux-kernel, Matthew Rosato, Niklas Schnelle
In commit 7e89efc6e9e4 ("PCI: Lock upstream bridge for
pci_reset_function()") it was missed that pci_cfg_access_trylock() needs
the same lockdep assertion as pci_cfg_access_lock(). This leads to false
positive lockdep splats for users of pci_cfg_access_trylock(). Add the
missing assertion when the lock was successfully acquired.
Fixes: 7e89efc6e9e4 ("PCI: Lock upstream bridge for pci_reset_function()")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
drivers/pci/access.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 30f031de9cfe..5b6620da30d7 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -319,6 +319,8 @@ bool pci_cfg_access_trylock(struct pci_dev *dev)
dev->block_cfg_access = 1;
raw_spin_unlock_irqrestore(&pci_lock, flags);
+ if (locked)
+ lock_map_acquire(&dev->cfg_access_lock);
return locked;
}
EXPORT_SYMBOL_GPL(pci_cfg_access_trylock);
---
base-commit: c3f38fa61af77b49866b006939479069cd451173
change-id: 20240604-pci_cfg_lockdep-b6914e62d726
Best regards,
--
Niklas Schnelle
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] PCI: Add missing lockdep assertion in pci_cfg_access_trylock()
2024-06-04 13:38 [PATCH] PCI: Add missing lockdep assertion in pci_cfg_access_trylock() Niklas Schnelle
@ 2024-06-04 14:23 ` Niklas Schnelle
0 siblings, 0 replies; 2+ messages in thread
From: Niklas Schnelle @ 2024-06-04 14:23 UTC (permalink / raw)
To: Bjorn Helgaas, Dan Williams, Dave Jiang
Cc: linux-pci, linux-kernel, Matthew Rosato
On Tue, 2024-06-04 at 15:38 +0200, Niklas Schnelle wrote:
> In commit 7e89efc6e9e4 ("PCI: Lock upstream bridge for
> pci_reset_function()") it was missed that pci_cfg_access_trylock() needs
> the same lockdep assertion as pci_cfg_access_lock(). This leads to false
> positive lockdep splats for users of pci_cfg_access_trylock(). Add the
> missing assertion when the lock was successfully acquired.
>
> Fixes: 7e89efc6e9e4 ("PCI: Lock upstream bridge for pci_reset_function()")
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> drivers/pci/access.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/access.c b/drivers/pci/access.c
> index 30f031de9cfe..5b6620da30d7 100644
> --- a/drivers/pci/access.c
> +++ b/drivers/pci/access.c
> @@ -319,6 +319,8 @@ bool pci_cfg_access_trylock(struct pci_dev *dev)
> dev->block_cfg_access = 1;
> raw_spin_unlock_irqrestore(&pci_lock, flags);
>
> + if (locked)
> + lock_map_acquire(&dev->cfg_access_lock);
> return locked;
> }
> EXPORT_SYMBOL_GPL(pci_cfg_access_trylock);
>
> ---
> base-commit: c3f38fa61af77b49866b006939479069cd451173
> change-id: 20240604-pci_cfg_lockdep-b6914e62d726
>
> Best regards,
Matt just pointed out to me that the same issue is also discussed with
a proposed fix in the discussion of the fixed commit[0]. That
additionally moves the lockdep asserts into the pci_lock critical
section.
[0]
https://lore.kernel.org/all/20240523153839.16102e26.alex.williamson@redhat.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-04 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04 13:38 [PATCH] PCI: Add missing lockdep assertion in pci_cfg_access_trylock() Niklas Schnelle
2024-06-04 14:23 ` Niklas Schnelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox