mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Petr Mladek <pmladek@suse.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,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [PATCH 3/3] printk/console: Always have a preferred console
Date: Wed, 14 Jun 2017 18:11:28 +0900	[thread overview]
Message-ID: <20170614091128.GC3011@jagdpanzerIV.localdomain> (raw)
In-Reply-To: <1497358444-30736-4-git-send-email-pmladek@suse.com>

On (06/13/17 14:54), Petr Mladek wrote:
> More consoles can be registered but one might be special. It is the one
> with CON_CONSDEV flag set. It must be the first in the console_drivers
> list. It is also sometimes called as a preferred one.
> 
> It is the console that is associated with /dev/console. It is shown
> by "showconsole" binary. But if none of the consoles have CON_CONSDEV
> flag set, the state is unclear and "showconsole" is unable to find it:
> 
>      showconsole: real console unknown: Success
> 
> Documentation/admin-guide/serial-console.rst says that the preferred
> console is the last one on the command line. But there already exists
> some fallbacks.
> 
> First, there is a fallback code that tries to enable any boot
> console and one real console if no consoles are configured.
> This code always sets CON_CONSDEV if console setup succeeded.
> 
> Second, console_unregister() sets the flag CON_CONSDEV for the next
> console in the list when a console with this flag is being removed.
> 
> Now, the flag is not set if some consoles are configured and
> the preferred one is never registered from some reason.

haha, nice. that's exactly what I was talking about a moment ago.

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

> It might have side effects. The first registered console will be
> marked as preferred and kept first in the console_drivers list
> until the really preferred one is registered. This might change
> the order of consoles in console_drivers list. As a consequence,
> another console might be selected when the really preferred one
> is unregistered. But this should require some manual intervention.
> The order was never guarantied. Therefore it does not look
> worth the effort to keep the original order.

need to think more.

	-ss

> Signed-off-by: Petr Mladek <pmladek@suse.com>
> ---
>  kernel/printk/printk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 6e651f68bffd..76b1159f2004 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2483,7 +2483,7 @@ void register_console(struct console *newcon)
>  		}
>  
>  		newcon->flags |= CON_ENABLED;
> -		if (i == preferred_console)
> +		if (i == preferred_console || !console_drivers)
>  			newcon->flags |= CON_CONSDEV;
>  		break;
>  	}

  reply	other threads:[~2017-06-14  9:11 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 " 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 [this message]
2017-06-15 14:54     ` Petr Mladek
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=20170614091128.GC3011@jagdpanzerIV.localdomain \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aleksey.makarov@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sd@queasysnail.net \
    --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

all inboxes | Powered by JetHome®