public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: nerdopolis <bluescreen_avenger@verizon.net>
To: Willy Tarreau <w@1wt.eu>
Cc: linux-kernel@vger.kernel.org, Petr Mladek <pmladek@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	john.ogness@linutronix.de, senozhatsky@chromium.org,
	tglx@linutronix.de, tony@atomide.com
Subject: Re: VT-less kernels, and /dev/console on x86
Date: Tue, 15 Oct 2024 09:26:32 -0400	[thread overview]
Message-ID: <2006466.usQuhbGJ8B@nerdopolis2> (raw)
In-Reply-To: <ZuMkAiJz1YgdGpmJ@1wt.eu>

On Thursday, September 12, 2024 1:25:22 PM EDT Willy Tarreau wrote:
> On Thu, Sep 12, 2024 at 12:48:01PM -0400, nerdopolis wrote:
> > > > I still kind of lean to CONFIG_NULL_TTY_CONSOLE, that way if enabled, and in
> > > > theory, only distributions that had CONFIG_VT_CONSOLE turned on would turn on
> > > > this option. That could allow /dev/console will still work the same way for
> > > > user space logging, while disabling vgacon and fbcon.
> > > > 
> > > > And it could still be overridden by console=ttyS0, which I think is needed
> > > > anyway if you have CONFIG_VT_CONSOLE enabled
> > > 
> > > That sounds safer. And even then, I still don't understand why the application
> > > logging to /dev/console needs to block on it instead of just dropping whatever
> > > doesn't fit there since that's the primary intent of an optional logging
> > > console, i.e. emit events but without preventing regular operations. Maybe
> > > *this* is the thing that would require a setting: wait or drop.
> > > 
> > Sorry about the late reply, the application that is logging and dropping is
> > kind of unintentional I think. From how I understand it, systemd wants to
> > verify that /dev/console is actually /dev/console, so it calls isatty() on it.
> 
> OK.
> 
> > isatty() in turn calls the TCGETS ioctl on /dev/console, which when the console
> > device is actually /dev/ttyS0, and /dev/ttyS0 is unplugged, it the ioctl fails,
> > and isatty() returns false, and systemd assumes that it is not a serial device,
> > and in turn it doesn't log because of that.
> 
> I'm no tty expert at all, but on this machine I'm having this:
> 
>   # dmesg|grep console
>   [    0.000000] Kernel command line: boot_image=l0 console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait
>   [    1.638242] printk: console [ttyS0] disabled
>   [    2.848759] printk: console [ttyS0] enabled
>   [   12.950334] systemd[1]: Starting Set the console keyboard layout...
> 
>   # cat /proc/consoles 
>   ttyS0                -W- (EC p a)    4:64
> 
>   # strace -e trace=ioctl stty -a < /dev/console 
>   ioctl(0, TCGETS, {B115200 opost -isig -icanon -echo ...}) = 0
>   ioctl(1, TIOCGWINSZ, {ws_row=30, ws_col=152, ws_xpixel=1534, ws_ypixel=604}) = 0
>   ioctl(0, TIOCGWINSZ, {ws_row=24, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
>   speed 115200 baud; rows 24; columns 80; line = 0;
>   intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
>   werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
>   -parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
>   -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
>   opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
>   -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
>   +++ exited with 0 +++
> 
> So TCGETS succeeded above, and the console is unplugged. Even if I enable
> HW flow control (crtscts) the result is the same BTW (I preferred to check).
> Same if I enable carrier detection (-clocal).
> 
> So I'm unsure what would cause TCGETS to fail in your case.
> 
I am still kind of curious why TCGETS is succeeding in your case.
What is your /sys/devices/virtual/tty/console/active
and have you tried in a QEMU VM with -serial none ?
> Willy
> 





  parent reply	other threads:[~2024-10-15 13:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2669238.7s5MMGUR32.ref@nerdopolis2>
2024-08-18  0:09 ` VT-less kernels, and /dev/console on x86 nerdopolis
2024-08-18  1:07   ` Bagas Sanjaya
2024-08-18  2:31     ` nerdopolis
2024-08-18  5:12       ` Greg KH
2024-08-18 14:33         ` nerdopolis
2024-08-18  5:12   ` Greg KH
2024-08-18 12:33     ` nerdopolis
2024-08-18 14:30       ` nerdopolis
2024-08-19 15:09         ` Steven Rostedt
2024-08-19 15:50           ` nerdopolis
2024-08-20 13:29             ` Petr Mladek
2024-08-21 17:12               ` nerdopolis
2024-08-22 10:05                 ` Petr Mladek
2024-08-22 12:49                   ` nerdopolis
2024-08-27 12:53                     ` nerdopolis
2024-08-27 13:46                       ` Willy Tarreau
2024-09-12 16:48                         ` nerdopolis
2024-09-12 17:25                           ` Willy Tarreau
2024-09-12 18:46                             ` nerdopolis
2024-09-13  2:22                               ` nerdopolis
2024-09-17 12:54                               ` nerdopolis
2024-10-15 13:26                             ` nerdopolis [this message]
2024-09-12 12:29               ` nerdopolis
2024-09-12 13:27                 ` Petr Mladek
2024-10-09  9:24   ` Bernd Petrovitsch
2024-10-09 17:49     ` nerdopolis

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=2006466.usQuhbGJ8B@nerdopolis2 \
    --to=bluescreen_avenger@verizon.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    --cc=w@1wt.eu \
    /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