]> asedeno.scripts.mit.edu Git - linux.git/commit
printk: make sure to print log on console.
authorManinder Singh <maninder1.s@samsung.com>
Fri, 1 Jun 2018 08:56:42 +0000 (14:26 +0530)
committerPetr Mladek <pmladek@suse.com>
Wed, 27 Jun 2018 14:14:28 +0000 (16:14 +0200)
commit375899cddcbb26881b03cb3fbdcfd600e4e67f4a
treeb70cc79ff4ae2c25bc1e1fec4c09f967133e26ee
parentce041c43f22298485122bab15c14d062383fbc67
printk: make sure to print log on console.

This patch make sure printing of log on console if loglevel
at time of storing log is less than current console loglevel.

@why
In SMP printk can work asynchronously, logs can be missed on console
because it checks current log level at time of console_unlock,
not at time of storing logs.

func()
{
....
....
        console_verbose();  // user wants to have all the logs on console.
        pr_alert();
dump_backtrace(); //prints with default loglevel.
        ...
        console_silent(); // stop all logs from printing on console.
}

Now if console_lock was owned by another process, the messages might
be handled after the consoles were silenced.

Reused flag LOG_NOCONS as its usage is gone long back by the commit
5c2992ee7fd8a29d0412 ("printk: remove console flushing special cases
for partial buffered lines").

Note that there are still some corner cases where this patch is not enough.
For example, when the messages are flushed later from printk_safe buffers
or when there are races between console_verbose() and console_silent()
callers.

Link: http://lkml.kernel.org/r/20180601090029epcas5p3cc93d4bfbebb3199f0a2684058da7e26~z-a_jkmrI2993329933epcas5p3q@epcas5p3.samsung.com
Cc: linux-kernel@vger.kernel.org
Cc: a.sahrawat@samsung.com
Cc: pankaj.m@samsung.com
Cc: v.narang@samsung.com
Cc: <maninder1.s@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
kernel/printk/printk.c