From: "tip-bot2 for Himanshu Madhani" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Jorge Lopez <jorge.jo.lopez@oracle.com>,
Thomas Gleixner <tglx@linutronix.de>,
Himanshu Madhani <himanshu.madhani@oracle.com>,
x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org
Subject: [tip: irq/urgent] PCI/MSI: Prevent recursive locking in pci_msix_write_tph_tag()
Date: Thu, 10 Jul 2025 21:46:57 -0000 [thread overview]
Message-ID: <175218401725.406.6167258058407425293.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250708222530.1041477-1-himanshu.madhani@oracle.com>
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 68ea85df15d111d82fc474cbe104174791169355
Gitweb: https://git.kernel.org/tip/68ea85df15d111d82fc474cbe104174791169355
Author: Himanshu Madhani <himanshu.madhani@oracle.com>
AuthorDate: Tue, 08 Jul 2025 22:25:30
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 10 Jul 2025 23:41:08 +02:00
PCI/MSI: Prevent recursive locking in pci_msix_write_tph_tag()
pci_msix_write_tph_tag() takes the per device MSI descriptor mutex and then
invokes msi_domain_get_virq(), which takes the same mutex again. That
obviously results in a system hang which is exposed by a softlockup or
lockdep warning.
Move the lock guard after the invocation of msi_domain_get_virq() to fix
this.
[ tglx: Massage changelog by adding a proper explanation and removing the
not really useful stacktrace ]
Fixes: d5124a9957b2 ("PCI/MSI: Provide a sane mechanism for TPH")
Reported-by: Jorge Lopez <jorge.jo.lopez@oracle.com>
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jorge Lopez <jorge.jo.lopez@oracle.com>
Link: https://lore.kernel.org/all/20250708222530.1041477-1-himanshu.madhani@oracle.com
---
drivers/pci/msi/msi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 6ede55a..d686488 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -934,10 +934,12 @@ int pci_msix_write_tph_tag(struct pci_dev *pdev, unsigned int index, u16 tag)
if (!pdev->msix_enabled)
return -ENXIO;
- guard(msi_descs_lock)(&pdev->dev);
virq = msi_get_virq(&pdev->dev, index);
if (!virq)
return -ENXIO;
+
+ guard(msi_descs_lock)(&pdev->dev);
+
/*
* This is a horrible hack, but short of implementing a PCI
* specific interrupt chip callback and a huge pile of
prev parent reply other threads:[~2025-07-10 21:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 22:25 [PATCH] PCI/THP: Fix hang due to incorrect guard lock himanshu.madhani
2025-07-10 16:47 ` Himanshu Madhani
2025-07-10 21:31 ` Thomas Gleixner
2025-07-10 21:46 ` tip-bot2 for Himanshu Madhani [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=175218401725.406.6167258058407425293.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=himanshu.madhani@oracle.com \
--cc=jorge.jo.lopez@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=maz@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®