All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: msm_serial: Deactivate RX DMA for polling support
@ 2021-11-13 12:10 Sven Eckelmann
  0 siblings, 0 replies; only message in thread
From: Sven Eckelmann @ 2021-11-13 12:10 UTC (permalink / raw)
  To: linux-arm-msm; +Cc: linux-serial, Sven Eckelmann, stable

The CONSOLE_POLLING mode is used for tools like k(g)db. In this kind of
setup, it is often sharing a serial device with the normal system console.
This is usually no problem because the polling helpers can consume input
values directly (when in kgdb context) and the normal Linux handlers can
only consume new input values after kgdb switched back.

This is not true anymore when RX DMA is enabled for UARTDM controllers.
Single input values can no longer be received correctly. Instead following
seems to happen:

* on 1. input, some old input is read (continuously)
* on 2. input, two old inputs are read (continuously)
* on 3. input, three old input values are read (continuously)
* on 4. input, 4 previous inputs are received

This repeats then for each group of 4 input values.

This behavior changes slightly depending on what state the controller was
when the first input was received. But this makes working with kgdb
basically impossible because control messages are always corrupted when
kgdboc tries to parse them.

RX DMA should therefore be off when CONSOLE_POLLING is enabled to avoid
these kind of problems. No such problem was noticed for TX DMA.

Cc: stable@vger.kernel.org
Fixes: 99693945013a ("tty: serial: msm: Add RX DMA support")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
I've already described this problem in a mail two weeks ago
https://lore.kernel.org/all/4119639.d4o71su6xY@sven-desktop/

There was no feedback so I would like to propose the minimal version which
was described in that mail.
---
 drivers/tty/serial/msm_serial.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index fcef7a961430..489d19274f9a 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -598,6 +598,9 @@ static void msm_start_rx_dma(struct msm_port *msm_port)
 	u32 val;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_CONSOLE_POLL))
+		return;
+
 	if (!dma->chan)
 		return;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-13 12:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 12:10 [PATCH] tty: serial: msm_serial: Deactivate RX DMA for polling support Sven Eckelmann

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.