All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Thomas Pfaff <tpfaff@pcs.com>
Cc: ludovic.desroches@microchip.com, tudor.ambarus@microchip.com,
	nicolas.ferre@microchip.com,
	linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 1/2 stable-6.1] dmaengine: at_hdmac: get next dma transfer from the right list
Date: Fri, 24 Nov 2023 18:23:16 +0530	[thread overview]
Message-ID: <ZWCcvK5L9vHwSfb2@matsya> (raw)
In-Reply-To: <15c92c2f-71e7-f4fd-b90b-412ab53e5a25@pcs.com>

On 14-11-23, 13:22, Thomas Pfaff wrote:
> From: Thomas Pfaff <tpfaff@pcs.com>
> 
> In kernel 6.1, atc_advance_work and atc_handle_error are checking for the 
> next dma transfer inside active list, but the descriptor is taken from the 
> queue instead.

Sorry that is not how this works. Please send the patch for mainline and
add a stable tag to the patches. They will be backported to stable
kernels

Also, your patch threading is broken, they appear disjoint and not as a
series

Thanks

> 
> Signed-off-by: Thomas Pfaff <tpfaff@pcs.com>
> ---
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 858bd64f1313..68c1bfbefc5c 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -490,6 +490,27 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
>  	}
>  }
>  
> +/**
> + * atc_start_next - start next pending transaction if any
> + * @atchan: channel where the transaction ended
> + *
> + * Called with atchan->lock held
> + */
> +static void atc_start_next(struct at_dma_chan *atchan)
> +{
> +	struct at_desc *desc = NULL;
> +
> +	if (!list_empty(&atchan->active_list))
> +		desc = atc_first_active(atchan);
> +	else if (!list_empty(&atchan->queue)) {
> +		desc = atc_first_queued(atchan);
> +		list_move_tail(&desc->desc_node, &atchan->active_list);
> +	}
> +
> +	if (desc)
> +		atc_dostart(atchan, desc);
> +}
> +
>  /**
>   * atc_advance_work - at the end of a transaction, move forward
>   * @atchan: channel where the transaction ended
> @@ -513,11 +534,7 @@ static void atc_advance_work(struct at_dma_chan *atchan)
>  
>  	/* advance work */
>  	spin_lock_irqsave(&atchan->lock, flags);
> -	if (!list_empty(&atchan->active_list)) {
> -		desc = atc_first_queued(atchan);
> -		list_move_tail(&desc->desc_node, &atchan->active_list);
> -		atc_dostart(atchan, desc);
> -	}
> +	atc_start_next(atchan);
>  	spin_unlock_irqrestore(&atchan->lock, flags);
>  }
>  
> @@ -529,7 +546,6 @@ static void atc_advance_work(struct at_dma_chan *atchan)
>  static void atc_handle_error(struct at_dma_chan *atchan)
>  {
>  	struct at_desc *bad_desc;
> -	struct at_desc *desc;
>  	struct at_desc *child;
>  	unsigned long flags;
>  
> @@ -543,11 +559,7 @@ static void atc_handle_error(struct at_dma_chan *atchan)
>  	list_del_init(&bad_desc->desc_node);
>  
>  	/* Try to restart the controller */
> -	if (!list_empty(&atchan->active_list)) {
> -		desc = atc_first_queued(atchan);
> -		list_move_tail(&desc->desc_node, &atchan->active_list);
> -		atc_dostart(atchan, desc);
> -	}
> +	atc_start_next(atchan);
>  
>  	/*
>  	 * KERN_CRITICAL may seem harsh, but since this only happens
> 

-- 
~Vinod

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Thomas Pfaff <tpfaff@pcs.com>
Cc: tudor.ambarus@microchip.com, linux-kernel@vger.kernel.org,
	ludovic.desroches@microchip.com, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RFC 1/2 stable-6.1] dmaengine: at_hdmac: get next dma transfer from the right list
Date: Fri, 24 Nov 2023 18:23:16 +0530	[thread overview]
Message-ID: <ZWCcvK5L9vHwSfb2@matsya> (raw)
In-Reply-To: <15c92c2f-71e7-f4fd-b90b-412ab53e5a25@pcs.com>

On 14-11-23, 13:22, Thomas Pfaff wrote:
> From: Thomas Pfaff <tpfaff@pcs.com>
> 
> In kernel 6.1, atc_advance_work and atc_handle_error are checking for the 
> next dma transfer inside active list, but the descriptor is taken from the 
> queue instead.

Sorry that is not how this works. Please send the patch for mainline and
add a stable tag to the patches. They will be backported to stable
kernels

Also, your patch threading is broken, they appear disjoint and not as a
series

Thanks

> 
> Signed-off-by: Thomas Pfaff <tpfaff@pcs.com>
> ---
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 858bd64f1313..68c1bfbefc5c 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -490,6 +490,27 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
>  	}
>  }
>  
> +/**
> + * atc_start_next - start next pending transaction if any
> + * @atchan: channel where the transaction ended
> + *
> + * Called with atchan->lock held
> + */
> +static void atc_start_next(struct at_dma_chan *atchan)
> +{
> +	struct at_desc *desc = NULL;
> +
> +	if (!list_empty(&atchan->active_list))
> +		desc = atc_first_active(atchan);
> +	else if (!list_empty(&atchan->queue)) {
> +		desc = atc_first_queued(atchan);
> +		list_move_tail(&desc->desc_node, &atchan->active_list);
> +	}
> +
> +	if (desc)
> +		atc_dostart(atchan, desc);
> +}
> +
>  /**
>   * atc_advance_work - at the end of a transaction, move forward
>   * @atchan: channel where the transaction ended
> @@ -513,11 +534,7 @@ static void atc_advance_work(struct at_dma_chan *atchan)
>  
>  	/* advance work */
>  	spin_lock_irqsave(&atchan->lock, flags);
> -	if (!list_empty(&atchan->active_list)) {
> -		desc = atc_first_queued(atchan);
> -		list_move_tail(&desc->desc_node, &atchan->active_list);
> -		atc_dostart(atchan, desc);
> -	}
> +	atc_start_next(atchan);
>  	spin_unlock_irqrestore(&atchan->lock, flags);
>  }
>  
> @@ -529,7 +546,6 @@ static void atc_advance_work(struct at_dma_chan *atchan)
>  static void atc_handle_error(struct at_dma_chan *atchan)
>  {
>  	struct at_desc *bad_desc;
> -	struct at_desc *desc;
>  	struct at_desc *child;
>  	unsigned long flags;
>  
> @@ -543,11 +559,7 @@ static void atc_handle_error(struct at_dma_chan *atchan)
>  	list_del_init(&bad_desc->desc_node);
>  
>  	/* Try to restart the controller */
> -	if (!list_empty(&atchan->active_list)) {
> -		desc = atc_first_queued(atchan);
> -		list_move_tail(&desc->desc_node, &atchan->active_list);
> -		atc_dostart(atchan, desc);
> -	}
> +	atc_start_next(atchan);
>  
>  	/*
>  	 * KERN_CRITICAL may seem harsh, but since this only happens
> 

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-11-24 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 12:22 [PATCH RFC 1/2 stable-6.1] dmaengine: at_hdmac: get next dma transfer from the right list Thomas Pfaff
2023-11-14 12:22 ` Thomas Pfaff
2023-11-24 12:53 ` Vinod Koul [this message]
2023-11-24 12:53   ` Vinod Koul
2023-11-24 13:16   ` Thomas Pfaff
2023-11-24 13:16     ` Thomas Pfaff

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=ZWCcvK5L9vHwSfb2@matsya \
    --to=vkoul@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=tpfaff@pcs.com \
    --cc=tudor.ambarus@microchip.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.