mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Joe Perches <joe@perches.com>, Tejun Heo <tj@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH RESEND] printk: report boot console names during cut-over
Date: Sat, 21 Sep 2013 18:52:26 -0500	[thread overview]
Message-ID: <20130921235217.GB12132@localhost.localdomain> (raw)
In-Reply-To: <20130920153400.GA32516@www.outflux.net>

On Fri, Sep 20, 2013 at 08:34:01AM -0700, Kees Cook wrote:
> This reports the names of boot consoles as they're being disabled to
> help identify which is which during cut-over. Helps answer the question
> "which boot console actually got activated?" once the regular console
> is running, mostly when debugging boot console failures.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  kernel/printk/printk.c |   16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index b4e8500..0dc54c9 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2361,14 +2361,18 @@ void register_console(struct console *newcon)
>  	if (bcon &&
>  	    ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV) &&
>  	    !keep_bootcon) {
> -		/* we need to iterate through twice, to make sure we print
> -		 * everything out, before we unregister the console(s)
> +		/* We need to iterate through all boot consoles, to make
> +		 * sure we print everything out, before we unregister them.
>  		 */
> -		printk(KERN_INFO "console [%s%d] enabled, bootconsole disabled\n",
> -			newcon->name, newcon->index);
> -		for_each_console(bcon)
> -			if (bcon->flags & CON_BOOT)
> +		for_each_console(bcon) {
> +			if (bcon->flags & CON_BOOT) {
> +				printk(KERN_INFO "console [%s%d] enabled, "
> +					"bootconsole [%s%d] disabled\n",
> +					newcon->name, newcon->index,
> +					bcon->name, bcon->index);
>  				unregister_console(bcon);

Looks useful! But I think the "console %foo disabled" message should move to unregister_console()
instead. That way it also handles printk_late_init() and all other console unregisters.

Thanks.

  reply	other threads:[~2013-09-21 23:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 15:34 Kees Cook
2013-09-21 23:52 ` Frederic Weisbecker [this message]
2013-09-23 21:25   ` Kees Cook

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=20130921235217.GB12132@localhost.localdomain \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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®