From: tip-bot for Robin Getz <rgetz@blackfin.uclinux.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
rgetz@blackfin.uclinux.org, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:core/printk] printk: Ensure that "console enabled" messages are printed on the console
Date: Fri, 10 Jul 2009 10:43:11 GMT [thread overview]
Message-ID: <tip-8259cf4342029aad37660e524178c8858f48b0ab@git.kernel.org> (raw)
In-Reply-To: <200907091308.37370.rgetz@blackfin.uclinux.org>
Commit-ID: 8259cf4342029aad37660e524178c8858f48b0ab
Gitweb: http://git.kernel.org/tip/8259cf4342029aad37660e524178c8858f48b0ab
Author: Robin Getz <rgetz@blackfin.uclinux.org>
AuthorDate: Thu, 9 Jul 2009 13:08:37 -0400
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Jul 2009 12:24:47 +0200
printk: Ensure that "console enabled" messages are printed on the console
Today, when a console is registered without CON_PRINTBUFFER,
end users never see the announcement of it being added, and
never know if they missed something, if the console is really
at the start or not, and just leads to general confusion.
This re-orders existing code, to make sure the console is
added, before the "console [%s%d] enabled" is printed out -
ensuring that this message is _always_ seen.
This has the desired/intended side effect of making sure that
"console enabled:" messages are printed on the bootconsole, and
the real console. This does cause the same line is printed
twice if the bootconsole and real console are the same device,
but if they are on different devices, the message is printed to
both consoles.
Signed-off-by : Robin Getz <rgetz@blackfin.uclinux.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>
LKML-Reference: <200907091308.37370.rgetz@blackfin.uclinux.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/printk.c | 44 +++++++++++++++++++++++++++++---------------
1 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/kernel/printk.c b/kernel/printk.c
index 41fe609..668df35 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1240,22 +1240,14 @@ void register_console(struct console *newcon)
if (!(newcon->flags & CON_ENABLED))
return;
- if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) {
- /* we need to iterate through twice, to make sure we print
- * everything out, before we unregister the console(s)
- */
- printk(KERN_INFO "console handover:");
- for_each_console(bcon)
- printk("boot [%s%d] ", bcon->name, bcon->index);
- printk(" -> real [%s%d]\n", newcon->name, newcon->index);
- for_each_console(bcon)
- unregister_console(bcon);
+ /*
+ * If we have a bootconsole, and are switching to a real console,
+ * don't print everything out again, since when the boot console, and
+ * the real console are the same physical device, it's annoying to
+ * see the beginning boot messages twice
+ */
+ if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV))
newcon->flags &= ~CON_PRINTBUFFER;
- } else {
- printk(KERN_INFO "%sconsole [%s%d] enabled\n",
- (newcon->flags & CON_BOOT) ? "boot" : "" ,
- newcon->name, newcon->index);
- }
/*
* Put this console in the list - keep the
@@ -1281,6 +1273,28 @@ void register_console(struct console *newcon)
spin_unlock_irqrestore(&logbuf_lock, flags);
}
release_console_sem();
+
+ /*
+ * By unregistering the bootconsoles after we enable the real console
+ * we get the "console xxx enabled" message on all the consoles -
+ * boot consoles, real consoles, etc - this is to ensure that end
+ * users know there might be something in the kernel's log buffer that
+ * went to the bootconsole (that they do not see on the real console)
+ */
+ if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) {
+ /* we need to iterate through twice, to make sure we print
+ * everything out, before we unregister the console(s)
+ */
+ printk(KERN_INFO "console [%s%d] enabled, bootconsole disabled\n",
+ newcon->name, newcon->index);
+ for_each_console(bcon)
+ if (bcon->flags & CON_BOOT)
+ unregister_console(bcon);
+ } else {
+ printk(KERN_INFO "%sconsole [%s%d] enabled\n",
+ (newcon->flags & CON_BOOT) ? "boot" : "" ,
+ newcon->name, newcon->index);
+ }
}
EXPORT_SYMBOL(register_console);
prev parent reply other threads:[~2009-07-10 10:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-04 4:17 Boot Consoles question Robin Getz
2009-07-04 10:29 ` Ingo Molnar
2009-07-04 16:07 ` Robin Getz
2009-07-07 23:49 ` Robin Getz
2009-07-10 10:28 ` Ingo Molnar
2009-07-10 14:28 ` Robin Getz
2009-07-10 16:08 ` Ingo Molnar
2009-07-09 17:08 ` [PATCH] kernel.printk.c - ensure that "console enabled" messages are printed on the console Robin Getz
2009-07-10 10:25 ` Ingo Molnar
2009-07-10 14:13 ` [PATCH] kernel.printk.c - ensure that "console enabled"messages " Robin Getz
2009-07-10 14:16 ` Ingo Molnar
2009-07-10 14:26 ` Mike Frysinger
2009-07-18 0:48 ` [PATCH] kernel.printk.c - ensure that "console enabled" messages " Andrew Morton
2009-07-20 5:29 ` Stephen Rothwell
2009-07-10 10:43 ` tip-bot for Robin Getz [this message]
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=tip-8259cf4342029aad37660e524178c8858f48b0ab@git.kernel.org \
--to=rgetz@blackfin.uclinux.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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