From: "Ionut Nechita (Wind River)" <ionut.nechita@windriver.com>
To: Xu Yilun <yilun.xu@linux.intel.com>, Moritz Fischer <mdf@kernel.org>
Cc: Xu Yilun <yilun.xu@intel.com>, Tom Rix <trix@redhat.com>,
Peter Colberg <peter.colberg@intel.com>,
linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH v2 2/2] fpga: dfl: release irq triggers when the device file ops are unregistered
Date: Mon, 30 Nov 2026 20:21:32 +0200 [thread overview]
Message-ID: <20261130182132.56809-3-ionut.nechita@windriver.com> (raw)
In-Reply-To: <20261130182132.56809-1-ionut.nechita@windriver.com>
From: Ionut Nechita <ionut.nechita@windriver.com>
The eventfd triggers bound with the DFL_FPGA_*_SET_IRQ ioctls are only
released in release(), when the last user closes the device file. If
the feature device is removed while the file is open, dfl-pci frees the
MSI-X vectors with the handlers still requested, and the irqaction, its
name and the eventfd reference are leaked:
remove_proc_entry: removing non-empty directory 'irq/62', leaking at least 'fpga-irq[0](dfl-fme.0-4)'
WARNING: CPU: 24 PID: 19313 at fs/proc/generic.c:742 remove_proc_entry+0x199/0x1c0
Call Trace:
unregister_irq_proc
free_desc
irq_free_descs
msi_domain_free_irqs_all_locked
pci_free_irq_vectors
pci_device_remove
Release them when the cdev ops are unregistered on the remove path of
the FME and the port, once no file operation can bind them again.
Fixes: 322b598be4d9 ("fpga: dfl: introduce interrupt trigger setting API")
Signed-off-by: Ionut Nechita <ionut.nechita@windriver.com>
---
drivers/fpga/dfl.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index f1b7e22954c6c..2a374b9df7701 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -681,16 +681,26 @@ EXPORT_SYMBOL_GPL(dfl_fpga_dev_ops_register);
*
* The device file may still be open. Wait for the file operations in
* progress and make the later ones fail, so that none of them reaches
- * the feature device once it is gone.
+ * the feature device once it is gone. Release the irq triggers bound
+ * through the file, as release() will not: the parent frees the irq
+ * vectors once the feature device is removed.
*/
void dfl_fpga_dev_ops_unregister(struct platform_device *pdev)
{
struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev);
+ struct dfl_feature_dev_data *fdata = pdata->fdata;
+ struct dfl_feature *feature;
cdev_del(&pdata->cdev);
down_write(&pdata->ops_rwsem);
pdata->ops_unregistered = true;
+
+ mutex_lock(&fdata->lock);
+ dfl_fpga_dev_for_each_feature(fdata, feature)
+ dfl_fpga_set_irq_triggers(feature, 0, feature->nr_irqs, NULL);
+ mutex_unlock(&fdata->lock);
+
up_write(&pdata->ops_rwsem);
}
EXPORT_SYMBOL_GPL(dfl_fpga_dev_ops_unregister);
--
2.56.1
prev parent reply other threads:[~2026-11-30 18:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 18:21 [RFC PATCH v2 0/2] fpga: dfl: sync device file operations with feature device removal Ionut Nechita (Wind River)
2026-11-30 18:21 ` [RFC PATCH v2 1/2] " Ionut Nechita (Wind River)
2026-11-30 18:21 ` Ionut Nechita (Wind River) [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=20261130182132.56809-3-ionut.nechita@windriver.com \
--to=ionut.nechita@windriver.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=peter.colberg@intel.com \
--cc=trix@redhat.com \
--cc=yilun.xu@intel.com \
--cc=yilun.xu@linux.intel.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
all inboxes | Powered by JetHome®