Skip to contentSkip to conversation

console_loglevel broken on ia64 - please test and comment

PATCH New Jesper Juhl 1 participant 1 message Oct 17, 2001 PA-RISC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 console_loglevel broken on ia64 - please test and comment

This is an attempt to fix the broken console_loglevel in kernel/printk.c that Keith Owens reported to the list some hours ago.

Instead of the four different _loglevel variables it adds a console_printk array to hold the four values - that should be safe.

I have tested this as far as

a) it compiles
b) it boots
c) it has not exploded yet after more than an hour of use
d) "cat /proc/sys/kernel/printk" output looks sane both with and without the patch
e) changing console_loglevel with "ALT-Sysrq-<number>" works and is correctly reflected in /proc/sys/kernel/printk

Randy Dunlap was kind enough to take a look at the patch and thought it looked ok, so I'm now submitting it to a broader audience to get some more feedback before I try to send this off to Linux and/or Alan.

If nobody seems to screams at it too badly, then I'll make a version against -ac as well and send it off to Linus and Alan for them to look at and hopefully include in the next kernel.

The patch is against 2.4.13-pre3 and is attached as "2.4.13-pre3-console_loglevel.patch".

Best regards,
Jesper Juhl
[email protected]

arch/i386/mm/fault.c +0 -2
diff -ur linux-2.4.13-pre3-orig/arch/i386/mm/fault.c linux-2.4.13-pre3/arch/i386/mm/fault.c
@@ -27,8 +27,6 @@
 
 extern void die(const char *,struct pt_regs *,long);
 
-extern int console_loglevel;
-
 /*
  * Ugly, ugly, but the goto's result in better assembly..
  */
arch/parisc/kernel/traps.c +0 -1
diff -ur linux-2.4.13-pre3-orig/arch/parisc/kernel/traps.c linux-2.4.13-pre3/arch/parisc/kernel/traps.c
@@ -43,7 +43,6 @@
 
 static inline void console_verbose(void)
 {
-	extern int console_loglevel;
 	console_loglevel = 15;
 }
 
include/linux/kernel.h +7 -2
diff -ur linux-2.4.13-pre3-orig/include/linux/kernel.h linux-2.4.13-pre3/include/linux/kernel.h
@@ -36,6 +36,13 @@
 #define	KERN_INFO	"<6>"	/* informational			*/
 #define	KERN_DEBUG	"<7>"	/* debug-level messages			*/
 
+extern int console_printk[];
+
+#define console_loglevel (console_printk[0])
+#define default_message_loglevel (console_printk[1])
+#define minimum_console_loglevel (console_printk[2])
+#define default_console_loglevel (console_printk[3])
+
 # define NORET_TYPE    /**/
 # define ATTRIB_NORET  __attribute__((noreturn))
 # define NORET_AND     noreturn,
@@ -79,8 +86,6 @@
 
 asmlinkage int printk(const char * fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
-
-extern int console_loglevel;
 
 static inline void console_silent(void)
 {
kernel/printk.c +7 -5
diff -ur linux-2.4.13-pre3-orig/kernel/printk.c linux-2.4.13-pre3/kernel/printk.c
@@ -16,6 +16,7 @@
  *	01Mar01 Andrew Morton <[email protected]>
  */
 
+#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/tty.h>
 #include <linux/tty_driver.h>
@@ -39,11 +40,12 @@
 
 DECLARE_WAIT_QUEUE_HEAD(log_wait);
 
-/* Keep together for sysctl support */
-int console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
-int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL;
-int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL;
-int default_console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
+int console_printk[4] = {
+	DEFAULT_CONSOLE_LOGLEVEL,	/* console_loglevel */
+	DEFAULT_MESSAGE_LOGLEVEL,	/* default_message_loglevel */
+	MINIMUM_CONSOLE_LOGLEVEL,	/* minimum_console_loglevel */
+	DEFAULT_CONSOLE_LOGLEVEL,	/* default_console_loglevel */
+};
 
 int oops_in_progress;