diff options
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 2d607f4d1797..19c0d7bcf24a 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -87,6 +87,12 @@ static DEFINE_SEMAPHORE(console_sem); | |||
87 | struct console *console_drivers; | 87 | struct console *console_drivers; |
88 | EXPORT_SYMBOL_GPL(console_drivers); | 88 | EXPORT_SYMBOL_GPL(console_drivers); |
89 | 89 | ||
90 | #ifdef CONFIG_LOCKDEP | ||
91 | static struct lockdep_map console_lock_dep_map = { | ||
92 | .name = "console_lock" | ||
93 | }; | ||
94 | #endif | ||
95 | |||
90 | /* | 96 | /* |
91 | * This is used for debugging the mess that is the VT code by | 97 | * This is used for debugging the mess that is the VT code by |
92 | * keeping track if we have the console semaphore held. It's | 98 | * keeping track if we have the console semaphore held. It's |
@@ -741,6 +747,21 @@ void __init setup_log_buf(int early) | |||
741 | free, (free * 100) / __LOG_BUF_LEN); | 747 | free, (free * 100) / __LOG_BUF_LEN); |
742 | } | 748 | } |
743 | 749 | ||
750 | static bool __read_mostly ignore_loglevel; | ||
751 | |||
752 | static int __init ignore_loglevel_setup(char *str) | ||
753 | { | ||
754 | ignore_loglevel = 1; | ||
755 | printk(KERN_INFO "debug: ignoring loglevel setting.\n"); | ||
756 | |||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | early_param("ignore_loglevel", ignore_loglevel_setup); | ||
761 | module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR); | ||
762 | MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to" | ||
763 | "print all kernel messages to the console."); | ||
764 | |||
744 | #ifdef CONFIG_BOOT_PRINTK_DELAY | 765 | #ifdef CONFIG_BOOT_PRINTK_DELAY |
745 | 766 | ||
746 | static int boot_delay; /* msecs delay after each printk during bootup */ | 767 | static int boot_delay; /* msecs delay after each printk during bootup */ |
@@ -764,13 +785,15 @@ static int __init boot_delay_setup(char *str) | |||
764 | } | 785 | } |
765 | __setup("boot_delay=", boot_delay_setup); | 786 | __setup("boot_delay=", boot_delay_setup); |
766 | 787 | ||
767 | static void boot_delay_msec(void) | 788 | static void boot_delay_msec(int level) |
768 | { | 789 | { |
769 | unsigned long long k; | 790 | unsigned long long k; |
770 | unsigned long timeout; | 791 | unsigned long timeout; |
771 | 792 | ||
772 | if (boot_delay == 0 || system_state != SYSTEM_BOOTING) | 793 | if ((boot_delay == 0 || system_state != SYSTEM_BOOTING) |
794 | || (level >= console_loglevel && !ignore_loglevel)) { | ||
773 | return; | 795 | return; |
796 | } | ||
774 | 797 | ||
775 | k = (unsigned long long)loops_per_msec * boot_delay; | 798 | k = (unsigned long long)loops_per_msec * boot_delay; |
776 | 799 | ||
@@ -789,7 +812,7 @@ static void boot_delay_msec(void) | |||
789 | } | 812 | } |
790 | } | 813 | } |
791 | #else | 814 | #else |
792 | static inline void boot_delay_msec(void) | 815 | static inline void boot_delay_msec(int level) |
793 | { | 816 | { |
794 | } | 817 | } |
795 | #endif | 818 | #endif |
@@ -1232,21 +1255,6 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) | |||
1232 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); | 1255 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); |
1233 | } | 1256 | } |
1234 | 1257 | ||
1235 | static bool __read_mostly ignore_loglevel; | ||
1236 | |||
1237 | static int __init ignore_loglevel_setup(char *str) | ||
1238 | { | ||
1239 | ignore_loglevel = 1; | ||
1240 | printk(KERN_INFO "debug: ignoring loglevel setting.\n"); | ||
1241 | |||
1242 | return 0; | ||
1243 | } | ||
1244 | |||
1245 | early_param("ignore_loglevel", ignore_loglevel_setup); | ||
1246 | module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR); | ||
1247 | MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to" | ||
1248 | "print all kernel messages to the console."); | ||
1249 | |||
1250 | /* | 1258 | /* |
1251 | * Call the console drivers, asking them to write out | 1259 | * Call the console drivers, asking them to write out |
1252 | * log_buf[start] to log_buf[end - 1]. | 1260 | * log_buf[start] to log_buf[end - 1]. |
@@ -1492,7 +1500,7 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1492 | int this_cpu; | 1500 | int this_cpu; |
1493 | int printed_len = 0; | 1501 | int printed_len = 0; |
1494 | 1502 | ||
1495 | boot_delay_msec(); | 1503 | boot_delay_msec(level); |
1496 | printk_delay(); | 1504 | printk_delay(); |
1497 | 1505 | ||
1498 | /* This stops the holder of console_sem just where we want him */ | 1506 | /* This stops the holder of console_sem just where we want him */ |
@@ -1908,12 +1916,14 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self, | |||
1908 | */ | 1916 | */ |
1909 | void console_lock(void) | 1917 | void console_lock(void) |
1910 | { | 1918 | { |
1911 | BUG_ON(in_interrupt()); | 1919 | might_sleep(); |
1920 | |||
1912 | down(&console_sem); | 1921 | down(&console_sem); |
1913 | if (console_suspended) | 1922 | if (console_suspended) |
1914 | return; | 1923 | return; |
1915 | console_locked = 1; | 1924 | console_locked = 1; |
1916 | console_may_schedule = 1; | 1925 | console_may_schedule = 1; |
1926 | mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_); | ||
1917 | } | 1927 | } |
1918 | EXPORT_SYMBOL(console_lock); | 1928 | EXPORT_SYMBOL(console_lock); |
1919 | 1929 | ||
@@ -1935,6 +1945,7 @@ int console_trylock(void) | |||
1935 | } | 1945 | } |
1936 | console_locked = 1; | 1946 | console_locked = 1; |
1937 | console_may_schedule = 0; | 1947 | console_may_schedule = 0; |
1948 | mutex_acquire(&console_lock_dep_map, 0, 1, _RET_IP_); | ||
1938 | return 1; | 1949 | return 1; |
1939 | } | 1950 | } |
1940 | EXPORT_SYMBOL(console_trylock); | 1951 | EXPORT_SYMBOL(console_trylock); |
@@ -2095,6 +2106,7 @@ skip: | |||
2095 | local_irq_restore(flags); | 2106 | local_irq_restore(flags); |
2096 | } | 2107 | } |
2097 | console_locked = 0; | 2108 | console_locked = 0; |
2109 | mutex_release(&console_lock_dep_map, 1, _RET_IP_); | ||
2098 | 2110 | ||
2099 | /* Release the exclusive_console once it is used */ | 2111 | /* Release the exclusive_console once it is used */ |
2100 | if (unlikely(exclusive_console)) | 2112 | if (unlikely(exclusive_console)) |