public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: fix resource leak on dmaengine driver disable
@ 2021-10-19 20:41 Dave Jiang
  2021-10-25  5:29 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2021-10-19 20:41 UTC (permalink / raw)
  To: vkoul; +Cc: Jacob Pan, Jacob Pan, dmaengine

The wq resources needs to be released before the kernel type is reset by
__drv_disable_wq(). With dma channels unregistered and wq quiesced, all the
wq resources for dmaengine can be freed. There is no need to wait until wq
is disabled. With the wq->type being reset to "unknown", the driver is
skipping the freeing of the resources.

Fixes: 0cda4f6986a3 ("dmaengine: idxd: create dmaengine driver for wq 'device'")
Reported-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Tested-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dma/idxd/dma.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
index b90b085d18cf..c39e9483206a 100644
--- a/drivers/dma/idxd/dma.c
+++ b/drivers/dma/idxd/dma.c
@@ -329,10 +329,9 @@ static void idxd_dmaengine_drv_remove(struct idxd_dev *idxd_dev)
 	mutex_lock(&wq->wq_lock);
 	idxd_wq_quiesce(wq);
 	idxd_unregister_dma_channel(wq);
+	idxd_wq_free_resources(wq);
 	__drv_disable_wq(wq);
 	percpu_ref_exit(&wq->wq_active);
-	idxd_wq_free_resources(wq);
-	wq->type = IDXD_WQT_NONE;
 	mutex_unlock(&wq->wq_lock);
 }
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: idxd: fix resource leak on dmaengine driver disable
  2021-10-19 20:41 [PATCH] dmaengine: idxd: fix resource leak on dmaengine driver disable Dave Jiang
@ 2021-10-25  5:29 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2021-10-25  5:29 UTC (permalink / raw)
  To: Dave Jiang; +Cc: Jacob Pan, dmaengine

On 19-10-21, 13:41, Dave Jiang wrote:
> The wq resources needs to be released before the kernel type is reset by
> __drv_disable_wq(). With dma channels unregistered and wq quiesced, all the
> wq resources for dmaengine can be freed. There is no need to wait until wq
> is disabled. With the wq->type being reset to "unknown", the driver is
> skipping the freeing of the resources.

Doesnt apply, i guess needs rebase

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-25  5:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-19 20:41 [PATCH] dmaengine: idxd: fix resource leak on dmaengine driver disable Dave Jiang
2021-10-25  5:29 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox