From: Dave Jiang <dave.jiang@intel.com>
To: Vinicius Costa Gomes <vinicius.gomes@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,
stable@vger.kernel.org, Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: Re: [PATCH v2 7/8] dmaengine: idxd: Do not release interrupt handles on terminate_all()
Date: Mon, 30 Nov 2026 10:15:23 -0700 [thread overview]
Message-ID: <371ae506-2744-408a-bd5e-796b14f11772@intel.com> (raw)
In-Reply-To: <20261125-wt-idxd-fixes-v2-7-25a4691dfb9e@intel.com>
On 11/25/26 4:49 PM, Vinicius Costa Gomes wrote:
> 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>
Reviewed-by: Dave Jiang <dave.jiang@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);
> }
> }
>
>
next prev parent reply other threads:[~2026-11-30 17:15 UTC|newest]
Thread overview: 15+ 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-30 17:03 ` Dave Jiang
2026-11-25 23:49 ` [PATCH v2 5/8] dmaengine: idxd: Fix error handling in idxd_cdev_open() Vinicius Costa Gomes
2026-11-30 17:13 ` Dave Jiang
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-30 17:14 ` Dave Jiang
2026-11-25 23:49 ` [PATCH v2 7/8] dmaengine: idxd: Do not release interrupt handles on terminate_all() Vinicius Costa Gomes
2026-11-30 17:15 ` Dave Jiang [this message]
2026-11-25 23:49 ` [PATCH v2 8/8] dmaengine: idxd: Don't flush the descriptors " Vinicius Costa Gomes
2026-11-26 0:19 ` sashiko-bot
2026-11-30 17:18 ` Dave Jiang
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=371ae506-2744-408a-bd5e-796b14f11772@intel.com \
--to=dave.jiang@intel.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=fenghuay@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vinicius.gomes@intel.com \
--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