diff options
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 2d607f4d1797..22e070f3470a 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 |
@@ -1908,12 +1914,14 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self, | |||
1908 | */ | 1914 | */ |
1909 | void console_lock(void) | 1915 | void console_lock(void) |
1910 | { | 1916 | { |
1911 | BUG_ON(in_interrupt()); | 1917 | might_sleep(); |
1918 | |||
1912 | down(&console_sem); | 1919 | down(&console_sem); |
1913 | if (console_suspended) | 1920 | if (console_suspended) |
1914 | return; | 1921 | return; |
1915 | console_locked = 1; | 1922 | console_locked = 1; |
1916 | console_may_schedule = 1; | 1923 | console_may_schedule = 1; |
1924 | mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_); | ||
1917 | } | 1925 | } |
1918 | EXPORT_SYMBOL(console_lock); | 1926 | EXPORT_SYMBOL(console_lock); |
1919 | 1927 | ||
@@ -1935,6 +1943,7 @@ int console_trylock(void) | |||
1935 | } | 1943 | } |
1936 | console_locked = 1; | 1944 | console_locked = 1; |
1937 | console_may_schedule = 0; | 1945 | console_may_schedule = 0; |
1946 | mutex_acquire(&console_lock_dep_map, 0, 1, _RET_IP_); | ||
1938 | return 1; | 1947 | return 1; |
1939 | } | 1948 | } |
1940 | EXPORT_SYMBOL(console_trylock); | 1949 | EXPORT_SYMBOL(console_trylock); |
@@ -2095,6 +2104,7 @@ skip: | |||
2095 | local_irq_restore(flags); | 2104 | local_irq_restore(flags); |
2096 | } | 2105 | } |
2097 | console_locked = 0; | 2106 | console_locked = 0; |
2107 | mutex_release(&console_lock_dep_map, 1, _RET_IP_); | ||
2098 | 2108 | ||
2099 | /* Release the exclusive_console once it is used */ | 2109 | /* Release the exclusive_console once it is used */ |
2100 | if (unlikely(exclusive_console)) | 2110 | if (unlikely(exclusive_console)) |