Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: peter@hurleysoftware.com (Peter Hurley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/16] tty: serial: 8250_dma: Add a TX trigger workaround for AM33xx
Date: Tue, 23 Sep 2014 13:03:51 -0400
Message-ID: <5421A7F7.3070109@hurleysoftware.com> (raw)
In-Reply-To: <20140921204100.GA10111@linutronix.de>

On 09/21/2014 04:41 PM, Sebastian Andrzej Siewior wrote:
> * Frans Klaver | 2014-09-17 12:28:12 [+0200]:
> 
>> - Bone Black: Yocto poky, core-image-minimal
>>  Login, "less file" locks up, doesn't show anything. I can exit using
>>  Ctrl-C.
> 
> So I have the same with my and the serial-omap driver. No difference
> here. The trace looks like this:
> |           <idle>-0     [000] d.h.   444.393585: serial8250_handle_irq: iir cc lsr 61
> |           <idle>-0     [000] d.h.   444.393605: serial8250_rx_chars: get 0d
> received the enter key
> 
> |           <idle>-0     [000] d.h.   444.393609: serial8250_rx_chars: insert d lsr 61
> |           <idle>-0     [000] d.h.   444.393614: uart_insert_char: 1
> |           <idle>-0     [000] d.h.   444.393617: uart_insert_char: 2
> |           <idle>-0     [000] dnh.   444.393636: serial8250_tx_chars: empty
> |      kworker/0:2-753   [000] d...   444.393686: serial8250_start_tx: empty?1
> |      kworker/0:2-753   [000] d.h.   444.393699: serial8250_handle_irq: iir c2 lsr 60
> |      kworker/0:2-753   [000] d.h.   444.393705: serial8250_tx_chars: empty
> |               sh-1042  [000] d...   444.393822: serial8250_start_tx: empty?1
> |               sh-1042  [000] d.h.   444.393836: serial8250_handle_irq: iir c2 lsr 60
> |               sh-1042  [000] d.h.   444.393842: serial8250_tx_chars: empty
> |               sh-1042  [000] d...   444.393855: serial8250_start_tx: empty?0
> |               sh-1042  [000] d.h.   444.393863: serial8250_handle_irq: iir c2 lsr 60
> |               sh-1042  [000] d.h.   444.393867: serial8250_tx_chars: put 0d
> |               sh-1042  [000] d.h.   444.393871: serial8250_tx_chars: put 0a
> 
> shell responded with "\r\n" which I see and then
> 
> |               sh-1042  [000] d.h.   444.394057: serial8250_handle_irq: iir c2 lsr 60
> |               sh-1042  [000] d.h.   444.394065: serial8250_tx_chars: empty
> 
> nothing more. less isn't sending data for some reason. Exactly the same
> thing happens in a Debian environment except that it continues:
> ?
> |             bash-2468  [000] d.h.    99.657899: serial8250_tx_chars: put 0a
> |             bash-2468  [000] d.h.    99.658089: serial8250_handle_irq: iir c2 lsr 60
> |             bash-2468  [000] d.h.    99.658095: serial8250_tx_chars: empty
> =>
> |             less-2474  [000] d...    99.696038: serial8250_start_tx: empty?0
> |             less-2474  [000] d.h.    99.696069: serial8250_handle_irq: iir c2 lsr 60
> |             less-2474  [000] d.h.    99.696078: serial8250_tx_chars: put 1b
> |             less-2474  [000] d.h.    99.696082: serial8250_tx_chars: put 5b
> |             less-2474  [000] d.h.    99.696085: serial8250_tx_chars: put 3f
> |             less-2474  [000] d.h.    99.696087: serial8250_tx_chars: put 31
> 
> It has to be something about the environment. Booting Debian and chroot
> into this RFS and less works perfectly. But since it behaves like that
> with both drivers, I guess the problem is somewhere else?
> 
>>  vi runs normally, only occupies part of the total screen estate in
>>  minicom. After quitting, a weird character shows up (typically I see
>>  ? there), but minicom can use the rest of the screen estate again.
>>  If we disregard the odd character, this is much like the behavior we
>>  have on the omap-serial driver.
>> - Custom board: Yocto poky, custom image
>>  Login, "less file" locks up, showing only "?" in the top left corner
>>  of the screen. Can get out of there by having something dumped through
>>  /dev/kmsg.
> 
> I managed to run into something like that with vi on dra7 and with
> little more patience on am335x as well by "vi *" and then ":n".
> 
> This gets fixed indeed by writing. Hours of debugging and a lot of hair
> less later: the yocto RFS calls set_termios quite a lot.

readline() does this; it 'saves' the caller's termios, sets termios
for non-canonical reads, reads one char, and 'restores' the caller's
termios.

> This includes
> changing the baudrate (not by yocto but the driver sets it to 0 and then
> to the requested one) and this seems to be responsible for the "bad
> bytes". I haven't figured out yet I don't see this with omap-serial.
> Even worse: If this (set_termios()) happens while the DMA is still
> active then it might stall it. A write into the FIFO seems to fix it and
> this is where your "echo >/dev/kmsg" fixes things.
> If I delay the restore_registers part of set_termios() until TX-DMA is
> complete then it seems that the TX-DMA stall does not tall anymore.

The tty core calls the driver's wait_until_sent() method before changing
the termios (if TCSADRAIN is used for tcsetattr(), which I think for readline()
it does).

But DMA is cheating if the UART driver's tx_empty() method is saying the
transmitter is empty while TX DMA is still running.

Regards,
Peter Hurley
 

  parent reply index

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 19:29 [PATCH 00/16 v9] omap 8250 based uart + DMA Sebastian Andrzej Siewior
2014-09-10 19:29 ` [PATCH 01/16] tty: serial: 8250_core: allow to set ->throttle / ->unthrottle callbacks Sebastian Andrzej Siewior
2014-09-10 19:29 ` [PATCH 02/16] tty: serial: 8250_core: add run time pm Sebastian Andrzej Siewior
2014-09-29  9:46   ` Frans Klaver
2014-09-29 13:39     ` Sebastian Andrzej Siewior
2014-09-10 19:29 ` [PATCH 03/16] tty: serial: 8250_core: read only RX if there is something in the FIFO Sebastian Andrzej Siewior
2015-02-09 13:34   ` Nicolas Schichan
2015-02-09 23:34     ` Peter Hurley
2015-02-10  9:32       ` Sebastian Andrzej Siewior
2015-02-10 12:04       ` Nicolas Schichan
2015-02-10 17:46         ` Peter Hurley
2015-02-11 20:01           ` Peter Hurley
2015-02-11 20:03             ` Tony Lindgren
2015-02-11 20:42               ` Peter Hurley
2015-02-12  8:45                 ` Sebastian Andrzej Siewior
2015-02-12  9:40                   ` Russell King - ARM Linux
2015-02-12 16:32                   ` Peter Hurley
2015-02-12 19:23                     ` Sebastian Andrzej Siewior
2015-02-12 19:55                       ` Peter Hurley
2015-02-12 20:34                         ` Sebastian Andrzej Siewior
2015-02-13 18:51                         ` Sebastian Andrzej Siewior
2015-02-13 23:15                           ` Russell King - ARM Linux
2015-02-15 17:32                             ` [PATCH] serial: 8250: Revert "tty: serial: 8250_core: read only RX if there is something in the FIFO" Sebastian Andrzej Siewior
2015-05-12 20:25                               ` Tony Lindgren
2014-09-10 19:29 ` [PATCH 04/16] tty: serial: 8250_core: use the ->line argument as a hint in serial8250_find_match_or_unused() Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 05/16] tty: serial: 8250_core: remove UART_IER_RDI in serial8250_stop_rx() Sebastian Andrzej Siewior
2014-09-11 11:19   ` Heikki Krogerus
2014-09-10 19:30 ` [PATCH 06/16] tty: serial: Add 8250-core based omap driver Sebastian Andrzej Siewior
2014-09-11 11:57   ` Peter Hurley
2014-09-16 17:01     ` Sebastian Andrzej Siewior
2014-09-29  9:38   ` Frans Klaver
2014-09-29 13:27     ` Sebastian Andrzej Siewior
2014-09-29 13:34       ` Frans Klaver
2014-09-10 19:30 ` [PATCH 07/16] tty: serial: 8250_dma: handle error on TX submit Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 08/16] tty: serial: 8250_dma: enqueue RX dma again on completion Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 09/16] tty: serial: 8250_dma: Add a TX trigger workaround for AM33xx Sebastian Andrzej Siewior
2014-09-11 11:17   ` Heikki Krogerus
2014-09-11 11:42     ` Sebastian Andrzej Siewior
2014-09-11 12:32       ` Peter Hurley
2014-09-11 12:50         ` Sebastian Andrzej Siewior
2014-09-11 14:35           ` Peter Hurley
2014-09-15 17:01             ` Sebastian Andrzej Siewior
2014-09-16 16:55               ` Sebastian Andrzej Siewior
2014-09-17 12:20                 ` Peter Hurley
2014-09-17 16:25                   ` Sebastian Andrzej Siewior
2014-09-29 16:15                   ` Sebastian Andrzej Siewior
2014-09-11 15:11           ` Frans Klaver
2014-09-11 16:04             ` Sebastian Andrzej Siewior
2014-09-11 17:04               ` Frans Klaver
2014-09-12  7:23                 ` Sebastian Andrzej Siewior
     [not found]                   ` <20140912094010.GE28458@ci00147.xsens-tech.local>
2014-09-12  9:51                     ` Sebastian Andrzej Siewior
2014-09-12 10:28                       ` Frans Klaver
2014-09-15 16:42                         ` Sebastian Andrzej Siewior
2014-09-16  9:05                           ` Frans Klaver
2014-09-16 12:42                             ` Frans Klaver
2014-09-16 14:23                               ` Frans Klaver
2014-09-17 10:28                           ` Frans Klaver
2014-09-21 20:41                             ` Sebastian Andrzej Siewior
2014-09-22  9:28                               ` Frans Klaver
2014-09-24  7:56                                 ` Sebastian Andrzej Siewior
2014-09-25 15:14                                 ` Sebastian Andrzej Siewior
2014-09-25 15:18                                   ` Frans Klaver
2014-09-29  8:50                                   ` Frans Klaver
2014-09-29  9:54                                     ` Sebastian Andrzej Siewior
2014-09-29 10:30                                       ` Frans Klaver
2014-09-30  8:44                                         ` Frans Klaver
2014-10-02 10:27                                           ` Sebastian Andrzej Siewior
2014-10-13 14:55                                             ` Frans Klaver
2014-09-23 17:03                               ` Peter Hurley [this message]
2014-09-24  7:53                                 ` Sebastian Andrzej Siewior
2014-09-25 10:42                                   ` Sebastian Andrzej Siewior
2014-09-25 11:31                                     ` Peter Hurley
2014-09-25 13:11                                       ` Sebastian Andrzej Siewior
2014-09-17 16:34       ` Sebastian Andrzej Siewior
2014-09-19 10:22         ` Heikki Krogerus
2014-09-19 10:58           ` Sebastian Andrzej Siewior
2014-09-19 11:25             ` Peter Hurley
2014-09-22  7:46             ` Heikki Krogerus
2014-09-25  9:24               ` Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 10/16] tty: serial: 8250_dma: optimize the xmit path due to UART_BUG_DMA_TX Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 11/16] tty: serial: 8250_dma: keep own book keeping about RX transfers Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 12/16] tty: serial: 8250_dma: handle the UART RDI event while DMA remains idle Sebastian Andrzej Siewior
2014-09-29  9:23   ` Frans Klaver
2014-09-10 19:30 ` [PATCH 13/16] tty: serial: 8250_dma: add pm runtime Sebastian Andrzej Siewior
2014-09-29  9:26   ` Frans Klaver
2014-09-29  9:56     ` Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 14/16] arm: dts: am33xx: add DMA properties for UART Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 15/16] arm: dts: dra7: " Sebastian Andrzej Siewior
2014-09-10 19:30 ` [PATCH 16/16] tty: serial: 8250: omap: add dma support Sebastian Andrzej Siewior
2014-09-12 22:43 ` [PATCH 00/16 v9] omap 8250 based uart + DMA Tony Lindgren
2014-09-15 11:50   ` Sebastian Andrzej Siewior
2014-09-16 12:57     ` Sebastian Andrzej Siewior
2014-09-16 16:48       ` Tony Lindgren
2014-09-16 21:30         ` Tony Lindgren
2014-09-17  8:38           ` Sebastian Andrzej Siewior
2014-09-17  9:05 ` Sebastian Andrzej Siewior
2014-09-26 16:02   ` Greg KH

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=5421A7F7.3070109@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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

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
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

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.git