* [PATCH] net: ethernet: sun4i-emac: free dma descriptor [not found] <20250904072446.5563130d@kernel.org> @ 2025-09-07 11:29 ` Conley Lee 2025-09-08 20:26 ` Jakub Kicinski 0 siblings, 1 reply; 5+ messages in thread From: Conley Lee @ 2025-09-07 11:29 UTC (permalink / raw) To: kuba, davem, wens, mripard, vkoul Cc: netdev, dmaengine, linux-arm-kernel, linux-kernel, Conley Lee In the current implementation of the sun4i-emac driver, when using DMA to receive data packets, the descriptor for the current DMA request is not released in the rx_done_callback. Fix this by properly releasing the descriptor. Fixes: 47869e82c8b8 ("sun4i-emac.c: add dma support") Signed-off-by: Conley Lee <conleylee@foxmail.com> --- drivers/net/ethernet/allwinner/sun4i-emac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 2f516b950..2f990d0a5 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -237,6 +237,7 @@ emac_alloc_dma_req(struct emac_board_info *db, static void emac_free_dma_req(struct emac_dma_req *req) { + dmaengine_desc_free(req->desc); kfree(req); } -- 2.25.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ethernet: sun4i-emac: free dma descriptor 2025-09-07 11:29 ` [PATCH] net: ethernet: sun4i-emac: free dma descriptor Conley Lee @ 2025-09-08 20:26 ` Jakub Kicinski 2025-09-09 6:36 ` 李克斯 0 siblings, 1 reply; 5+ messages in thread From: Jakub Kicinski @ 2025-09-08 20:26 UTC (permalink / raw) To: Conley Lee, vkoul Cc: davem, wens, mripard, netdev, dmaengine, linux-arm-kernel, linux-kernel On Sun, 7 Sep 2025 19:29:30 +0800 Conley Lee wrote: > In the current implementation of the sun4i-emac driver, when using DMA to > receive data packets, the descriptor for the current DMA request is not > released in the rx_done_callback. I wish you elaborated more on the reuse flag not being set :\ > Fix this by properly releasing the descriptor. > > Fixes: 47869e82c8b8 ("sun4i-emac.c: add dma support") > Signed-off-by: Conley Lee <conleylee@foxmail.com> Hi Vinod, could you TAL? Is this fix legit or there's something wrong with how the DMA engine API is used on this platform? https://lore.kernel.org/all/tencent_D434891410B0717BB0BDCB1434969E6EB50A@qq.com/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ethernet: sun4i-emac: free dma descriptor 2025-09-08 20:26 ` Jakub Kicinski @ 2025-09-09 6:36 ` 李克斯 2025-09-10 1:15 ` Jakub Kicinski 0 siblings, 1 reply; 5+ messages in thread From: 李克斯 @ 2025-09-09 6:36 UTC (permalink / raw) To: Jakub Kicinski Cc: vkoul, davem, wens, mripard, netdev, dmaengine, linux-arm-kernel, linux-kernel Thank you for the suggestion. I've reviewed the documentation, and setting the reuse flag while reusing descriptors might be a good optimization. I'll make the changes and run some tests. If everything works well, I'll submit a new patch. > 2025年9月9日 04:26,Jakub Kicinski <kuba@kernel.org> 写道: > > On Sun, 7 Sep 2025 19:29:30 +0800 Conley Lee wrote: >> In the current implementation of the sun4i-emac driver, when using DMA to >> receive data packets, the descriptor for the current DMA request is not >> released in the rx_done_callback. > > I wish you elaborated more on the reuse flag not being set :\ > >> Fix this by properly releasing the descriptor. >> >> Fixes: 47869e82c8b8 ("sun4i-emac.c: add dma support") >> Signed-off-by: Conley Lee <conleylee@foxmail.com> > > Hi Vinod, could you TAL? Is this fix legit or there's something wrong > with how the DMA engine API is used on this platform? > https://lore.kernel.org/all/tencent_D434891410B0717BB0BDCB1434969E6EB50A@qq.com/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ethernet: sun4i-emac: free dma descriptor 2025-09-09 6:36 ` 李克斯 @ 2025-09-10 1:15 ` Jakub Kicinski 2025-09-10 10:42 ` Conley Lee 0 siblings, 1 reply; 5+ messages in thread From: Jakub Kicinski @ 2025-09-10 1:15 UTC (permalink / raw) To: 李克斯 Cc: vkoul, davem, wens, mripard, netdev, dmaengine, linux-arm-kernel, linux-kernel On Tue, 9 Sep 2025 14:36:42 +0800 李克斯 wrote: > Thank you for the suggestion. I've reviewed the documentation, and > setting the reuse flag while reusing descriptors might be a good > optimization. I'll make the changes and run some tests. If everything > works well, I'll submit a new patch. To be clear if you're saying the driver is buggy and can crash right now we need to fix it first and then optimize it later, as separate commits. So that LTS kernels can backport the fix. The questions I'm asking are because I don't understand whether the upstream kernel is buggy and how exactly.. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ethernet: sun4i-emac: free dma descriptor 2025-09-10 1:15 ` Jakub Kicinski @ 2025-09-10 10:42 ` Conley Lee 0 siblings, 0 replies; 5+ messages in thread From: Conley Lee @ 2025-09-10 10:42 UTC (permalink / raw) To: Jakub Kicinski Cc: vkoul, davem, wens, mripard, netdev, dmaengine, linux-arm-kernel, linux-kernel On 09/09/25 at 06:15下午, Jakub Kicinski wrote: > Date: Tue, 9 Sep 2025 18:15:47 -0700 > From: Jakub Kicinski <kuba@kernel.org> > To: 李克斯 <conleylee@foxmail.com> > Cc: vkoul@kernel.org, davem@davemloft.net, wens@csie.org, > mripard@kernel.org, netdev@vger.kernel.org, dmaengine@vger.kernel.org, > linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org > Subject: Re: [PATCH] net: ethernet: sun4i-emac: free dma descriptor > > On Tue, 9 Sep 2025 14:36:42 +0800 李克斯 wrote: > > Thank you for the suggestion. I've reviewed the documentation, and > > setting the reuse flag while reusing descriptors might be a good > > optimization. I'll make the changes and run some tests. If everything > > works well, I'll submit a new patch. > > To be clear if you're saying the driver is buggy and can crash right > now we need to fix it first and then optimize it later, as separate > commits. So that LTS kernels can backport the fix. > > The questions I'm asking are because I don't understand whether the > upstream kernel is buggy and how exactly.. After carefully reviewing the documentation and how other drivers use dmaengine, I think that if the reuse flag is not set for the descriptor, manual release is unnecessary. Therefore, the current driver implementation does not contain a bug. This fix patch was a mistake. Thank you for your thorough review. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-10 10:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250904072446.5563130d@kernel.org>
2025-09-07 11:29 ` [PATCH] net: ethernet: sun4i-emac: free dma descriptor Conley Lee
2025-09-08 20:26 ` Jakub Kicinski
2025-09-09 6:36 ` 李克斯
2025-09-10 1:15 ` Jakub Kicinski
2025-09-10 10:42 ` Conley Lee
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox