Skip to contentSkip to conversation

add ignore_loglevel boot option

PATCH In review Ingo Molnar 2 participants 3 messages Dec 5, 2006 – Dec 6, 2006 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add ignore_loglevel boot option

Subject: [patch] add ignore_loglevel boot option
From: Ingo Molnar <[email protected]>

sometimes the kernel prints something interesting while userspace bootup keeps messages turned off via loglevel. Enable the printing of /all/ kernel messages via the "ignore_loglevel" boot option. Off by default.

---
 Documentation/kernel-parameters.txt |    4 ++++
 kernel/printk.c                     |   14 +++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +4 -0
Index: linux/Documentation/kernel-parameters.txt
===================================================================
@@ -657,6 +657,10 @@ and is between 256 and 4096 characters. 
 	idle=		[HW]
 			Format: idle=poll or idle=halt
 
+	ignore_loglevel	[KNL]
+			Ignore loglevel setting - this will print /all/
+			kernel messages to the console. Useful for debugging.
+
 	ihash_entries=	[KNL]
 			Set number of hash buckets for inode cache.
 
kernel/printk.c +13 -1
Index: linux/kernel/printk.c
===================================================================
@@ -352,13 +352,25 @@ static void __call_console_drivers(unsig
 	touch_critical_timing();
 }
 
+static int __read_mostly ignore_loglevel;
+
+int __init ignore_loglevel_setup(char *str)
+{
+	ignore_loglevel = 1;
+	printk(KERN_INFO "debug: ignoring loglevel setting.\n");
+
+	return 1;
+}
+
+__setup("ignore_loglevel", ignore_loglevel_setup);
+
 /*
  * Write out chars from start to end - 1 inclusive
  */
 static void _call_console_drivers(unsigned long start,
 				unsigned long end, int msg_log_level)
 {
-	if (msg_log_level < console_loglevel &&
+	if ((msg_log_level < console_loglevel || ignore_loglevel) &&
 			console_drivers && start != end) {
 		if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) {
 			/* wrapped write */
#1 lore raw
Quoted 7 lines · On Tue, 5 Dec 2006 13:09:54 +0100 Ingo Molnar wrote:

Subject: [patch] add ignore_loglevel boot option
From: Ingo Molnar <[email protected]>

sometimes the kernel prints something interesting while userspace bootup keeps messages turned off via loglevel. Enable the printing of /all/ kernel messages via the "ignore_loglevel" boot option. Off by default.

Hi,

Is this equivalent to using the "debug" kernel parameter except that userspace (init scripts) cannot muck it up (modify the setting)?

I've seen init scripts modify the loglevel, much to my dismay.

I'd say that this is useful, but it's really userspace that needs to be fixed.

Quoted 28 lines
---
 Documentation/kernel-parameters.txt |    4 ++++
 kernel/printk.c                     |   14 +++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

Index: linux/kernel/printk.c
===================================================================

kernel/printk.c +12 -0
@@ -352,13 +352,25 @@ static void __call_console_drivers(unsig
 	touch_critical_timing();
 }
 
+static int __read_mostly ignore_loglevel;
+
+int __init ignore_loglevel_setup(char *str)
+{
+	ignore_loglevel = 1;
+	printk(KERN_INFO "debug: ignoring loglevel setting.\n");
+
+	return 1;
+}
+
+__setup("ignore_loglevel", ignore_loglevel_setup);
+
 /*
  * Write out chars from start to end - 1 inclusive

kernel/printk.c static void __call_console_drivers(unsig

Quoted 10 lines
kernel/printk.c +1 -2
  */
 static void _call_console_drivers(unsigned long start,
 				unsigned long end, int msg_log_level)
 {
-	if (msg_log_level < console_loglevel &&
+	if ((msg_log_level < console_loglevel || ignore_loglevel) &&
 			console_drivers && start != end) {
 		if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) {
 			/* wrapped write */
-

---
~Randy

#2 lore raw
Quoted 9 lines · Randy Dunlap
Quoted 4 lines

sometimes the kernel prints something interesting while userspace bootup keeps messages turned off via loglevel. Enable the printing of /all/ kernel messages via the "ignore_loglevel" boot option. Off by default.

Hi,

Is this equivalent to using the "debug" kernel parameter except that userspace (init scripts) cannot muck it up (modify the setting)?

yeah.

Quoted 1 line

I've seen init scripts modify the loglevel, much to my dismay.

yeah - i once lost a few hours of debugging to such an incident.

Quoted 2 lines

I'd say that this is useful, but it's really userspace that needs to be fixed.

well, loglevel /can/ be managed by userspace, and sometimes an important kernel message might have a too high loglevel. Also, sometimes the kernel does spurious messages during hardware detect, etc., so userspace naturally wants to prevent them from going to the console. So it's really a mix of a problem and i wouldnt put the blame on user-space. User-space used the only control they have to fix the situation.

Ingo