Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1667377

Re: [PATCH 3/3] printk/console: Always have a preferred console

From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] printk/console: Always have a preferred console
Date 2017-06-16 04:10 +0200
Message-ID <tSORX-28N-3@gated-at.bofh.it> (permalink)
References <tRTAl-859-5@gated-at.bofh.it> <tRTAm-859-23@gated-at.bofh.it> <tScCZ-3kg-7@gated-at.bofh.it> <tSEpz-3Kz-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On (06/15/17 16:54), Petr Mladek wrote:
> 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.

yeah, I grep-ed and didn't find anything that would depend
on CON_CONSDEV flag (except for printk), we check ->device
in critical places.

> 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.

good to know that, thanks.  s/CON_FIRST/CON_LAST/g  :)

> 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.

yep. seems so.

	-ss

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] printk/console: Simplify the logic and always have a preferred console Petr Mladek <pmladek@suse.com> - 2017-06-13 15:00 +0200
  [PATCH 2/3] printk/console: Clean up logic around fallback console Petr Mladek <pmladek@suse.com> - 2017-06-13 15:00 +0200
    Re: [PATCH 2/3] printk/console: Clean up logic around fallback  console Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-14 10:50 +0200
      Re: [PATCH 2/3] printk/console: Clean up logic around fallback  console Petr Mladek <pmladek@suse.com> - 2017-06-15 17:40 +0200
        Re: [PATCH 2/3] printk/console: Clean up logic around fallback  console Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-16 04:10 +0200
  [PATCH 3/3] printk/console: Always have a preferred console Petr Mladek <pmladek@suse.com> - 2017-06-13 15:00 +0200
    Re: [PATCH 3/3] printk/console: Always have a preferred console Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-14 11:20 +0200
      Re: [PATCH 3/3] printk/console: Always have a preferred console Petr Mladek <pmladek@suse.com> - 2017-06-15 17:00 +0200
        Re: [PATCH 3/3] printk/console: Always have a preferred console Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-16 04:10 +0200

csiph-web