All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
@ 2021-11-15 14:30 ` Tudor Ambarus
  0 siblings, 0 replies; 10+ messages in thread
From: Tudor Ambarus @ 2021-11-15 14:30 UTC (permalink / raw)
  To: richard.genoud, gregkh, jirislaby
  Cc: nicolas.ferre, alexandre.belloni, ludovic.desroches,
	linux-serial, linux-arm-kernel, linux-kernel, Tudor Ambarus

dma_cookie_t < 0 indicates an error code, check for it.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/tty/serial/atmel_serial.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2c99a47a2535..376f7a9c2868 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
 		desc->callback = atmel_complete_tx_dma;
 		desc->callback_param = atmel_port;
 		atmel_port->cookie_tx = dmaengine_submit(desc);
+		if (dma_submit_error(atmel_port->cookie_tx)) {
+			dev_err(port->dev, "dma_submit_error %d\n",
+				atmel_port->cookie_tx);
+			return;
+		}
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -1258,6 +1263,11 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
 	desc->callback_param = port;
 	atmel_port->desc_rx = desc;
 	atmel_port->cookie_rx = dmaengine_submit(desc);
+	if (dma_submit_error(atmel_port->cookie_rx)) {
+		dev_err(port->dev, "dma_submit_error %d\n",
+			atmel_port->cookie_rx);
+		goto chan_err;
+	}
 
 	return 0;
 
-- 
2.25.1


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

* [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
@ 2021-11-15 14:30 ` Tudor Ambarus
  0 siblings, 0 replies; 10+ messages in thread
From: Tudor Ambarus @ 2021-11-15 14:30 UTC (permalink / raw)
  To: richard.genoud, gregkh, jirislaby
  Cc: alexandre.belloni, Tudor Ambarus, linux-kernel,
	ludovic.desroches, linux-serial, linux-arm-kernel

dma_cookie_t < 0 indicates an error code, check for it.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/tty/serial/atmel_serial.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2c99a47a2535..376f7a9c2868 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
 		desc->callback = atmel_complete_tx_dma;
 		desc->callback_param = atmel_port;
 		atmel_port->cookie_tx = dmaengine_submit(desc);
+		if (dma_submit_error(atmel_port->cookie_tx)) {
+			dev_err(port->dev, "dma_submit_error %d\n",
+				atmel_port->cookie_tx);
+			return;
+		}
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -1258,6 +1263,11 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
 	desc->callback_param = port;
 	atmel_port->desc_rx = desc;
 	atmel_port->cookie_rx = dmaengine_submit(desc);
+	if (dma_submit_error(atmel_port->cookie_rx)) {
+		dev_err(port->dev, "dma_submit_error %d\n",
+			atmel_port->cookie_rx);
+		goto chan_err;
+	}
 
 	return 0;
 
-- 
2.25.1


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

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

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
  2021-11-15 14:30 ` Tudor Ambarus
@ 2021-11-15 15:58   ` Greg KH
  -1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-11-15 15:58 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: richard.genoud, jirislaby, nicolas.ferre, alexandre.belloni,
	ludovic.desroches, linux-serial, linux-arm-kernel, linux-kernel

On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
> dma_cookie_t < 0 indicates an error code, check for it.

Very odd changelog text, please be more descriptive about what is
happening here.

> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 2c99a47a2535..376f7a9c2868 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
>  		desc->callback = atmel_complete_tx_dma;
>  		desc->callback_param = atmel_port;
>  		atmel_port->cookie_tx = dmaengine_submit(desc);
> +		if (dma_submit_error(atmel_port->cookie_tx)) {
> +			dev_err(port->dev, "dma_submit_error %d\n",
> +				atmel_port->cookie_tx);
> +			return;

What can a user do with this error message?

Have you seen this happen in real life?

What commit does this "fix"?

thanks,

greg k-h

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

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
@ 2021-11-15 15:58   ` Greg KH
  0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-11-15 15:58 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: alexandre.belloni, richard.genoud, linux-kernel,
	ludovic.desroches, linux-serial, jirislaby, linux-arm-kernel

On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
> dma_cookie_t < 0 indicates an error code, check for it.

Very odd changelog text, please be more descriptive about what is
happening here.

> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 2c99a47a2535..376f7a9c2868 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
>  		desc->callback = atmel_complete_tx_dma;
>  		desc->callback_param = atmel_port;
>  		atmel_port->cookie_tx = dmaengine_submit(desc);
> +		if (dma_submit_error(atmel_port->cookie_tx)) {
> +			dev_err(port->dev, "dma_submit_error %d\n",
> +				atmel_port->cookie_tx);
> +			return;

What can a user do with this error message?

Have you seen this happen in real life?

What commit does this "fix"?

thanks,

greg k-h

_______________________________________________
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] 10+ messages in thread

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
  2021-11-15 15:58   ` Greg KH
@ 2021-11-16  6:14     ` Tudor.Ambarus
  -1 siblings, 0 replies; 10+ messages in thread
From: Tudor.Ambarus @ 2021-11-16  6:14 UTC (permalink / raw)
  To: gregkh
  Cc: richard.genoud, jirislaby, Nicolas.Ferre, alexandre.belloni,
	Ludovic.Desroches, linux-serial, linux-arm-kernel, linux-kernel

On 11/15/21 5:58 PM, Greg KH wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
>> dma_cookie_t < 0 indicates an error code, check for it.
> 
> Very odd changelog text, please be more descriptive about what is
> happening here.
> 

The tx_submit() method of struct dma_async_tx_descriptor is entitled to do
sanity checks and return errors if encountered. It's not the case for the
DMA controller drivers that this client is using (at_h/xdmac), because they
currently don't do sanity checks and always return a positive cookie at
tx_submit() method. In case the controller drivers will implement sanity
checks and return errors, print a message so that the client will be informed
that something went wrong at tx_submit() level.

>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
>>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>> index 2c99a47a2535..376f7a9c2868 100644
>> --- a/drivers/tty/serial/atmel_serial.c
>> +++ b/drivers/tty/serial/atmel_serial.c
>> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
>>               desc->callback = atmel_complete_tx_dma;
>>               desc->callback_param = atmel_port;
>>               atmel_port->cookie_tx = dmaengine_submit(desc);
>> +             if (dma_submit_error(atmel_port->cookie_tx)) {
>> +                     dev_err(port->dev, "dma_submit_error %d\n",
>> +                             atmel_port->cookie_tx);
>> +                     return;
> 
> What can a user do with this error message?
> 
will be informed that something went wrong at tx_submit() level.

> Have you seen this happen in real life?

No. I debugged a locking problem and I observed that dma_submit_error() is not called,
so I thought to update this.

> 
> What commit does this "fix"?

This is rather an improvement, but if you're looking for a fixes tag, I think
we can use:
Fixes: 08f738be88bb ("serial: at91: add tx dma support")

I'll send a v2 as part of a bigger series. If you find this patch does not worth it,
I can as well drop it.

Cheers,
ta

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

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
@ 2021-11-16  6:14     ` Tudor.Ambarus
  0 siblings, 0 replies; 10+ messages in thread
From: Tudor.Ambarus @ 2021-11-16  6:14 UTC (permalink / raw)
  To: gregkh
  Cc: alexandre.belloni, richard.genoud, linux-kernel,
	Ludovic.Desroches, linux-serial, jirislaby, linux-arm-kernel

On 11/15/21 5:58 PM, Greg KH wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
>> dma_cookie_t < 0 indicates an error code, check for it.
> 
> Very odd changelog text, please be more descriptive about what is
> happening here.
> 

The tx_submit() method of struct dma_async_tx_descriptor is entitled to do
sanity checks and return errors if encountered. It's not the case for the
DMA controller drivers that this client is using (at_h/xdmac), because they
currently don't do sanity checks and always return a positive cookie at
tx_submit() method. In case the controller drivers will implement sanity
checks and return errors, print a message so that the client will be informed
that something went wrong at tx_submit() level.

>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
>>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>> index 2c99a47a2535..376f7a9c2868 100644
>> --- a/drivers/tty/serial/atmel_serial.c
>> +++ b/drivers/tty/serial/atmel_serial.c
>> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
>>               desc->callback = atmel_complete_tx_dma;
>>               desc->callback_param = atmel_port;
>>               atmel_port->cookie_tx = dmaengine_submit(desc);
>> +             if (dma_submit_error(atmel_port->cookie_tx)) {
>> +                     dev_err(port->dev, "dma_submit_error %d\n",
>> +                             atmel_port->cookie_tx);
>> +                     return;
> 
> What can a user do with this error message?
> 
will be informed that something went wrong at tx_submit() level.

> Have you seen this happen in real life?

No. I debugged a locking problem and I observed that dma_submit_error() is not called,
so I thought to update this.

> 
> What commit does this "fix"?

This is rather an improvement, but if you're looking for a fixes tag, I think
we can use:
Fixes: 08f738be88bb ("serial: at91: add tx dma support")

I'll send a v2 as part of a bigger series. If you find this patch does not worth it,
I can as well drop it.

Cheers,
ta
_______________________________________________
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] 10+ messages in thread

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
  2021-11-16  6:14     ` Tudor.Ambarus
@ 2021-11-16  8:26       ` Greg KH
  -1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-11-16  8:26 UTC (permalink / raw)
  To: Tudor.Ambarus
  Cc: richard.genoud, jirislaby, Nicolas.Ferre, alexandre.belloni,
	Ludovic.Desroches, linux-serial, linux-arm-kernel, linux-kernel

On Tue, Nov 16, 2021 at 06:14:23AM +0000, Tudor.Ambarus@microchip.com wrote:
> On 11/15/21 5:58 PM, Greg KH wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
> >> dma_cookie_t < 0 indicates an error code, check for it.
> > 
> > Very odd changelog text, please be more descriptive about what is
> > happening here.
> > 
> 
> The tx_submit() method of struct dma_async_tx_descriptor is entitled to do
> sanity checks and return errors if encountered. It's not the case for the
> DMA controller drivers that this client is using (at_h/xdmac), because they
> currently don't do sanity checks and always return a positive cookie at
> tx_submit() method. In case the controller drivers will implement sanity
> checks and return errors, print a message so that the client will be informed
> that something went wrong at tx_submit() level.
> 
> >>
> >> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> >> ---
> >>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
> >>  1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> >> index 2c99a47a2535..376f7a9c2868 100644
> >> --- a/drivers/tty/serial/atmel_serial.c
> >> +++ b/drivers/tty/serial/atmel_serial.c
> >> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
> >>               desc->callback = atmel_complete_tx_dma;
> >>               desc->callback_param = atmel_port;
> >>               atmel_port->cookie_tx = dmaengine_submit(desc);
> >> +             if (dma_submit_error(atmel_port->cookie_tx)) {
> >> +                     dev_err(port->dev, "dma_submit_error %d\n",
> >> +                             atmel_port->cookie_tx);
> >> +                     return;
> > 
> > What can a user do with this error message?
> > 
> will be informed that something went wrong at tx_submit() level.
> 
> > Have you seen this happen in real life?
> 
> No. I debugged a locking problem and I observed that dma_submit_error() is not called,
> so I thought to update this.
> 
> > 
> > What commit does this "fix"?
> 
> This is rather an improvement, but if you're looking for a fixes tag, I think
> we can use:
> Fixes: 08f738be88bb ("serial: at91: add tx dma support")
> 
> I'll send a v2 as part of a bigger series. If you find this patch does not worth it,
> I can as well drop it.

Please resend it because as-is, I can not take it.

thanks,

greg k-h

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

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
@ 2021-11-16  8:26       ` Greg KH
  0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-11-16  8:26 UTC (permalink / raw)
  To: Tudor.Ambarus
  Cc: alexandre.belloni, richard.genoud, linux-kernel,
	Ludovic.Desroches, linux-serial, jirislaby, linux-arm-kernel

On Tue, Nov 16, 2021 at 06:14:23AM +0000, Tudor.Ambarus@microchip.com wrote:
> On 11/15/21 5:58 PM, Greg KH wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
> >> dma_cookie_t < 0 indicates an error code, check for it.
> > 
> > Very odd changelog text, please be more descriptive about what is
> > happening here.
> > 
> 
> The tx_submit() method of struct dma_async_tx_descriptor is entitled to do
> sanity checks and return errors if encountered. It's not the case for the
> DMA controller drivers that this client is using (at_h/xdmac), because they
> currently don't do sanity checks and always return a positive cookie at
> tx_submit() method. In case the controller drivers will implement sanity
> checks and return errors, print a message so that the client will be informed
> that something went wrong at tx_submit() level.
> 
> >>
> >> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> >> ---
> >>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
> >>  1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> >> index 2c99a47a2535..376f7a9c2868 100644
> >> --- a/drivers/tty/serial/atmel_serial.c
> >> +++ b/drivers/tty/serial/atmel_serial.c
> >> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
> >>               desc->callback = atmel_complete_tx_dma;
> >>               desc->callback_param = atmel_port;
> >>               atmel_port->cookie_tx = dmaengine_submit(desc);
> >> +             if (dma_submit_error(atmel_port->cookie_tx)) {
> >> +                     dev_err(port->dev, "dma_submit_error %d\n",
> >> +                             atmel_port->cookie_tx);
> >> +                     return;
> > 
> > What can a user do with this error message?
> > 
> will be informed that something went wrong at tx_submit() level.
> 
> > Have you seen this happen in real life?
> 
> No. I debugged a locking problem and I observed that dma_submit_error() is not called,
> so I thought to update this.
> 
> > 
> > What commit does this "fix"?
> 
> This is rather an improvement, but if you're looking for a fixes tag, I think
> we can use:
> Fixes: 08f738be88bb ("serial: at91: add tx dma support")
> 
> I'll send a v2 as part of a bigger series. If you find this patch does not worth it,
> I can as well drop it.

Please resend it because as-is, I can not take it.

thanks,

greg k-h

_______________________________________________
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] 10+ messages in thread

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
  2021-11-16  8:26       ` Greg KH
@ 2021-11-16 11:33         ` Tudor.Ambarus
  -1 siblings, 0 replies; 10+ messages in thread
From: Tudor.Ambarus @ 2021-11-16 11:33 UTC (permalink / raw)
  To: gregkh
  Cc: richard.genoud, jirislaby, Nicolas.Ferre, alexandre.belloni,
	Ludovic.Desroches, linux-serial, linux-arm-kernel, linux-kernel

On 11/16/21 10:26 AM, Greg KH wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Tue, Nov 16, 2021 at 06:14:23AM +0000, Tudor.Ambarus@microchip.com wrote:
>> On 11/15/21 5:58 PM, Greg KH wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
>>>> dma_cookie_t < 0 indicates an error code, check for it.
>>>
>>> Very odd changelog text, please be more descriptive about what is
>>> happening here.
>>>
>>
>> The tx_submit() method of struct dma_async_tx_descriptor is entitled to do
>> sanity checks and return errors if encountered. It's not the case for the
>> DMA controller drivers that this client is using (at_h/xdmac), because they
>> currently don't do sanity checks and always return a positive cookie at
>> tx_submit() method. In case the controller drivers will implement sanity
>> checks and return errors, print a message so that the client will be informed
>> that something went wrong at tx_submit() level.
>>
>>>>
>>>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>>>> ---
>>>>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
>>>>  1 file changed, 10 insertions(+)
>>>>
>>>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>>>> index 2c99a47a2535..376f7a9c2868 100644
>>>> --- a/drivers/tty/serial/atmel_serial.c
>>>> +++ b/drivers/tty/serial/atmel_serial.c
>>>> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
>>>>               desc->callback = atmel_complete_tx_dma;
>>>>               desc->callback_param = atmel_port;
>>>>               atmel_port->cookie_tx = dmaengine_submit(desc);
>>>> +             if (dma_submit_error(atmel_port->cookie_tx)) {
>>>> +                     dev_err(port->dev, "dma_submit_error %d\n",
>>>> +                             atmel_port->cookie_tx);
>>>> +                     return;
>>>
>>> What can a user do with this error message?
>>>
>> will be informed that something went wrong at tx_submit() level.
>>
>>> Have you seen this happen in real life?
>>
>> No. I debugged a locking problem and I observed that dma_submit_error() is not called,
>> so I thought to update this.
>>
>>>
>>> What commit does this "fix"?
>>
>> This is rather an improvement, but if you're looking for a fixes tag, I think
>> we can use:
>> Fixes: 08f738be88bb ("serial: at91: add tx dma support")
>>
>> I'll send a v2 as part of a bigger series. If you find this patch does not worth it,
>> I can as well drop it.
> 
> Please resend it because as-is, I can not take it.
> 

I've sent a v2 of this patch as a part of a larger series:
https://lore.kernel.org/all/20211116112036.96349-1-tudor.ambarus@microchip.com/

The slave DMA usage was wrong in both the DMA controller driver and the
serial driver and patch 1/13 and 3/13 are trying to address that.
v2 of this patch is 2/13. I guess all should be considered for an immutable
branch on the DMA tree.

Cheers,
ta

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

* Re: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
@ 2021-11-16 11:33         ` Tudor.Ambarus
  0 siblings, 0 replies; 10+ messages in thread
From: Tudor.Ambarus @ 2021-11-16 11:33 UTC (permalink / raw)
  To: gregkh
  Cc: alexandre.belloni, richard.genoud, linux-kernel,
	Ludovic.Desroches, linux-serial, jirislaby, linux-arm-kernel

On 11/16/21 10:26 AM, Greg KH wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Tue, Nov 16, 2021 at 06:14:23AM +0000, Tudor.Ambarus@microchip.com wrote:
>> On 11/15/21 5:58 PM, Greg KH wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On Mon, Nov 15, 2021 at 04:30:04PM +0200, Tudor Ambarus wrote:
>>>> dma_cookie_t < 0 indicates an error code, check for it.
>>>
>>> Very odd changelog text, please be more descriptive about what is
>>> happening here.
>>>
>>
>> The tx_submit() method of struct dma_async_tx_descriptor is entitled to do
>> sanity checks and return errors if encountered. It's not the case for the
>> DMA controller drivers that this client is using (at_h/xdmac), because they
>> currently don't do sanity checks and always return a positive cookie at
>> tx_submit() method. In case the controller drivers will implement sanity
>> checks and return errors, print a message so that the client will be informed
>> that something went wrong at tx_submit() level.
>>
>>>>
>>>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>>>> ---
>>>>  drivers/tty/serial/atmel_serial.c | 10 ++++++++++
>>>>  1 file changed, 10 insertions(+)
>>>>
>>>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>>>> index 2c99a47a2535..376f7a9c2868 100644
>>>> --- a/drivers/tty/serial/atmel_serial.c
>>>> +++ b/drivers/tty/serial/atmel_serial.c
>>>> @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
>>>>               desc->callback = atmel_complete_tx_dma;
>>>>               desc->callback_param = atmel_port;
>>>>               atmel_port->cookie_tx = dmaengine_submit(desc);
>>>> +             if (dma_submit_error(atmel_port->cookie_tx)) {
>>>> +                     dev_err(port->dev, "dma_submit_error %d\n",
>>>> +                             atmel_port->cookie_tx);
>>>> +                     return;
>>>
>>> What can a user do with this error message?
>>>
>> will be informed that something went wrong at tx_submit() level.
>>
>>> Have you seen this happen in real life?
>>
>> No. I debugged a locking problem and I observed that dma_submit_error() is not called,
>> so I thought to update this.
>>
>>>
>>> What commit does this "fix"?
>>
>> This is rather an improvement, but if you're looking for a fixes tag, I think
>> we can use:
>> Fixes: 08f738be88bb ("serial: at91: add tx dma support")
>>
>> I'll send a v2 as part of a bigger series. If you find this patch does not worth it,
>> I can as well drop it.
> 
> Please resend it because as-is, I can not take it.
> 

I've sent a v2 of this patch as a part of a larger series:
https://lore.kernel.org/all/20211116112036.96349-1-tudor.ambarus@microchip.com/

The slave DMA usage was wrong in both the DMA controller driver and the
serial driver and patch 1/13 and 3/13 are trying to address that.
v2 of this patch is 2/13. I guess all should be considered for an immutable
branch on the DMA tree.

Cheers,
ta
_______________________________________________
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] 10+ messages in thread

end of thread, other threads:[~2021-11-16 11:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 14:30 [PATCH] tty: serial: atmel: Check return code of dmaengine_submit() Tudor Ambarus
2021-11-15 14:30 ` Tudor Ambarus
2021-11-15 15:58 ` Greg KH
2021-11-15 15:58   ` Greg KH
2021-11-16  6:14   ` Tudor.Ambarus
2021-11-16  6:14     ` Tudor.Ambarus
2021-11-16  8:26     ` Greg KH
2021-11-16  8:26       ` Greg KH
2021-11-16 11:33       ` Tudor.Ambarus
2021-11-16 11:33         ` Tudor.Ambarus

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.