From: Guenter Roeck <linux@roeck-us.net>
To: Guillermo Rodriguez Garcia <guille.rodriguez@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>,
linux-kernel@vger.kernel.org,
Alejandro Vazquez <avazquez.dev@gmail.com>,
sergey.senozhatsky@gmail.com, rostedt@goodmis.org,
shreyasjoshi15@gmail.com
Subject: Re: Change of behaviour when console=null and ttynull driver is used
Date: Wed, 22 Mar 2023 08:05:27 -0700 [thread overview]
Message-ID: <755a8541-adf5-4454-9bd5-9ea439a5a4ea@roeck-us.net> (raw)
In-Reply-To: <CABDcavYLQ63V81z5JiOxZ6hXMj=M+PQpfDLPk6AQynLGwuYTKQ@mail.gmail.com>
On Wed, Mar 22, 2023 at 09:33:32AM +0100, Guillermo Rodriguez Garcia wrote:
> Hi Petr,
>
> El vie, 17 mar 2023 a las 13:51, Petr Mladek (<pmladek@suse.com>) escribió:
> >
> > On Thu 2023-03-16 11:29:26, Guillermo Rodriguez Garcia wrote:
> > > Hi all,
> > >
> > > We have several embedded systems where pass console= or console=null
> > > in production to disable the console.
> > >
> > > Later we check for this in user space: in our inittab we check if fd0
> > > is "associated with a terminal" (test -t 0); if so, we are in
> > > development mode and we open a debug shell; otherwise (console
> > > disabled) we just start the application.
> > >
> > > Recently [1] this behaviour has changed and now if we pass console= or
> > > console=null, the new ttynull driver is used. This breaks the check we
> > > were doing (test -t 0 always true now).
> > >
> > > [1]: https://lore.kernel.org/lkml/X%2FcDG%2FxCCzSWW2cd@alley/t/
> >
> > This is actually exactly the problem that the change tried to solve.
> > Some systems failed to boot when there was no console and they tried
> > to write something at stdout.
>
> Well, I did not have any problem before this change.
>
> I understand that some systems had a problem (many others didn't, and
> setting console= or console=null has been standard practice for a long
> time). Since this change in behaviour could (and did) break things in
> user space, perhaps it should have been made opt-in...
>
> >
> > > Is there a way to get the previous behaviour? If not, is there an easy
> > > way for userspace to detect whether the console device is a "real" tty
> > > or ttynull (other than trying to parse the kernel boot args, which
> > > would be a bit fragile).
> >
> > A solution would be to check that /proc/consoles has ttynull as the
> > only registred console, for example:
> >
> > grep -q ttynull /proc/consoles && test `cat /proc/consoles | wc -l` -eq 1
> >
> > Would this work for you, please?
>
> I was trying to avoid something like this as it feels like userspace
> now needs to have too much knowledge of what the kernel is doing
> internally, however I guess this is the best option.
>
> The suggested check seems to work but now I am seeing a different
> (related?) issue: when I try to reboot from the console (using
> busybox's reboot command), the system reboots normally if I am using a
> "normal" console (e.g. console=ttyXXX), however when using
> console=ttynull, the command takes 20-25 seconds to complete. I am not
> sure why this would happen; if I understand correctly, for userspace
> ttynull is just like a regular tty driver, so why would there be a
> difference?
>
I think we may have seen something similar, causing us to revert the
upstream patches in ChromeOS. We did not try to find out what exactly
caused the problems.
Guenter
next prev parent reply other threads:[~2023-03-22 15:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 10:29 Guillermo Rodriguez Garcia
2023-03-16 13:40 ` Guenter Roeck
2023-03-22 8:23 ` Guillermo Rodriguez Garcia
2023-03-22 15:03 ` Guenter Roeck
2023-03-17 12:51 ` Petr Mladek
2023-03-22 8:33 ` Guillermo Rodriguez Garcia
2023-03-22 15:05 ` Guenter Roeck [this message]
2023-03-22 15:56 ` Guillermo Rodriguez Garcia
2023-03-24 15:08 ` Petr Mladek
2023-03-24 17:01 ` Guillermo Rodriguez Garcia
2023-03-26 23:20 ` Linus Torvalds
2023-03-27 3:38 ` Guenter Roeck
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=755a8541-adf5-4454-9bd5-9ea439a5a4ea@roeck-us.net \
--to=linux@roeck-us.net \
--cc=avazquez.dev@gmail.com \
--cc=guille.rodriguez@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=shreyasjoshi15@gmail.com \
/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
all inboxes | Powered by JetHome®