public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Yinghai Lu <yhlu.kernel@gmail.com>
Subject: [PATCH] introduce boot_printk()
Date: Mon, 15 Sep 2008 01:05:16 -0700	[thread overview]
Message-ID: <1221465916-30889-1-git-send-email-yhlu.kernel@gmail.com> (raw)

could be enabled via "boot=verbose" to get more debug info

will use it to convert some printk(KERN_DEBUG ...)

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 include/linux/kernel.h |   19 +++++++++++++++++++
 kernel/printk.c        |   21 +++++++++++++++++++++
 2 files changed, 40 insertions(+)

Index: linux-2.6/include/linux/kernel.h
===================================================================
--- linux-2.6.orig/include/linux/kernel.h
+++ linux-2.6/include/linux/kernel.h
@@ -344,6 +344,25 @@ static inline char *pack_hex_byte(char *
 #endif
 
 /*
+ * Debugging macros
+ */
+#define BOOT_QUIET   0
+#define BOOT_VERBOSE 1
+#define BOOT_SPEW    2
+
+extern int boot_verbosity;
+/*
+ * Define the default level of output to be very little
+ * This can be turned up by using boot=verbose for more
+ * information and boot=spew for _lots_ of information.
+ * boot_verbosity is defined in printk.c
+ */
+#define boot_printk(v, s, a...) do {        \
+		if ((v) <= boot_verbosity)  \
+			printk(s, ##a);    \
+	} while (0)
+
+/*
  *      Display an IP address in readable format.
  */
 
Index: linux-2.6/kernel/printk.c
===================================================================
--- linux-2.6.orig/kernel/printk.c
+++ linux-2.6/kernel/printk.c
@@ -604,6 +604,27 @@ asmlinkage int printk(const char *fmt, .
 	return r;
 }
 
+int boot_verbosity;
+
+static int __init boot_set_verbosity(char *arg)
+{
+	if (!arg)
+		return -EINVAL;
+
+	if (strcmp("spew", arg) == 0)
+		boot_verbosity = BOOT_SPEW;
+	else if (strcmp("verbose", arg) == 0)
+		boot_verbosity = BOOT_VERBOSE;
+	else {
+		printk(KERN_WARNING "boot Verbosity level %s not recognised"
+			" use boot=verbose or boot=spew\n", arg);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+early_param("boot", boot_set_verbosity);
+
 /* cpu currently holding logbuf_lock */
 static volatile unsigned int printk_cpu = UINT_MAX;
 

             reply	other threads:[~2008-09-15  8:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-15  8:05 Yinghai Lu [this message]
2008-09-15  9:58 ` [PATCH] introduce boot_printk() Pavel Machek
2008-09-15 16:14   ` Yinghai Lu
2008-09-15 14:54 ` Randy Dunlap
2008-09-15 17:15 ` H. Peter Anvin
2008-09-15 17:18   ` Yinghai Lu
2008-09-15 17:24     ` H. Peter Anvin
2008-09-15 17:34       ` Yinghai Lu
2008-09-16 14:26         ` Peter Zijlstra
2008-09-16 16:06           ` H. Peter Anvin
2008-09-16 16:42             ` Yinghai Lu
2008-09-16 17:44               ` Jeremy Fitzhardinge
2008-09-16 17:45             ` Yinghai Lu
2008-09-16 17:47               ` Yinghai Lu
2008-09-16 17:53               ` H. Peter Anvin
2008-09-16 18:10                 ` Yinghai Lu
2008-09-16 18:15                   ` H. Peter Anvin
2008-09-16 18:24                     ` Yinghai Lu
2008-09-16 18:31                       ` H. Peter Anvin
2008-09-16 18:37                         ` Yinghai Lu
2008-09-16 18:53                           ` H. Peter Anvin
2008-09-16 19:24                             ` Yinghai Lu

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=1221465916-30889-1-git-send-email-yhlu.kernel@gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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