From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Frédéric Weisbecker" <fweisbec@gmail.com>,
"Li Zefan" <lizf@cn.fujitsu.com>,
"Arjan van de Ven" <arjan@infradead.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Alan Cox" <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] WARN(): add a \n to the message printk
Date: Mon, 15 Jun 2009 21:16:57 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0906152114070.3282@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.01.0906152055580.3282@localhost.localdomain>
On Mon, 15 Jun 2009, Linus Torvalds wrote:
>
> And no, this does not necessarily fix Arjan's problem: it only adds the
> newline before printk's that _do_ have a KERN_<lvl> format. So now, in
> order to get the extra '\n' after the WARN_ON() line, somebody needs to
> make sure that the printk's in the warning printing have loglevels.
>
> Arjan?
The "print_modules()" function needs a KERN_WARNING in front of it.
Or something like this (on top of the patch I just sent out), which allows
you to specify loglevel that is just the default one, whatever that
happens to be. Using KERN_DEFAULT, of course.
Hmm?
Linus
---
include/linux/kernel.h | 2 ++
kernel/module.c | 2 +-
kernel/printk.c | 2 ++
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 066bb1e..1b2e174 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -97,6 +97,8 @@ extern const char linux_proc_banner[];
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
+/* Use the default kernel loglevel */
+#define KERN_DEFAULT "<d>"
/*
* Annotation for a "continued" line of log printout (only done after a
* line that had no enclosing \n). Only to be used by core/arch code
diff --git a/kernel/module.c b/kernel/module.c
index e4ab36c..215aaab 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2899,7 +2899,7 @@ void print_modules(void)
struct module *mod;
char buf[8];
- printk("Modules linked in:");
+ printk(KERN_DEFAULT "Modules linked in:");
/* Most callers should already have preempt disabled, but make sure */
preempt_disable();
list_for_each_entry_rcu(mod, &modules, list)
diff --git a/kernel/printk.c b/kernel/printk.c
index a87770c..b4d97b5 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -696,6 +696,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
switch (c) {
case '0' ... '7': /* loglevel */
current_log_level = c - '0';
+ /* Fallthrough - make sure we're on a new line */
+ case 'd': /* KERN_DEFAULT */
if (!new_text_line) {
emit_log_char('\n');
new_text_line = 1;
next prev parent reply other threads:[~2009-06-16 4:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 7:08 Arjan van de Ven
2009-06-15 9:09 ` Alan Cox
2009-06-15 14:13 ` Arjan van de Ven
2009-06-15 16:38 ` Linus Torvalds
2009-06-15 16:58 ` Linus Torvalds
2009-06-15 17:10 ` Ingo Molnar
2009-06-16 4:04 ` Linus Torvalds
2009-06-16 4:16 ` Linus Torvalds [this message]
2009-06-16 5:46 ` Arjan van de Ven
2009-06-15 17:57 ` Linus Torvalds
2009-06-15 18:39 ` Ingo Molnar
2009-06-15 18:53 ` Frederic Weisbecker
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=alpine.LFD.2.01.0906152114070.3282@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjan@infradead.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
/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
Powered by JetHome