From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
Dan Williams <dan.j.williams@intel.com>,
Dave Jiang <dave.jiang@intel.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Matthew Rosato <mjrosato@linux.ibm.com>
Subject: Re: [PATCH] PCI: Add missing lockdep assertion in pci_cfg_access_trylock()
Date: Tue, 04 Jun 2024 16:23:01 +0200 [thread overview]
Message-ID: <00aba58c1175e0bfb4480b36831d314bc39b5aa1.camel@linux.ibm.com> (raw)
In-Reply-To: <20240604-pci_cfg_lockdep-v1-1-00da1706c9fd@linux.ibm.com>
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/
prev parent reply other threads:[~2024-06-04 14:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=00aba58c1175e0bfb4480b36831d314bc39b5aa1.camel@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mjrosato@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox