From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/3] minitty: a minimal TTY layer alternative for embedded systems
Date: Fri, 24 Mar 2017 07:50:15 +0100 [thread overview]
Message-ID: <20170324065015.GA17226@kroah.com> (raw)
In-Reply-To: <20170323210304.2181-1-nicolas.pitre@linaro.org>
meta-comment, any reason you didn't cc: linux-serial at vger as well?
On Thu, Mar 23, 2017 at 05:03:01PM -0400, Nicolas Pitre wrote:
> Many embedded systems don't need the full TTY layer support. Most of the
> time, the TTY layer is only a conduit for outputting debugging messages
> over a serial port. The TTY layer also implements many features that are
> very unlikely to ever be used in such a setup. There is great potential
> for both code and dynamic memory size reduction on small systems. This is
> what this patch series is achieving.
>
> The existing TTY code is quite large and complex. Trying to shrink it is
> rather risky as the potential for breakage is non negligeable. Therefore,
> the approach used here consists in the creation of the minimal code that
> interface with the existing UART drivers and provide TTY-like character
> devices to user space. When the regular TTY layer is disabled, then the
> minitty layer replacement is proposed by Kconfig.
>
> Of course, making it "mini" means there are limitations to what it does:
>
> - This supports serial ports only. No VT's, no PTY's.
>
> - The default n_tty line discipline is hardcoded and no other line
> discipline are supported.
>
> - The line discipline features are not all implemented. Notably, XON/XOFF
> is currently not implemented (although this might not require a lot of
> code to do it).
>
> - Hung-up state is not implemented.
>
> - No error handling on RX bytes other than counting them.
>
> - Behavior in the presence of overflows is most likely different from the
> full TTY code.
>
> - Job control is currently not supported (this may change in the future and
> be configurable).
>
> But again, most small embedded systems simply don't need those things.
This is true, and I like the overall idea, but I don't like all of the
code duplication. Also, who is going to maintain this? I'm not going
to be able to even build it, let alone test it, for the systems I
normally use, and now you have tagged me as maintaining it for forever
:(
> Here's some numbers using a minimal ARM config.
>
> When CONFIG_TTY=y, the following files are linked into the kernel:
>
> text data bss dec hex filename
> 8796 128 0 8924 22dc drivers/tty/n_tty.o
> 12846 276 44 13166 336e drivers/tty/serial/serial_core.o
> 4852 489 49 5390 150e drivers/tty/sysrq.o
> 1376 0 0 1376 560 drivers/tty/tty_buffer.o
> 13571 172 132 13875 3633 drivers/tty/tty_io.o
> 3072 0 0 3072 c00 drivers/tty/tty_ioctl.o
> 2457 2 120 2579 a13 drivers/tty/tty_ldisc.o
> 1328 0 0 1328 530 drivers/tty/tty_ldsem.o
> 316 0 0 316 13c drivers/tty/tty_mutex.o
> 2516 0 0 2516 9d4 drivers/tty/tty_port.o
> 51130 1067 345 52542 cd3e (TOTALS)
>
> With CONFIG_TTY=n and CONFIG_MINITTY_SERIAL=y, the above is replaced by:
>
> text data bss dec hex filename
> 8776 8 108 8892 22bc drivers/tty/serial/minitty_serial.o
>
> That's it! And the runtime buffer usage is much less as well.
Is there some way to just reorginize the existing code to get you almost
this same size? Make ptys and other line diciplines options to select,
and slim down the io path by removing features there.
And that serial core looks huge from what you are showing is really
needed, any way to slim that down by just making features in it
configurable?
Again, I like the idea, but worry that with this change, we would have
two different tty layers we have to maintain for the next 20+ years, and
we have a hard time keeping one stable and working today :)
thanks,
greg k-h
next prev parent reply other threads:[~2017-03-24 6:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 21:03 [PATCH 0/3] minitty: a minimal TTY layer alternative for embedded systems Nicolas Pitre
2017-03-23 21:03 ` [PATCH 1/3] console: move console_init() out of tty_io.c Nicolas Pitre
2017-03-23 21:03 ` [PATCH 2/3] tty: move baudrate handling code to a file of its own Nicolas Pitre
2017-03-23 21:03 ` [PATCH 3/3] minitty: minimal TTY support replacement for serial ports Nicolas Pitre
2017-03-24 3:50 ` [PATCH 0/3] minitty: a minimal TTY layer alternative for embedded systems Baruch Siach
2017-03-24 12:18 ` Nicolas Pitre
2017-03-24 6:50 ` Greg Kroah-Hartman [this message]
2017-03-24 12:31 ` Nicolas Pitre
2017-03-24 13:53 ` Greg Kroah-Hartman
2017-03-24 17:49 ` Nicolas Pitre
2017-03-24 20:46 ` Ard Biesheuvel
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=20170324065015.GA17226@kroah.com \
--to=gregkh@linuxfoundation.org \
--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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).