DMA Engine development
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Dave Jiang <dave.jiang@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>, dmaengine@vger.kernel.org
Subject: Re: [PATCH 1/7] dmaengine: idxd: rework descriptor free path on failure
Date: Mon, 25 Oct 2021 10:26:29 +0530	[thread overview]
Message-ID: <YXY4/f0gQBtnoBNI@matsya> (raw)
In-Reply-To: <163474882126.2608004.7014964789204798071.stgit@djiang5-desk3.ch.intel.com>

On 20-10-21, 09:53, Dave Jiang wrote:
> Refactor the completion function to allow skipping of descriptor freeing on
> the submission failiure path. This completely removes descriptor freeing

s/failiure/failure

> from the submit failure path and leave the responsibility to the caller.
> 
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dma/idxd/dma.c    |   10 ++++++++--
>  drivers/dma/idxd/idxd.h   |    8 +-------
>  drivers/dma/idxd/init.c   |    9 +++------
>  drivers/dma/idxd/irq.c    |    8 ++++----
>  drivers/dma/idxd/submit.c |   12 +++---------
>  5 files changed, 19 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
> index c39e9483206a..1ea663215909 100644
> --- a/drivers/dma/idxd/dma.c
> +++ b/drivers/dma/idxd/dma.c
> @@ -21,7 +21,8 @@ static inline struct idxd_wq *to_idxd_wq(struct dma_chan *c)
>  }
>  
>  void idxd_dma_complete_txd(struct idxd_desc *desc,
> -			   enum idxd_complete_type comp_type)
> +			   enum idxd_complete_type comp_type,
> +			   bool free_desc)
>  {
>  	struct dma_async_tx_descriptor *tx;
>  	struct dmaengine_result res;
> @@ -44,6 +45,9 @@ void idxd_dma_complete_txd(struct idxd_desc *desc,
>  		tx->callback = NULL;
>  		tx->callback_result = NULL;
>  	}
> +
> +	if (free_desc)
> +		idxd_free_desc(desc->wq, desc);
>  }
>  
>  static void op_flag_setup(unsigned long flags, u32 *desc_flags)
> @@ -153,8 +157,10 @@ static dma_cookie_t idxd_dma_tx_submit(struct dma_async_tx_descriptor *tx)
>  	cookie = dma_cookie_assign(tx);
>  
>  	rc = idxd_submit_desc(wq, desc);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		idxd_free_desc(wq, desc);

if there is an error in submit, should the caller not invoke terminate()
and get the cleanup done?

-- 
~Vinod

  reply	other threads:[~2021-10-25  4:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 16:53 [PATCH 0/7] dmaengine: idxd: Add interrupt handle revoke support Dave Jiang
2021-10-20 16:53 ` [PATCH 1/7] dmaengine: idxd: rework descriptor free path on failure Dave Jiang
2021-10-25  4:56   ` Vinod Koul [this message]
2021-10-25 16:03     ` Dave Jiang
2021-10-20 16:53 ` [PATCH 2/7] dmaengine: idxd: int handle management refactoring Dave Jiang
2021-10-20 16:53 ` [PATCH 3/7] dmaengine: idxd: move interrupt handle assignment Dave Jiang
2021-10-20 16:53 ` [PATCH 4/7] dmaengine: idxd: add helper for per interrupt handle drain Dave Jiang
2021-10-25  5:06   ` Vinod Koul
2021-10-25 17:19     ` Dave Jiang
2021-10-20 16:54 ` [PATCH 5/7] dmaengine: idxd: create locked version of idxd_quiesce() call Dave Jiang
2021-10-20 16:54 ` [PATCH 6/7] dmaengine: idxd: handle invalid interrupt handle descriptors Dave Jiang
2021-10-25  5:08   ` Vinod Koul
2021-10-25 17:27     ` Dave Jiang
2021-10-20 16:54 ` [PATCH 7/7] dmaengine: idxd: handle interrupt handle revoked event 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=YXY4/f0gQBtnoBNI@matsya \
    --to=vkoul@kernel.org \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kevin.tian@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