diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2017-02-06 11:42:53 -0500 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2017-02-08 05:19:10 -0500 |
commit | 7acac3445acde1c94054cde69ab53503d296c393 (patch) | |
tree | 53508c90b09a00631899d2bf8aeddeee3de23bbd /kernel/printk | |
parent | 099f1c84c0052ec1b27f1c3942eed5830d86bdbb (diff) |
printk: always use deferred printk when flush printk_safe lines
Always use printk_deferred() in printk_safe_flush_line().
Flushing can be done from NMI or printk_safe contexts (when
we are in panic), so we can't call console drivers, yet still
want to store the messages in the logbuf buffer. Therefore we
use a deferred printk version.
Link: http://lkml.kernel.org/r/20170206164253.GA463@tigerII.localdomain
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Cc: Calvin Owens <calvinowens@fb.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Suggested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk_safe.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c index efc89a4e9df5..5214d326d3ba 100644 --- a/kernel/printk/printk_safe.c +++ b/kernel/printk/printk_safe.c | |||
@@ -110,17 +110,15 @@ again: | |||
110 | return add; | 110 | return add; |
111 | } | 111 | } |
112 | 112 | ||
113 | static void printk_safe_flush_line(const char *text, int len) | 113 | static inline void printk_safe_flush_line(const char *text, int len) |
114 | { | 114 | { |
115 | /* | 115 | /* |
116 | * The buffers are flushed in NMI only on panic. The messages must | 116 | * Avoid any console drivers calls from here, because we may be |
117 | * go only into the ring buffer at this stage. Consoles will get | 117 | * in NMI or printk_safe context (when in panic). The messages |
118 | * explicitly called later when a crashdump is not generated. | 118 | * must go only into the ring buffer at this stage. Consoles will |
119 | * get explicitly called later when a crashdump is not generated. | ||
119 | */ | 120 | */ |
120 | if (in_nmi()) | 121 | printk_deferred("%.*s", len, text); |
121 | printk_deferred("%.*s", len, text); | ||
122 | else | ||
123 | printk("%.*s", len, text); | ||
124 | } | 122 | } |
125 | 123 | ||
126 | /* printk part of the temporary buffer line by line */ | 124 | /* printk part of the temporary buffer line by line */ |