PCI: Add missing lockdep assertion in pci_cfg_access_trylock()
PATCH 1/1 PCI: Add missing lockdep assertion in pci_cfg_access_trylock()
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.
--- drivers/pci/access.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/access.c +2 -0
@@ -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,
Signature · 1 line
Niklas Schnelle
Quoted 30 lines · Niklas Schnelle
In commit
7e89efc6e9e4("PCI: Lock upstream bridge forpci_reset_function()") it was missed thatpci_cfg_access_trylock()needs the same lockdep assertion aspci_cfg_access_lock(). This leads to false positive lockdep splats for users ofpci_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 <[email protected]>--- drivers/pci/access.c | 2 ++ 1 file changed, 2 insertions(+)drivers/pci/access.c +2
-1@@ -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
Quoted 1 line
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.