Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet
@ 2019-02-05 11:03 Nicolas Ferre
  2019-02-05 11:03 ` [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling " Nicolas Ferre
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nicolas Ferre @ 2019-02-05 11:03 UTC (permalink / raw)
  To: Ludovic Desroches, linux-arm-kernel, dmaengine, Vinod Koul
  Cc: Alexandre Belloni, linux-kernel

Even if this case shouldn't happen when controller is properly programmed,
it's still better to avoid dumping a kernel Oops for this.
As the sequence may happen only for debugging purposes, log the error and
just finish the tasklet call.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
 drivers/dma/at_xdmac.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index fe69dccfa0c0..37a269420435 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1606,7 +1606,11 @@ static void at_xdmac_tasklet(unsigned long data)
 					struct at_xdmac_desc,
 					xfer_node);
 		dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, desc);
-		BUG_ON(!desc->active_xfer);
+		if (!desc->active_xfer) {
+			dev_err(chan2dev(&atchan->chan), "Xfer not active: exiting");
+			spin_unlock_bh(&atchan->lock);
+			return;
+		}
 
 		txd = &desc->tx_dma_desc;
 
-- 
2.17.1


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

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

* [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling in tasklet
  2019-02-05 11:03 [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Nicolas Ferre
@ 2019-02-05 11:03 ` " Nicolas Ferre
  2019-02-05 12:33   ` Ludovic Desroches
  2019-02-11 11:58   ` Vinod Koul
  2019-02-05 11:03 ` [PATCH 3/3] dmaengine: at_xdmac: only monitor overflow errors for peripheral xfer Nicolas Ferre
  2019-02-05 12:30 ` [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Ludovic Desroches
  2 siblings, 2 replies; 8+ messages in thread
From: Nicolas Ferre @ 2019-02-05 11:03 UTC (permalink / raw)
  To: Ludovic Desroches, linux-arm-kernel, dmaengine, Vinod Koul
  Cc: Alexandre Belloni, linux-kernel

Complement the identification of errors with stoping the channel and
dumping the descriptor that led to the error case.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
 drivers/dma/at_xdmac.c | 43 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index 37a269420435..ec7a29d8e448 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1575,6 +1575,41 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan)
 		dmaengine_desc_get_callback_invoke(txd, NULL);
 }
 
+static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)
+{
+	struct at_xdmac		*atxdmac = to_at_xdmac(atchan->chan.device);
+	struct at_xdmac_desc	*bad_desc;
+
+	/*
+	 * The descriptor currently at the head of the active list is
+	 * broked. Since we don't have any way to report errors, we'll
+	 * just have to scream loudly and try to carry on.
+	 */
+	if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
+		dev_err(chan2dev(&atchan->chan), "read bus error!!!");
+	if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
+		dev_err(chan2dev(&atchan->chan), "write bus error!!!");
+	if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
+		dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
+
+	spin_lock_bh(&atchan->lock);
+	/* Channel must be disabled first as it's not done automatically */
+	at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
+	while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
+		cpu_relax();
+	bad_desc = list_first_entry(&atchan->xfers_list,
+				    struct at_xdmac_desc,
+				    xfer_node);
+	spin_unlock_bh(&atchan->lock);
+	/* Print bad descriptor's details if needed */
+	dev_dbg(chan2dev(&atchan->chan),
+		 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
+		 __func__, &bad_desc->lld.mbr_sa, &bad_desc->lld.mbr_da,
+		 bad_desc->lld.mbr_ubc);
+
+	/* Then continue with usual descriptor management */
+}
+
 static void at_xdmac_tasklet(unsigned long data)
 {
 	struct at_xdmac_chan	*atchan = (struct at_xdmac_chan *)data;
@@ -1594,12 +1629,8 @@ static void at_xdmac_tasklet(unsigned long data)
 		   || (atchan->irq_status & error_mask)) {
 		struct dma_async_tx_descriptor  *txd;
 
-		if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
-			dev_err(chan2dev(&atchan->chan), "read bus error!!!");
-		if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
-			dev_err(chan2dev(&atchan->chan), "write bus error!!!");
-		if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
-			dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
+		if (atchan->irq_status & error_mask)
+			at_xdmac_handle_error(atchan);
 
 		spin_lock(&atchan->lock);
 		desc = list_first_entry(&atchan->xfers_list,
-- 
2.17.1


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

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

* [PATCH 3/3] dmaengine: at_xdmac: only monitor overflow errors for peripheral xfer
  2019-02-05 11:03 [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Nicolas Ferre
  2019-02-05 11:03 ` [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling " Nicolas Ferre
@ 2019-02-05 11:03 ` Nicolas Ferre
  2019-02-05 12:35   ` Ludovic Desroches
  2019-02-05 12:30 ` [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Ludovic Desroches
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolas Ferre @ 2019-02-05 11:03 UTC (permalink / raw)
  To: Ludovic Desroches, linux-arm-kernel, dmaengine, Vinod Koul
  Cc: Alexandre Belloni, linux-kernel

The overflow error flag (ROI: Request Overflow Error) is only relevant
for the case when the channel handles a peripheral synchronized transfer.
Not in the case of memory to memory transfer where there is no hardware
request signal.

Remove the use of this interrupt source in such a case. It's based on
the first descriptor which holds the configuration for the whole
linked list transfer.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
 drivers/dma/at_xdmac.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index ec7a29d8e448..b558a23ffbc2 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -308,6 +308,11 @@ static inline int at_xdmac_csize(u32 maxburst)
 	return csize;
 };
 
+static inline bool at_xdmac_chan_is_peripheral_xfer(u32 cfg)
+{
+	return cfg & AT_XDMAC_CC_TYPE_PER_TRAN;
+}
+
 static inline u8 at_xdmac_get_dwidth(u32 cfg)
 {
 	return (cfg & AT_XDMAC_CC_DWIDTH_MASK) >> AT_XDMAC_CC_DWIDTH_OFFSET;
@@ -389,7 +394,13 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan,
 		 at_xdmac_chan_read(atchan, AT_XDMAC_CUBC));
 
 	at_xdmac_chan_write(atchan, AT_XDMAC_CID, 0xffffffff);
-	reg = AT_XDMAC_CIE_RBEIE | AT_XDMAC_CIE_WBEIE | AT_XDMAC_CIE_ROIE;
+	reg = AT_XDMAC_CIE_RBEIE | AT_XDMAC_CIE_WBEIE;
+	/*
+	 * Request Overflow Error is only for peripheral synchronized transfers
+	 */
+	if (at_xdmac_chan_is_peripheral_xfer(first->lld.mbr_cfg))
+		reg |= AT_XDMAC_CIE_ROIE;
+
 	/*
 	 * There is no end of list when doing cyclic dma, we need to get
 	 * an interrupt after each periods.
-- 
2.17.1


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

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

* Re: [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet
  2019-02-05 11:03 [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Nicolas Ferre
  2019-02-05 11:03 ` [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling " Nicolas Ferre
  2019-02-05 11:03 ` [PATCH 3/3] dmaengine: at_xdmac: only monitor overflow errors for peripheral xfer Nicolas Ferre
@ 2019-02-05 12:30 ` Ludovic Desroches
  2 siblings, 0 replies; 8+ messages in thread
From: Ludovic Desroches @ 2019-02-05 12:30 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: dmaengine, Vinod Koul, Alexandre Belloni, linux-arm-kernel, linux-kernel

On Tue, Feb 05, 2019 at 12:03:41PM +0100, Nicolas Ferre wrote:
> Even if this case shouldn't happen when controller is properly programmed,
> it's still better to avoid dumping a kernel Oops for this.
> As the sequence may happen only for debugging purposes, log the error and
> just finish the tasklet call.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

Thanks

> ---
>  drivers/dma/at_xdmac.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index fe69dccfa0c0..37a269420435 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1606,7 +1606,11 @@ static void at_xdmac_tasklet(unsigned long data)
>  					struct at_xdmac_desc,
>  					xfer_node);
>  		dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, desc);
> -		BUG_ON(!desc->active_xfer);
> +		if (!desc->active_xfer) {
> +			dev_err(chan2dev(&atchan->chan), "Xfer not active: exiting");
> +			spin_unlock_bh(&atchan->lock);
> +			return;
> +		}
>  
>  		txd = &desc->tx_dma_desc;
>  
> -- 
> 2.17.1
> 

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

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

* Re: [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling in tasklet
  2019-02-05 11:03 ` [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling " Nicolas Ferre
@ 2019-02-05 12:33   ` Ludovic Desroches
  2019-02-11 11:58   ` Vinod Koul
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Desroches @ 2019-02-05 12:33 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: dmaengine, Vinod Koul, Alexandre Belloni, linux-arm-kernel, linux-kernel

On Tue, Feb 05, 2019 at 12:03:42PM +0100, Nicolas Ferre wrote:
> Complement the identification of errors with stoping the channel and
> dumping the descriptor that led to the error case.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

> ---
>  drivers/dma/at_xdmac.c | 43 ++++++++++++++++++++++++++++++++++++------
>  1 file changed, 37 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index 37a269420435..ec7a29d8e448 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1575,6 +1575,41 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan)
>  		dmaengine_desc_get_callback_invoke(txd, NULL);
>  }
>  
> +static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)
> +{
> +	struct at_xdmac		*atxdmac = to_at_xdmac(atchan->chan.device);
> +	struct at_xdmac_desc	*bad_desc;
> +
> +	/*
> +	 * The descriptor currently at the head of the active list is
> +	 * broked. Since we don't have any way to report errors, we'll
> +	 * just have to scream loudly and try to carry on.
> +	 */
> +	if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
> +		dev_err(chan2dev(&atchan->chan), "read bus error!!!");
> +	if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
> +		dev_err(chan2dev(&atchan->chan), "write bus error!!!");
> +	if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
> +		dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
> +
> +	spin_lock_bh(&atchan->lock);
> +	/* Channel must be disabled first as it's not done automatically */
> +	at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
> +	while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
> +		cpu_relax();
> +	bad_desc = list_first_entry(&atchan->xfers_list,
> +				    struct at_xdmac_desc,
> +				    xfer_node);
> +	spin_unlock_bh(&atchan->lock);
> +	/* Print bad descriptor's details if needed */
> +	dev_dbg(chan2dev(&atchan->chan),
> +		 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
> +		 __func__, &bad_desc->lld.mbr_sa, &bad_desc->lld.mbr_da,
> +		 bad_desc->lld.mbr_ubc);
> +
> +	/* Then continue with usual descriptor management */
> +}
> +
>  static void at_xdmac_tasklet(unsigned long data)
>  {
>  	struct at_xdmac_chan	*atchan = (struct at_xdmac_chan *)data;
> @@ -1594,12 +1629,8 @@ static void at_xdmac_tasklet(unsigned long data)
>  		   || (atchan->irq_status & error_mask)) {
>  		struct dma_async_tx_descriptor  *txd;
>  
> -		if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
> -			dev_err(chan2dev(&atchan->chan), "read bus error!!!");
> -		if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
> -			dev_err(chan2dev(&atchan->chan), "write bus error!!!");
> -		if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
> -			dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
> +		if (atchan->irq_status & error_mask)
> +			at_xdmac_handle_error(atchan);
>  
>  		spin_lock(&atchan->lock);
>  		desc = list_first_entry(&atchan->xfers_list,
> -- 
> 2.17.1
> 

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

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

* Re: [PATCH 3/3] dmaengine: at_xdmac: only monitor overflow errors for peripheral xfer
  2019-02-05 11:03 ` [PATCH 3/3] dmaengine: at_xdmac: only monitor overflow errors for peripheral xfer Nicolas Ferre
@ 2019-02-05 12:35   ` Ludovic Desroches
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Desroches @ 2019-02-05 12:35 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: dmaengine, Vinod Koul, Alexandre Belloni, linux-arm-kernel, linux-kernel

On Tue, Feb 05, 2019 at 12:03:43PM +0100, Nicolas Ferre wrote:
> The overflow error flag (ROI: Request Overflow Error) is only relevant
> for the case when the channel handles a peripheral synchronized transfer.
> Not in the case of memory to memory transfer where there is no hardware
> request signal.
> 
> Remove the use of this interrupt source in such a case. It's based on
> the first descriptor which holds the configuration for the whole
> linked list transfer.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

> ---
>  drivers/dma/at_xdmac.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index ec7a29d8e448..b558a23ffbc2 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -308,6 +308,11 @@ static inline int at_xdmac_csize(u32 maxburst)
>  	return csize;
>  };
>  
> +static inline bool at_xdmac_chan_is_peripheral_xfer(u32 cfg)
> +{
> +	return cfg & AT_XDMAC_CC_TYPE_PER_TRAN;
> +}
> +
>  static inline u8 at_xdmac_get_dwidth(u32 cfg)
>  {
>  	return (cfg & AT_XDMAC_CC_DWIDTH_MASK) >> AT_XDMAC_CC_DWIDTH_OFFSET;
> @@ -389,7 +394,13 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan,
>  		 at_xdmac_chan_read(atchan, AT_XDMAC_CUBC));
>  
>  	at_xdmac_chan_write(atchan, AT_XDMAC_CID, 0xffffffff);
> -	reg = AT_XDMAC_CIE_RBEIE | AT_XDMAC_CIE_WBEIE | AT_XDMAC_CIE_ROIE;
> +	reg = AT_XDMAC_CIE_RBEIE | AT_XDMAC_CIE_WBEIE;
> +	/*
> +	 * Request Overflow Error is only for peripheral synchronized transfers
> +	 */
> +	if (at_xdmac_chan_is_peripheral_xfer(first->lld.mbr_cfg))
> +		reg |= AT_XDMAC_CIE_ROIE;
> +
>  	/*
>  	 * There is no end of list when doing cyclic dma, we need to get
>  	 * an interrupt after each periods.
> -- 
> 2.17.1
> 

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

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

* Re: [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling in tasklet
  2019-02-05 11:03 ` [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling " Nicolas Ferre
  2019-02-05 12:33   ` Ludovic Desroches
@ 2019-02-11 11:58   ` Vinod Koul
  2019-04-03 10:05     ` Nicolas.Ferre
  1 sibling, 1 reply; 8+ messages in thread
From: Vinod Koul @ 2019-02-11 11:58 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: dmaengine, Ludovic Desroches, Alexandre Belloni,
	linux-arm-kernel, linux-kernel

On 05-02-19, 12:03, Nicolas Ferre wrote:
> Complement the identification of errors with stoping the channel and
> dumping the descriptor that led to the error case.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
>  drivers/dma/at_xdmac.c | 43 ++++++++++++++++++++++++++++++++++++------
>  1 file changed, 37 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index 37a269420435..ec7a29d8e448 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1575,6 +1575,41 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan)
>  		dmaengine_desc_get_callback_invoke(txd, NULL);
>  }
>  
> +static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)
> +{
> +	struct at_xdmac		*atxdmac = to_at_xdmac(atchan->chan.device);
> +	struct at_xdmac_desc	*bad_desc;
> +
> +	/*
> +	 * The descriptor currently at the head of the active list is
> +	 * broked. Since we don't have any way to report errors, we'll

You meant borked or broken... 

> +	 * just have to scream loudly and try to carry on.

should we carry on or abort..?

> +	 */
> +	if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
> +		dev_err(chan2dev(&atchan->chan), "read bus error!!!");
> +	if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
> +		dev_err(chan2dev(&atchan->chan), "write bus error!!!");
> +	if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
> +		dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
> +
> +	spin_lock_bh(&atchan->lock);
> +	/* Channel must be disabled first as it's not done automatically */
> +	at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
> +	while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
> +		cpu_relax();
> +	bad_desc = list_first_entry(&atchan->xfers_list,
> +				    struct at_xdmac_desc,
> +				    xfer_node);
> +	spin_unlock_bh(&atchan->lock);
> +	/* Print bad descriptor's details if needed */

Well this is not great to look and read at, please do consider adding
empty line before comments or logical blocks..

> +	dev_dbg(chan2dev(&atchan->chan),
> +		 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
> +		 __func__, &bad_desc->lld.mbr_sa, &bad_desc->lld.mbr_da,
> +		 bad_desc->lld.mbr_ubc);

not dev_err?

> +
> +	/* Then continue with usual descriptor management */
> +}
> +
>  static void at_xdmac_tasklet(unsigned long data)
>  {
>  	struct at_xdmac_chan	*atchan = (struct at_xdmac_chan *)data;
> @@ -1594,12 +1629,8 @@ static void at_xdmac_tasklet(unsigned long data)
>  		   || (atchan->irq_status & error_mask)) {
>  		struct dma_async_tx_descriptor  *txd;
>  
> -		if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
> -			dev_err(chan2dev(&atchan->chan), "read bus error!!!");
> -		if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
> -			dev_err(chan2dev(&atchan->chan), "write bus error!!!");
> -		if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
> -			dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
> +		if (atchan->irq_status & error_mask)
> +			at_xdmac_handle_error(atchan);
>  
>  		spin_lock(&atchan->lock);
>  		desc = list_first_entry(&atchan->xfers_list,
> -- 
> 2.17.1

-- 
~Vinod

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

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

* Re: [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling in tasklet
  2019-02-11 11:58   ` Vinod Koul
@ 2019-04-03 10:05     ` Nicolas.Ferre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas.Ferre @ 2019-04-03 10:05 UTC (permalink / raw)
  To: vkoul
  Cc: dmaengine, Ludovic.Desroches, alexandre.belloni,
	linux-arm-kernel, linux-kernel

Vinod,

Thanks for your review, I'm preparing v2.

On 11/02/2019 at 12:58, Vinod Koul wrote:
> On 05-02-19, 12:03, Nicolas Ferre wrote:
>> Complement the identification of errors with stoping the channel and
>> dumping the descriptor that led to the error case.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
>> ---
>>   drivers/dma/at_xdmac.c | 43 ++++++++++++++++++++++++++++++++++++------
>>   1 file changed, 37 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
>> index 37a269420435..ec7a29d8e448 100644
>> --- a/drivers/dma/at_xdmac.c
>> +++ b/drivers/dma/at_xdmac.c
>> @@ -1575,6 +1575,41 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan)
>>   		dmaengine_desc_get_callback_invoke(txd, NULL);
>>   }
>>   
>> +static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)
>> +{
>> +	struct at_xdmac		*atxdmac = to_at_xdmac(atchan->chan.device);
>> +	struct at_xdmac_desc	*bad_desc;
>> +
>> +	/*
>> +	 * The descriptor currently at the head of the active list is
>> +	 * broked. Since we don't have any way to report errors, we'll
> 
> You meant borked or broken...

Broken

> 
>> +	 * just have to scream loudly and try to carry on.
> 
> should we carry on or abort..?

Changed in:

  * just have to scream loudly and try to continue with other
  * descriptors queued (if any).

>> +	 */
>> +	if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
>> +		dev_err(chan2dev(&atchan->chan), "read bus error!!!");
>> +	if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
>> +		dev_err(chan2dev(&atchan->chan), "write bus error!!!");
>> +	if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
>> +		dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
>> +
>> +	spin_lock_bh(&atchan->lock);
>> +	/* Channel must be disabled first as it's not done automatically */
>> +	at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
>> +	while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
>> +		cpu_relax();
>> +	bad_desc = list_first_entry(&atchan->xfers_list,
>> +				    struct at_xdmac_desc,
>> +				    xfer_node);
>> +	spin_unlock_bh(&atchan->lock);
>> +	/* Print bad descriptor's details if needed */
> 
> Well this is not great to look and read at, please do consider adding
> empty line before comments or logical blocks..

True, indeed.

>> +	dev_dbg(chan2dev(&atchan->chan),
>> +		 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
>> +		 __func__, &bad_desc->lld.mbr_sa, &bad_desc->lld.mbr_da,
>> +		 bad_desc->lld.mbr_ubc);
> 
> not dev_err?

Well, we have the dev_err at the beginning of the function, I think it's 
enough: this is really debugging information that needs to be activated 
to track the DMA configuration bug: it's not meant for production.

>> +
>> +	/* Then continue with usual descriptor management */
>> +}
>> +
>>   static void at_xdmac_tasklet(unsigned long data)
>>   {
>>   	struct at_xdmac_chan	*atchan = (struct at_xdmac_chan *)data;
>> @@ -1594,12 +1629,8 @@ static void at_xdmac_tasklet(unsigned long data)
>>   		   || (atchan->irq_status & error_mask)) {
>>   		struct dma_async_tx_descriptor  *txd;
>>   
>> -		if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
>> -			dev_err(chan2dev(&atchan->chan), "read bus error!!!");
>> -		if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
>> -			dev_err(chan2dev(&atchan->chan), "write bus error!!!");
>> -		if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
>> -			dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
>> +		if (atchan->irq_status & error_mask)
>> +			at_xdmac_handle_error(atchan);
>>   
>>   		spin_lock(&atchan->lock);
>>   		desc = list_first_entry(&atchan->xfers_list,
>> -- 
>> 2.17.1
> 


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

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

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-05 11:03 [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Nicolas Ferre
2019-02-05 11:03 ` [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling " Nicolas Ferre
2019-02-05 12:33   ` Ludovic Desroches
2019-02-11 11:58   ` Vinod Koul
2019-04-03 10:05     ` Nicolas.Ferre
2019-02-05 11:03 ` [PATCH 3/3] dmaengine: at_xdmac: only monitor overflow errors for peripheral xfer Nicolas Ferre
2019-02-05 12:35   ` Ludovic Desroches
2019-02-05 12:30 ` [PATCH 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Ludovic Desroches

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox