summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/8250/8250_of.c
diff options
context:
space:
mode:
authorDarwin Dingel <darwin.dingel@alliedtelesis.co.nz>2018-12-10 11:29:09 +1300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 15:37:26 +0100
commit6f8c923839721a9ea266230d99e2b9452efdf434 (patch)
tree7a519767e51f7a66a0280819a9ca7e3caf73c40c /drivers/tty/serial/8250/8250_of.c
parentab8f3d980d5df972d577dbf1287de029187dbee2 (diff)
serial: 8250: Rate limit serial port rx interrupts during input overruns
[ Upstream commit 6d7f677a2afa1c82d7fc7af7f9159cbffd5dc010 ] When a serial port gets faulty or gets flooded with inputs, its interrupt handler starts to work double time to get the characters to the workqueue for the tty layer to handle them. When this busy time on the serial/tty subsystem happens during boot, where it is also busy on the userspace trying to initialise, some processes can continuously get preempted and will be on hold until the interrupts subside. The fix is to backoff on processing received characters for a specified amount of time when an input overrun is seen (received a new character before the previous one is processed). This only stops receive and will continue to transmit characters to serial port. After the backoff period is done, it receive will be re-enabled. This is optional and will only be enabled by setting 'overrun-throttle-ms' in the dts. Signed-off-by: Darwin Dingel <darwin.dingel@alliedtelesis.co.nz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/tty/serial/8250/8250_of.c')
-rw-r--r--drivers/tty/serial/8250/8250_of.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index ec510e342e06..c51044ba503c 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -232,6 +232,11 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
if (of_property_read_bool(ofdev->dev.of_node, "auto-flow-control"))
port8250.capabilities |= UART_CAP_AFE;
+ if (of_property_read_u32(ofdev->dev.of_node,
+ "overrun-throttle-ms",
+ &port8250.overrun_backoff_time_ms) != 0)
+ port8250.overrun_backoff_time_ms = 0;
+
ret = serial8250_register_8250_port(&port8250);
if (ret < 0)
goto err_dispose;