Re: [PATCH 5/8] nvmet: pci-epf: Remove unnecessary dmaengine_terminate_sync() on each DMA transfer

Frank Li
2025-12-09T15:45:10Z

On Tue, Dec 09, 2025 at 03:52:15PM +0900, Damien Le Moal wrote:
> On 12/9/25 2:09 AM, Frank Li wrote:
> > dmaengine_terminate_sync() cancels all pending requests. Calling it for
> > every DMA transfer is unnecessary and counterproductive. This function is
> > generally intended for cleanup paths such as module removal, device close,
> > or unbind operations.
> >
> > Remove the redundant calls.
> >
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---
> > This one also fix stress test failure after remove mutex and use new API
> > dmaengine_prep_slave_sg_config().
> > ---
> > drivers/nvme/target/pci-epf.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/nvme/target/pci-epf.c b/drivers/nvme/target/pci-epf.c
> > index 2e78397a7373a7d8ba67150f301f392123db88d1..85225a4f75b5bd7abb6897d064123766af021542 100644
> > --- a/drivers/nvme/target/pci-epf.c
> > +++ b/drivers/nvme/target/pci-epf.c
> > @@ -420,8 +420,6 @@ static int nvmet_pci_epf_dma_transfer(struct nvmet_pci_epf *nvme_epf,
> > ret = -EIO;
> > }
> >
> > - dmaengine_terminate_sync(chan);
>
> If the above dma_sync_wait failed, we better call this here as we have no idea
> why we got the failure, no ?

Yes, it should be call at only failure case.

Frank
> For success case, we indeed may want to remove it.
>
> > -
> > unmap:
> > dma_unmap_single(dma_dev, dma_addr, seg->length, dir);
> >
> >
>
>
> --
> Damien Le Moal
> Western Digital Research