summaryrefslogtreecommitdiff
path: root/kernel/printk
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2018-07-31 13:06:57 +0200
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2018-07-31 13:06:57 +0200
commit56e6c104e4f151e19eb410004405ec52b4f8605a (patch)
treeae7567c188e3306e7cc02bcd6db5f9025edef48b /kernel/printk
parentcb782a3fa952478177341e67275885ae52340f99 (diff)
downloadlwn-56e6c104e4f151e19eb410004405ec52b4f8605a.tar.gz
lwn-56e6c104e4f151e19eb410004405ec52b4f8605a.zip
console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters the console's critical section without having acquired the console lock. The console lock can be ignored when debugging the console using printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary warnings. The variable ignore_console_lock_warning temporarily disables WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's critical sections should increment it before entering the CS and decrement it after leaving the CS. Setting ignore_console_lock_warning is only for debugging. Regular operation should not manipulate it. Acknoledgements: This patch is based on an earlier version by Steven Rostedt. The use of atomic increment/decrement was suggested by Petr Mladek. Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Andrew Morton <akpm@linux-foundation.org> [b.zolnierkie: use <linux/atomic.h>] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Diffstat (limited to 'kernel/printk')
-rw-r--r--kernel/printk/printk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 3f041e7cbfc9..7d32a86758cd 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -66,6 +66,9 @@ int console_printk[4] = {
CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */
};
+atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
+EXPORT_SYMBOL(ignore_console_lock_warning);
+
/*
* Low level drivers may need that to know if they can schedule in
* their unblank() callback or not. So let's export it.