[Devel] [PATCH RH9] vtty: update termios settings and fix hung
Cyrill Gorcunov
gorcunov at gmail.com
Tue Oct 12 10:50:44 MSK 2021
From: Cyrill Gorunov <gorcunov at virtuozzo.com>
Here are some things left to be updated while moving to a new kernel:
- setup default limit for ports up to 8192 bytes just like it done
for regular unix PTY driver
- report exactly how many bytes left available in the peer buffer
(actually I don't remember where this 2K constant came from, maybe
from early console or systemd specific in some old version we will
figure out drawbacks once deep testing get started)
- update termios settings to match unix PTY
- drop chars_in_buffer operation since it is just makes a loop eating
100% cpu upon start, seems like been occasionally sneaked in from
previous kernels
https://jira.sw.ru/browse/PSBM-134658
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
Index: vzkernel/drivers/tty/pty.c
===================================================================
--- vzkernel.orig/drivers/tty/pty.c
+++ vzkernel/drivers/tty/pty.c
@@ -765,6 +765,7 @@ static void vtty_standard_install(struct
tty_driver_kref_get(driver);
tty_port_init(tty->port);
+ tty_buffer_set_limit(tty->port, 8192);
tty->port->itty = tty;
}
@@ -880,14 +881,10 @@ static int vtty_write(struct tty_struct
static unsigned int vtty_write_room(struct tty_struct *tty)
{
struct tty_struct *peer = tty->link;
- int count = (tty->driver == vttym_driver) ? 2 : 1;
if (tty->flow.stopped)
return 0;
- if (peer->count < count)
- return 2048;
-
return tty_buffer_space_avail(peer->port);
}
@@ -911,7 +908,6 @@ static const struct tty_operations vtty_
.cleanup = pty_cleanup,
.write = vtty_write,
.write_room = vtty_write_room,
- .chars_in_buffer= tty_chars_in_buffer,
.set_termios = pty_set_termios,
.unthrottle = pty_unthrottle,
.flush_buffer = pty_flush_buffer,
@@ -998,6 +994,8 @@ static int __init vtty_init(void)
/* 38400 boud rate, 8 bit char size, enable receiver */
vttym_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
vttym_driver->init_termios.c_lflag = 0;
+ vttym_driver->init_termios.c_ispeed = 38400;
+ vttym_driver->init_termios.c_ospeed = 38400;
tty_set_operations(vttym_driver, &vtty_ops);
vttys_driver->driver_name = "vtty_slave";
@@ -1009,6 +1007,8 @@ static int __init vtty_init(void)
vttys_driver->subtype = PTY_TYPE_SLAVE;
vttys_driver->init_termios = tty_std_termios;
vttys_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
+ vttys_driver->init_termios.c_ispeed = 38400;
+ vttys_driver->init_termios.c_ospeed = 38400;
tty_set_operations(vttys_driver, &vtty_ops);
if (tty_register_driver(vttym_driver))
More information about the Devel
mailing list