Linux Serial subsystem development
 help / color / mirror / Atom feed
* Re: [PATCH] serial: sh-sci: disable DMA for uart_console
       [not found] ` <1557413011-1662-1-git-send-email-george_davis@mentor.com>
@ 2019-05-10 17:10   ` Eugeniu Rosca
  2019-05-10 18:38     ` George G. Davis
  2019-05-13 11:13   ` Geert Uytterhoeven
  2019-05-13 13:51   ` Wolfram Sang
  2 siblings, 1 reply; 7+ messages in thread
From: Eugeniu Rosca @ 2019-05-10 17:10 UTC (permalink / raw)
  To: George G. Davis
  Cc: Geert Uytterhoeven, Greg Kroah-Hartman, Jiri Slaby,
	open list:SERIAL DRIVERS, open list, Simon Horman, Chris Brandt,
	Wolfram Sang, Ulrich Hecht, Andy Lowe, Linux-Renesas,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Magnus Damm,
	Rob Herring, Mark Rutland, George G. Davis, Eugeniu Rosca

Hi George,

I am able to reproduce the SCIF2 console freeze described in the
referenced patchwork link using M3-ES1.1-Salvator-XS and recent
v5.1-9573-gb970afcfcabd kernel.

I confirm the behavior is healed with this patch. Thanks!
Hope to see it accepted soon, since it fixes a super annoying
console breakage every fourth boot or so on lots of R-Car3 targets.

Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>

On Thu, May 09, 2019 at 10:43:30AM -0400, George G. Davis wrote:
> As noted in commit 84b40e3b57ee ("serial: 8250: omap: Disable DMA for
> console UART"), UART console lines use low-level PIO only access functions
> which will conflict with use of the line when DMA is enabled, e.g. when
> the console line is also used for systemd messages. So disable DMA
> support for UART console lines.
> 
> Fixes: https://patchwork.kernel.org/patch/10929511/
> Reported-by: Michael Rodin <mrodin@de.adit-jv.com>
> Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
> Signed-off-by: George G. Davis <george_davis@mentor.com>
> ---
>  drivers/tty/serial/sh-sci.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 3cd139752d3f..885b56b1d4e4 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1557,6 +1557,9 @@ static void sci_request_dma(struct uart_port *port)
>  
>  	dev_dbg(port->dev, "%s: port %d\n", __func__, port->line);
>  
> +	if (uart_console(port))
> +		return; /* Cannot use DMA on console */
> +
>  	if (!port->dev->of_node)
>  		return;
>  
> -- 
> 2.7.4
> 

-- 
Best Regards,
Eugeniu.

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

* Re: [PATCH] serial: sh-sci: disable DMA for uart_console
  2019-05-10 17:10   ` [PATCH] serial: sh-sci: disable DMA for uart_console Eugeniu Rosca
@ 2019-05-10 18:38     ` George G. Davis
  2019-05-13 10:28       ` Eugeniu Rosca
  0 siblings, 1 reply; 7+ messages in thread
From: George G. Davis @ 2019-05-10 18:38 UTC (permalink / raw)
  To: Eugeniu Rosca
  Cc: George G. Davis, Geert Uytterhoeven, Greg Kroah-Hartman,
	Jiri Slaby, open list:SERIAL DRIVERS, open list, Simon Horman,
	Chris Brandt, Wolfram Sang, Ulrich Hecht, Andy Lowe,
	Linux-Renesas, OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Magnus Damm, Rob Herring, Mark Rutland, Eugeniu Rosca

Hello Eugeniu,

On Fri, May 10, 2019 at 07:10:21PM +0200, Eugeniu Rosca wrote:
> Hi George,
> 
> I am able to reproduce the SCIF2 console freeze described in the
> referenced patchwork link using M3-ES1.1-Salvator-XS and recent
> v5.1-9573-gb970afcfcabd kernel.
> 
> I confirm the behavior is healed with this patch. Thanks!
> Hope to see it accepted soon, since it fixes a super annoying
> console breakage every fourth boot or so on lots of R-Car3 targets.
> 
> Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>

Thanks for testing.

Also note, for the record, that the problem is not limited to SCIF2, e.g. try
setting console=ttySC<n> wheren <n> is not SCIF2 on any other board which
includes support for other serial ports, e.g. r8a7795-salvator-x, and you will
observe the same problem on other SCIF ports too. It's just a concidence that
most boards use SCIF2 as the default serial console where the console hangs
(resolved by this patch) have been observed on multiple boards.

> 
> On Thu, May 09, 2019 at 10:43:30AM -0400, George G. Davis wrote:
> > As noted in commit 84b40e3b57ee ("serial: 8250: omap: Disable DMA for
> > console UART"), UART console lines use low-level PIO only access functions
> > which will conflict with use of the line when DMA is enabled, e.g. when
> > the console line is also used for systemd messages. So disable DMA
> > support for UART console lines.
> > 
> > Fixes: https://patchwork.kernel.org/patch/10929511/
> > Reported-by: Michael Rodin <mrodin@de.adit-jv.com>
> > Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
> > Signed-off-by: George G. Davis <george_davis@mentor.com>
> > ---
> >  drivers/tty/serial/sh-sci.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> > index 3cd139752d3f..885b56b1d4e4 100644
> > --- a/drivers/tty/serial/sh-sci.c
> > +++ b/drivers/tty/serial/sh-sci.c
> > @@ -1557,6 +1557,9 @@ static void sci_request_dma(struct uart_port *port)
> >  
> >  	dev_dbg(port->dev, "%s: port %d\n", __func__, port->line);
> >  
> > +	if (uart_console(port))
> > +		return; /* Cannot use DMA on console */
> > +
> >  	if (!port->dev->of_node)
> >  		return;
> >  
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Best Regards,
> Eugeniu.

-- 
Regards,
George

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

* Re: [PATCH] serial: sh-sci: disable DMA for uart_console
  2019-05-10 18:38     ` George G. Davis
@ 2019-05-13 10:28       ` Eugeniu Rosca
  0 siblings, 0 replies; 7+ messages in thread
From: Eugeniu Rosca @ 2019-05-13 10:28 UTC (permalink / raw)
  To: George G. Davis
  Cc: George G. Davis, Geert Uytterhoeven, Greg Kroah-Hartman,
	Jiri Slaby, open list:SERIAL DRIVERS, open list, Simon Horman,
	Chris Brandt, Wolfram Sang, Ulrich Hecht, Andy Lowe,
	Linux-Renesas, OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Magnus Damm, Rob Herring, Mark Rutland, Eugeniu Rosca

Hi George,

On Fri, May 10, 2019 at 02:38:47PM -0400, George G. Davis wrote:
> Hello Eugeniu,
> 
> On Fri, May 10, 2019 at 07:10:21PM +0200, Eugeniu Rosca wrote:
> > Hi George,
> > 
> > I am able to reproduce the SCIF2 console freeze described in the
> > referenced patchwork link using M3-ES1.1-Salvator-XS and recent
> > v5.1-9573-gb970afcfcabd kernel.
> > 
> > I confirm the behavior is healed with this patch. Thanks!
> > Hope to see it accepted soon, since it fixes a super annoying
> > console breakage every fourth boot or so on lots of R-Car3 targets.
> > 
> > Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>
> 
> Thanks for testing.
> 
> Also note, for the record, that the problem is not limited to SCIF2, e.g. try
> setting console=ttySC<n> wheren <n> is not SCIF2 on any other board which
> includes support for other serial ports, e.g. r8a7795-salvator-x, and you will
> observe the same problem on other SCIF ports too. It's just a concidence that
> most boards use SCIF2 as the default serial console where the console hangs
> (resolved by this patch) have been observed on multiple boards.

Thanks for the additional level of detail.

FTR, trying to track the origin of the problem, it looks to me that the
issue was _unmasked_ by v4.16-rc1 commit be7e251d20e6c8 ("tty: serial:
sh-sci: Hide DMA config question") which turned on DMA on SCIF by
default.

I wonder if it'd be helpful to resend the patch w/o using --in-reply-to,
so that it appears as standalone entry in linux-renesas-soc patchwork.
Currently, assuming that the R-Car maintainers filter out any "Rejected"
patches (which is the default patchwork behavior), your patch would be
hidden from their eye.

-- 
Best Regards,
Eugeniu.

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

* Re: [PATCH] serial: sh-sci: disable DMA for uart_console
       [not found] ` <1557413011-1662-1-git-send-email-george_davis@mentor.com>
  2019-05-10 17:10   ` [PATCH] serial: sh-sci: disable DMA for uart_console Eugeniu Rosca
@ 2019-05-13 11:13   ` Geert Uytterhoeven
  2019-05-13 11:42     ` Simon Horman
  2019-05-13 13:51   ` Wolfram Sang
  2 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2019-05-13 11:13 UTC (permalink / raw)
  To: George G. Davis
  Cc: Eugeniu Rosca, Greg Kroah-Hartman, Jiri Slaby,
	open list:SERIAL DRIVERS, open list, Simon Horman, Chris Brandt,
	Wolfram Sang, Ulrich Hecht, Andy Lowe, Linux-Renesas,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Magnus Damm,
	Rob Herring, Mark Rutland, George G. Davis

Hi George,

On Thu, May 9, 2019 at 4:44 PM George G. Davis <ggdavisiv@gmail.com> wrote:
> As noted in commit 84b40e3b57ee ("serial: 8250: omap: Disable DMA for
> console UART"), UART console lines use low-level PIO only access functions
> which will conflict with use of the line when DMA is enabled, e.g. when
> the console line is also used for systemd messages. So disable DMA
> support for UART console lines.
>
> Fixes: https://patchwork.kernel.org/patch/10929511/
> Reported-by: Michael Rodin <mrodin@de.adit-jv.com>
> Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
> Signed-off-by: George G. Davis <george_davis@mentor.com>

I think this makes sense.  In addition to OMAP 8250, the same approach
is used in the Mediatek 8250 and iMX serial drivers.

Regardless, this is definitely better than removing the "dmas" properties
from DT, as DT describes hardware, not usage policies.

Anyone else with a comment?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] serial: sh-sci: disable DMA for uart_console
  2019-05-13 11:13   ` Geert Uytterhoeven
@ 2019-05-13 11:42     ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2019-05-13 11:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: George G. Davis, Eugeniu Rosca, Greg Kroah-Hartman, Jiri Slaby,
	open list:SERIAL DRIVERS, open list, Chris Brandt, Wolfram Sang,
	Ulrich Hecht, Andy Lowe, Linux-Renesas,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Magnus Damm,
	Rob Herring, Mark Rutland, George G. Davis

On Mon, May 13, 2019 at 01:13:16PM +0200, Geert Uytterhoeven wrote:
> Hi George,
> 
> On Thu, May 9, 2019 at 4:44 PM George G. Davis <ggdavisiv@gmail.com> wrote:
> > As noted in commit 84b40e3b57ee ("serial: 8250: omap: Disable DMA for
> > console UART"), UART console lines use low-level PIO only access functions
> > which will conflict with use of the line when DMA is enabled, e.g. when
> > the console line is also used for systemd messages. So disable DMA
> > support for UART console lines.
> >
> > Fixes: https://patchwork.kernel.org/patch/10929511/
> > Reported-by: Michael Rodin <mrodin@de.adit-jv.com>
> > Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
> > Signed-off-by: George G. Davis <george_davis@mentor.com>
> 
> I think this makes sense.  In addition to OMAP 8250, the same approach
> is used in the Mediatek 8250 and iMX serial drivers.
> 
> Regardless, this is definitely better than removing the "dmas" properties
> from DT, as DT describes hardware, not usage policies.

+1

> Anyone else with a comment?

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

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

* Re: [PATCH] serial: sh-sci: disable DMA for uart_console
       [not found] ` <1557413011-1662-1-git-send-email-george_davis@mentor.com>
  2019-05-10 17:10   ` [PATCH] serial: sh-sci: disable DMA for uart_console Eugeniu Rosca
  2019-05-13 11:13   ` Geert Uytterhoeven
@ 2019-05-13 13:51   ` Wolfram Sang
  2019-05-13 15:43     ` George G. Davis
  2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2019-05-13 13:51 UTC (permalink / raw)
  To: George G. Davis
  Cc: Eugeniu Rosca, Geert Uytterhoeven, Greg Kroah-Hartman, Jiri Slaby,
	open list:SERIAL DRIVERS, open list, Simon Horman, Chris Brandt,
	Wolfram Sang, Ulrich Hecht, Andy Lowe, Linux-Renesas,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Magnus Damm,
	Rob Herring, Mark Rutland, George G. Davis

[-- Attachment #1: Type: text/plain, Size: 1465 bytes --]

On Thu, May 09, 2019 at 10:43:30AM -0400, George G. Davis wrote:
> As noted in commit 84b40e3b57ee ("serial: 8250: omap: Disable DMA for
> console UART"), UART console lines use low-level PIO only access functions
> which will conflict with use of the line when DMA is enabled, e.g. when
> the console line is also used for systemd messages. So disable DMA
> support for UART console lines.
> 
> Fixes: https://patchwork.kernel.org/patch/10929511/
> Reported-by: Michael Rodin <mrodin@de.adit-jv.com>
> Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
> Signed-off-by: George G. Davis <george_davis@mentor.com>
> ---
>  drivers/tty/serial/sh-sci.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 3cd139752d3f..885b56b1d4e4 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1557,6 +1557,9 @@ static void sci_request_dma(struct uart_port *port)
>  
>  	dev_dbg(port->dev, "%s: port %d\n", __func__, port->line);
>  
> +	if (uart_console(port))
> +		return; /* Cannot use DMA on console */

Minor nit: maybe the comment can be made more specific?

/*
 * DMA on console may interfere with Kernel log messages which use
 * plain putchar(). So, simply don't use it with a console.
 */

Other than that:

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Much better than dropping the properties, as Geert noted.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] serial: sh-sci: disable DMA for uart_console
  2019-05-13 13:51   ` Wolfram Sang
@ 2019-05-13 15:43     ` George G. Davis
  0 siblings, 0 replies; 7+ messages in thread
From: George G. Davis @ 2019-05-13 15:43 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: George G. Davis, Eugeniu Rosca, Geert Uytterhoeven,
	Greg Kroah-Hartman, Jiri Slaby, open list:SERIAL DRIVERS,
	open list, Simon Horman, Chris Brandt, Wolfram Sang, Ulrich Hecht,
	Andy Lowe, Linux-Renesas,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Magnus Damm,
	Rob Herring, Mark Rutland

Hello Wolfram,

On Mon, May 13, 2019 at 03:51:14PM +0200, Wolfram Sang wrote:
> On Thu, May 09, 2019 at 10:43:30AM -0400, George G. Davis wrote:
> > As noted in commit 84b40e3b57ee ("serial: 8250: omap: Disable DMA for
> > console UART"), UART console lines use low-level PIO only access functions
> > which will conflict with use of the line when DMA is enabled, e.g. when
> > the console line is also used for systemd messages. So disable DMA
> > support for UART console lines.
> > 
> > Fixes: https://patchwork.kernel.org/patch/10929511/
> > Reported-by: Michael Rodin <mrodin@de.adit-jv.com>
> > Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
> > Signed-off-by: George G. Davis <george_davis@mentor.com>
> > ---
> >  drivers/tty/serial/sh-sci.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> > index 3cd139752d3f..885b56b1d4e4 100644
> > --- a/drivers/tty/serial/sh-sci.c
> > +++ b/drivers/tty/serial/sh-sci.c
> > @@ -1557,6 +1557,9 @@ static void sci_request_dma(struct uart_port *port)
> >  
> >  	dev_dbg(port->dev, "%s: port %d\n", __func__, port->line);
> >  
> > +	if (uart_console(port))
> > +		return; /* Cannot use DMA on console */
> 
> Minor nit: maybe the comment can be made more specific?
> 
> /*
>  * DMA on console may interfere with Kernel log messages which use
>  * plain putchar(). So, simply don't use it with a console.
>  */

I'll submit v2 with the above recommended change.

Thanks!

> Other than that:
> 
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Much better than dropping the properties, as Geert noted.

-- 
Regards,
George

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

end of thread, other threads:[~2019-05-13 15:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190506194233.GA32430@vmlxhi-102.adit-jv.com>
     [not found] ` <1557413011-1662-1-git-send-email-george_davis@mentor.com>
2019-05-10 17:10   ` [PATCH] serial: sh-sci: disable DMA for uart_console Eugeniu Rosca
2019-05-10 18:38     ` George G. Davis
2019-05-13 10:28       ` Eugeniu Rosca
2019-05-13 11:13   ` Geert Uytterhoeven
2019-05-13 11:42     ` Simon Horman
2019-05-13 13:51   ` Wolfram Sang
2019-05-13 15:43     ` George G. Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox