diff options
author | John Ogness <john.ogness@linutronix.de> | 2022-04-21 23:28:50 +0206 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2022-04-26 14:33:59 +0200 |
commit | ab406816fca009349b89cbde885daf68a8c77e33 (patch) | |
tree | 4728005e56587fa843d7b22975ba5cfce50eb011 /kernel/printk | |
parent | 8e274732115f63c1d09136284431b3555bd5cc56 (diff) |
printk: remove @console_locked
The static global variable @console_locked is used to help debug
VT code to make sure that certain code paths are running with
the console_lock held. However, this information is also available
with the static global variable @console_kthreads_blocked (for
locking via console_lock()), and the static global variable
@console_kthreads_active (for locking via console_trylock()).
Remove @console_locked and update is_console_locked() to use the
alternative variables.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220421212250.565456-16-john.ogness@linutronix.de
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 750d1229cc11..f66d6e72a642 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -340,15 +340,7 @@ static void console_kthreads_unblock(void) console_kthreads_blocked = false; } -/* - * This is used for debugging the mess that is the VT code by - * keeping track if we have the console semaphore held. It's - * definitely not the perfect debug tool (we don't know if _WE_ - * hold it and are racing, but it helps tracking those weird code - * paths in the console code where we end up in places I want - * locked without the console semaphore held). - */ -static int console_locked, console_suspended; +static int console_suspended; /* * Array of consoles built from command line options (console=) @@ -2719,7 +2711,6 @@ void console_lock(void) if (console_suspended) return; console_kthreads_block(); - console_locked = 1; console_may_schedule = 1; } EXPORT_SYMBOL(console_lock); @@ -2744,15 +2735,26 @@ int console_trylock(void) up_console_sem(); return 0; } - console_locked = 1; console_may_schedule = 0; return 1; } EXPORT_SYMBOL(console_trylock); +/* + * This is used to help to make sure that certain paths within the VT code are + * running with the console lock held. It is definitely not the perfect debug + * tool (it is not known if the VT code is the task holding the console lock), + * but it helps tracking those weird code paths in the console code such as + * when the console is suspended: where the console is not locked but no + * console printing may occur. + * + * Note: This returns true when the console is suspended but is not locked. + * This is intentional because the VT code must consider that situation + * the same as if the console was locked. + */ int is_console_locked(void) { - return (console_locked || atomic_read(&console_kthreads_active)); + return (console_kthreads_blocked || atomic_read(&console_kthreads_active)); } EXPORT_SYMBOL(is_console_locked); @@ -2808,8 +2810,6 @@ static inline bool console_is_usable(struct console *con) static void __console_unlock(void) { - console_locked = 0; - /* * Depending on whether console_lock() or console_trylock() was used, * appropriately allow the kthread printers to continue. @@ -3127,7 +3127,6 @@ void console_unblank(void) } else console_lock(); - console_locked = 1; console_may_schedule = 0; for_each_console(c) if ((c->flags & CON_ENABLED) && c->unblank) |