mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	stable@vger.kernel.org,
	 Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: [PATCH v2 7/8] dmaengine: idxd: Do not release interrupt handles on terminate_all()
Date: Wed, 25 Nov 2026 15:49:05 -0800	[thread overview]
Message-ID: <20261125-wt-idxd-fixes-v2-7-25a4691dfb9e@intel.com> (raw)
In-Reply-To: <20261125-wt-idxd-fixes-v2-0-25a4691dfb9e@intel.com>

idxd_dma_terminate_all() calls idxd_wq_flush_descs(), which also
releases the WQ's interrupt handle. The WQ stays enabled, but the
handle is never requested again, so the device fails every later
descriptor with "Device error 0x19" (invalid interrupt handle).
dmatest shows it on its second run on a channel.

Move the release to idxd_wq_release_int_handle(), called only from the
FLR path, which needs both. Skip a handle that is already invalid, as a
failed refresh after a revoke leaves it.

Fixes: 2a93f5747d0e ("dmaengine: idxd: Flush all pending descriptors")
Cc: stable@vger.kernel.org # 7.0.x
Reported-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 drivers/dma/idxd/device.c | 15 ++++++++++++++-
 drivers/dma/idxd/idxd.h   |  1 +
 drivers/dma/idxd/irq.c    |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 131138483b87..21a0c32325ea 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,10 @@ 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);
+	/* Revoked and not re-acquired, or released by an earlier FLR */
+	if (ie->int_handle == INVALID_INT_HANDLE)
+		return;
+
 	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.1


  parent reply	other threads:[~2026-11-25 23:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 23:48 [PATCH v2 0/8] dmaengine: idxd: More error handling fixes Vinicius Costa Gomes
2026-11-25 23:48 ` [PATCH v2 1/8] dmaengine: idxd: Do not call destroy_workqueue() with null idxd->wq Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 2/8] dmaengine: idxd: Fix potential double free on probe error path Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 3/8] dmaengine: idxd: fix duplicate memory frees on initialization " Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 4/8] dmaengine: idxd: Fix the device registration error paths Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 5/8] dmaengine: idxd: Fix error handling in idxd_cdev_open() Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 6/8] dmaengine: idxd: Initialize the WQ XArray before the WQ can be released Vinicius Costa Gomes
2026-11-25 23:49 ` Vinicius Costa Gomes [this message]
2026-11-25 23:49 ` [PATCH v2 8/8] dmaengine: idxd: Don't flush the descriptors on terminate_all() Vinicius Costa Gomes

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=20261125-wt-idxd-fixes-v2-7-25a4691dfb9e@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=stable@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®