From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Dave Jiang <dave.jiang@intel.com>, Vinod Koul <vkoul@kernel.org>,
Frank Li <Frank.Li@kernel.org>, Fenghua Yu <fenghuay@nvidia.com>,
Shuai Xue <xueshuai@linux.alibaba.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: [PATCH 6/6] dmaengine: idxd: Do not release interrupt handles on terminate_all
Date: Mon, 12 Oct 2026 14:38:09 -0700 [thread overview]
Message-ID: <20261012-wt-idxd-fixes-v1-6-30a35a445077@intel.com> (raw)
In-Reply-To: <20261012-wt-idxd-fixes-v1-0-30a35a445077@intel.com>
idxd_wq_flush_descs() is called from the dmaengine .device_terminate_all
path, but besides flushing the pending descriptors it also releases the
interrupt handle. As the workqueue stays enabled, the handle is never
re-armed, and any subsequent submission uses an invalid handle and never
completes.
This only shows up when the same workqueue is used more than once: the
first run leaves the handle released on terminate_all, so any later run
times out on every descriptor. dmatest reproduces it by running twice.
Split the interrupt handle teardown into idxd_wq_release_int_handle() so
that terminate_all only flushes descriptors. The FLR path still needs
both, so call them together there.
Fixes: 2a93f5747d0e ("dmaengine: idxd: Flush all pending descriptors")
Reported-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
drivers/dma/idxd/device.c | 11 ++++++++++-
drivers/dma/idxd/idxd.h | 1 +
drivers/dma/idxd/irq.c | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 131138483b87..06299f40f531 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -1349,6 +1349,16 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
}
void idxd_wq_flush_descs(struct idxd_wq *wq)
+{
+ guard(mutex)(&wq->wq_lock);
+
+ if (wq->state != IDXD_WQ_ENABLED || wq->type != IDXD_WQT_KERNEL)
+ return;
+
+ idxd_flush_pending_descs(&wq->ie);
+}
+
+void idxd_wq_release_int_handle(struct idxd_wq *wq)
{
struct idxd_irq_entry *ie = &wq->ie;
struct idxd_device *idxd = wq->idxd;
@@ -1358,7 +1368,6 @@ void idxd_wq_flush_descs(struct idxd_wq *wq)
if (wq->state != IDXD_WQ_ENABLED || wq->type != IDXD_WQT_KERNEL)
return;
- idxd_flush_pending_descs(ie);
if (idxd->request_int_handles)
idxd_device_release_int_handle(idxd, ie->int_handle, IDXD_IRQ_MSIX);
idxd_device_clear_perm_entry(idxd, ie);
diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
index ce78b9a7c641..f4aed90560e0 100644
--- a/drivers/dma/idxd/idxd.h
+++ b/drivers/dma/idxd/idxd.h
@@ -804,6 +804,7 @@ int idxd_wq_init_percpu_ref(struct idxd_wq *wq);
void idxd_wq_free_irq(struct idxd_wq *wq);
int idxd_wq_request_irq(struct idxd_wq *wq);
void idxd_wq_flush_descs(struct idxd_wq *wq);
+void idxd_wq_release_int_handle(struct idxd_wq *wq);
/* submission */
int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc);
diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c
index 6a25e1fd0e62..26d75d744797 100644
--- a/drivers/dma/idxd/irq.c
+++ b/drivers/dma/idxd/irq.c
@@ -405,6 +405,7 @@ static void idxd_wqs_flush_descs(struct idxd_device *idxd)
struct idxd_wq *wq = idxd->wqs[i];
idxd_wq_flush_descs(wq);
+ idxd_wq_release_int_handle(wq);
}
}
--
2.56.0
prev parent reply other threads:[~2026-10-12 21:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 21:38 [PATCH 0/6] dmaengine: idxd: More error handling fixes Vinicius Costa Gomes
2026-10-12 21:38 ` [PATCH 1/6] dmaengine: idxd: Do not call destroy_workqueue with null idxd->wq Vinicius Costa Gomes
2026-10-12 21:38 ` [PATCH 2/6] dmaengine: idxd: fix duplicate memory frees on initialization error path Vinicius Costa Gomes
2026-10-12 21:38 ` [PATCH 3/6] dmaengine: idxd: Fix potential double free on probe " Vinicius Costa Gomes
2026-10-12 21:38 ` [PATCH 4/6] dmaengine: idxd: Fix unwind bounds in device registration error paths Vinicius Costa Gomes
2026-10-12 21:38 ` [PATCH 5/6] dmaengine: idxd: Fix error code handling in idxd_cdev_open() Vinicius Costa Gomes
2026-10-12 21:38 ` Vinicius Costa Gomes [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=20261012-wt-idxd-fixes-v1-6-30a35a445077@intel.com \
--to=vinicius.gomes@intel.com \
--cc=Frank.Li@kernel.org \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=fenghuay@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@kernel.org \
--cc=xueshuai@linux.alibaba.com \
--cc=zhenzhong.duan@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®