mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RESEND] printk: report boot console names during cut-over
@ 2013-09-20 15:34 Kees Cook
  2013-09-21 23:52 ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2013-09-20 15:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Joe Perches, Tejun Heo, Greg Kroah-Hartman,
	Frederic Weisbecker

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);
+			}
+		}
 	} else {
 		printk(KERN_INFO "%sconsole [%s%d] enabled\n",
 			(newcon->flags & CON_BOOT) ? "boot" : "" ,
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] printk: report boot console names during cut-over
  2013-09-20 15:34 [PATCH RESEND] printk: report boot console names during cut-over Kees Cook
@ 2013-09-21 23:52 ` Frederic Weisbecker
  2013-09-23 21:25   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2013-09-21 23:52 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, Andrew Morton, Joe Perches, Tejun Heo, Greg Kroah-Hartman

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] printk: report boot console names during cut-over
  2013-09-21 23:52 ` Frederic Weisbecker
@ 2013-09-23 21:25   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2013-09-23 21:25 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, Andrew Morton, Joe Perches, Tejun Heo, Greg Kroah-Hartman

On Sat, Sep 21, 2013 at 4:52 PM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 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.

Yeah, that's a much cleaner way to do this. I'll send a new patch. Thanks!

-Kees

-- 
Kees Cook
Chrome OS Security

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-23 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-20 15:34 [PATCH RESEND] printk: report boot console names during cut-over Kees Cook
2013-09-21 23:52 ` Frederic Weisbecker
2013-09-23 21:25   ` Kees Cook

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®