From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Aleksey Makarov <aleksey.makarov@linaro.org>,
Sabrina Dubroca <sd@queasysnail.net>,
Sudeep Holla <sudeep.holla@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] printk/console: Always have a preferred console
Date: Thu, 15 Jun 2017 16:54:43 +0200 [thread overview]
Message-ID: <20170615145443.GB23337@pathway.suse.cz> (raw)
In-Reply-To: <20170614091128.GC3011@jagdpanzerIV.localdomain>
On Wed 2017-06-14 18:11:28, Sergey Senozhatsky wrote:
> On (06/13/17 14:54), Petr Mladek wrote:
>
> > This patch modifies the code that enables the configured consoles.
> > It sets the CON_CONSDEV flag also when we register the first
> > console. It causes that one of the registered consoles will
> > always have CON_CONSDEV flag set.
>
> hm.... my impression was that we shouldn't set CON_CONSDEV if the
> console has no ->device. but then, once again, unregister_console()
> does not care and register_console() cares only in one place. so I'm
> a bit in doubt.
Great catch! It helped me to get even better picture.
If I get it correctly, the console driver for /dev/console is
found in tty_lookup_driver() by console_device(). Where
console_device() skips console drivers without any device.
CON_CONSDEV is basically handled only in register_console()
and unregister_console(). The driver with this flag is kept at
the beginning of the console_drivers list. It causes that
console_device() will return the console with this flag.
Also it is in sync with the commit cd3a1b8562d28490b33 ("printk: don't
prefer unsuited consoles on registration"). It added the check
for existing device into the fallback code in console_register()
so that console_device() might find a valid one.
BTW: The flag CON_CONSDEV first appeared in Linux 2.1.92.
It replaced CON_FIRST. Documentation/serial-console.txt
was modified so that the last console on the command line
will be used for /dev/console instead of the first one.
In each case, it seems that CON_CONSDEV is closely related
to an existing device and does not make much sense without it.
Heh, the handling in unregister_console() looks buggy. Well,
it probably does not break anything. The function does not change
the order of drivers and console_device() searches
the entire list until it finds a console with device.
Anyway, it would make sense to clean it as well.
Thanks a lot for review.
Best Regards,
Petr
next prev parent reply other threads:[~2017-06-15 14:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 12:54 [PATCH 0/3] printk/console: Simplify the logic and always have a preferred console Petr Mladek
2017-06-13 12:54 ` [PATCH 1/3] printk/console: Remove superfluous setting of has_preferred state value Petr Mladek
2017-06-14 7:41 ` Sergey Senozhatsky
2017-06-13 12:54 ` [PATCH 2/3] printk/console: Clean up logic around fallback console Petr Mladek
2017-06-14 8:38 ` Sergey Senozhatsky
2017-06-15 15:31 ` Petr Mladek
2017-06-16 2:02 ` Sergey Senozhatsky
2017-06-13 12:54 ` [PATCH 3/3] printk/console: Always have a preferred console Petr Mladek
2017-06-14 9:11 ` Sergey Senozhatsky
2017-06-15 14:54 ` Petr Mladek [this message]
2017-06-16 2:00 ` Sergey Senozhatsky
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=20170615145443.GB23337@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=aleksey.makarov@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sd@queasysnail.net \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=sudeep.holla@arm.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