From: Dave Jiang <dave.jiang@intel.com>
To: Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Vinod Koul <vkoul@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Fenghua Yu <fenghuay@nvidia.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/9] dmaengine: idxd: Fix memory leak when a wq is reset
Date: Wed, 6 Aug 2025 10:25:51 -0700 [thread overview]
Message-ID: <11f47523-73dd-4504-be13-b57fba141c62@intel.com> (raw)
In-Reply-To: <20250804-idxd-fix-flr-on-kernel-queues-v3-v1-7-4e020fbf52c1@intel.com>
On 8/4/25 6:27 PM, Vinicius Costa Gomes wrote:
> idxd_wq_disable_cleanup() which is called from the reset path for a
> workqueue, sets the wq type to NONE, which for other parts of the
> driver mean that the wq is empty (all its resources were released).
>
> Only set the wq type to NONE after its resources are released.
>
> Fixes: da32b28c95a7 ("dmaengine: idxd: cleanup workqueue config after disabling")
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/dma/idxd/device.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 287cf3bf1f5a2efdc9037968e9a4eed506e489c3..8f6afcba840ed7128259ad6b58b2fd967b0c151c 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -174,6 +174,7 @@ void idxd_wq_free_resources(struct idxd_wq *wq)
> free_descs(wq);
> dma_free_coherent(dev, wq->compls_size, wq->compls, wq->compls_addr);
> sbitmap_queue_free(&wq->sbq);
> + wq->type = IDXD_WQT_NONE;
> }
> EXPORT_SYMBOL_NS_GPL(idxd_wq_free_resources, "IDXD");
>
> @@ -367,7 +368,6 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
> lockdep_assert_held(&wq->wq_lock);
> wq->state = IDXD_WQ_DISABLED;
> memset(wq->wqcfg, 0, idxd->wqcfg_size);
> - wq->type = IDXD_WQT_NONE;
> wq->threshold = 0;
> wq->priority = 0;
> wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES;
> @@ -1540,7 +1540,6 @@ void idxd_drv_disable_wq(struct idxd_wq *wq)
> idxd_wq_reset(wq);
> idxd_wq_free_resources(wq);
> percpu_ref_exit(&wq->wq_active);
> - wq->type = IDXD_WQT_NONE;
> wq->client_count = 0;
> }
> EXPORT_SYMBOL_NS_GPL(idxd_drv_disable_wq, "IDXD");
>
next prev parent reply other threads:[~2025-08-06 17:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 1:27 [PATCH 0/9] dmaengine: idxd: Memory leak and FLR fixes Vinicius Costa Gomes
2025-08-05 1:27 ` [PATCH 1/9] dmaengine: idxd: Fix lockdep warnings when calling idxd_device_config() Vinicius Costa Gomes
2025-08-06 17:02 ` Dave Jiang
2025-08-06 20:25 ` Vinicius Costa Gomes
2025-08-05 1:27 ` [PATCH 2/9] dmaengine: idxd: Fix crash when the event log is disabled Vinicius Costa Gomes
2025-08-06 17:07 ` Dave Jiang
2025-08-05 1:27 ` [PATCH 3/9] dmaengine: idxd: Fix possible invalid memory access after FLR Vinicius Costa Gomes
2025-08-06 17:09 ` Dave Jiang
2025-08-15 19:26 ` Nathan Lynch
2025-08-15 22:45 ` Vinicius Costa Gomes
2025-08-05 1:27 ` [PATCH 4/9] dmaengine: idxd: Flush kernel workqueues on Field Level Reset Vinicius Costa Gomes
2025-08-06 17:12 ` Dave Jiang
2025-08-05 1:27 ` [PATCH 5/9] dmaengine: idxd: Allow DMA clients to empty the pending queue Vinicius Costa Gomes
2025-08-06 17:17 ` Dave Jiang
2025-08-06 20:30 ` Vinicius Costa Gomes
2025-08-05 1:27 ` [PATCH 6/9] dmaengine: idxd: Fix not releasing workqueue on .release() Vinicius Costa Gomes
2025-08-06 17:24 ` Dave Jiang
2025-08-05 1:27 ` [PATCH 7/9] dmaengine: idxd: Fix memory leak when a wq is reset Vinicius Costa Gomes
2025-08-06 17:25 ` Dave Jiang [this message]
2025-08-05 1:27 ` [PATCH 8/9] dmaengine: idxd: Fix freeing the allocated ida too late Vinicius Costa Gomes
2025-08-06 17:27 ` Dave Jiang
2025-08-05 1:28 ` [PATCH 9/9] dmaengine: idxd: Fix leaking event log memory Vinicius Costa Gomes
2025-08-06 17:29 ` 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=11f47523-73dd-4504-be13-b57fba141c62@intel.com \
--to=dave.jiang@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=fenghuay@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vinicius.gomes@intel.com \
--cc=vkoul@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;
as well as URLs for NNTP newsgroup(s).