aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/printk.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 2d607f4d1797..ee79f14db358 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -87,6 +87,12 @@ static DEFINE_SEMAPHORE(console_sem);
87struct console *console_drivers; 87struct console *console_drivers;
88EXPORT_SYMBOL_GPL(console_drivers); 88EXPORT_SYMBOL_GPL(console_drivers);
89 89
90#ifdef CONFIG_LOCKDEP
91static 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
@@ -1914,6 +1920,7 @@ void console_lock(void)
1914 return; 1920 return;
1915 console_locked = 1; 1921 console_locked = 1;
1916 console_may_schedule = 1; 1922 console_may_schedule = 1;
1923 mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_);
1917} 1924}
1918EXPORT_SYMBOL(console_lock); 1925EXPORT_SYMBOL(console_lock);
1919 1926
@@ -1935,6 +1942,7 @@ int console_trylock(void)
1935 } 1942 }
1936 console_locked = 1; 1943 console_locked = 1;
1937 console_may_schedule = 0; 1944 console_may_schedule = 0;
1945 mutex_acquire(&console_lock_dep_map, 0, 1, _RET_IP_);
1938 return 1; 1946 return 1;
1939} 1947}
1940EXPORT_SYMBOL(console_trylock); 1948EXPORT_SYMBOL(console_trylock);
@@ -2095,6 +2103,7 @@ skip:
2095 local_irq_restore(flags); 2103 local_irq_restore(flags);
2096 } 2104 }
2097 console_locked = 0; 2105 console_locked = 0;
2106 mutex_release(&console_lock_dep_map, 1, _RET_IP_);
2098 2107
2099 /* Release the exclusive_console once it is used */ 2108 /* Release the exclusive_console once it is used */
2100 if (unlikely(exclusive_console)) 2109 if (unlikely(exclusive_console))