Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1574987
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines |
| Date | 2017-02-06 18:00 +0100 |
| Message-ID | <t7UNY-7sP-3@gated-at.bofh.it> (permalink) |
| References | (6 earlier) <t7GBj-6H0-11@gated-at.bofh.it> <t7GUF-72t-1@gated-at.bofh.it> <t7Qr0-4PJ-19@gated-at.bofh.it> <t7RwK-5sW-37@gated-at.bofh.it> <t7UEh-7p1-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 7 Feb 2017 01:42:53 +0900
Sergey Senozhatsky <sergey.senozhatsky@gmail.com> wrote:
> On (02/06/17 08:27), Steven Rostedt wrote:
> [..]
> > > > > just in case, the patch (which I prefer to be ignored)
> > > >
> > > > let's keep printk_safe_flush_line().
> > >
> > > I do not have strong opinion but I would slightly prefer
> > > to keep the helper function. The use of printk_deferred()
> > > is a bit tricky and it is better to have only one copy.
> > >
> > > Steven, could you live with the original patch, please?
> >
> > Sure, but make it into a static inline.
>
> well, I'll be surprised if gcc doesn't inline that simple one-liner.
I never trust gcc ;-) It's been known to uninline simple one liners
before that have been marked as "inline" :-p
>
> attached. no conflicts, the patch can replace 0004.
>
> ===8<===8<===
>
> >From 69bbb0f436a2a89ec41a5831c03490e0a78ce12e Mon Sep 17 00:00:00 2001
> From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Date: Tue, 27 Dec 2016 23:16:07 +0900
> Subject: [PATCH] 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.
>
> 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>
-- Steve
> ---
> kernel/printk/printk_safe.c | 14 ++++++--------
> 1 file 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 @@ static int printk_safe_log_store(struct printk_safe_seq_buf *s,
> return add;
> }
>
> -static void printk_safe_flush_line(const char *text, int len)
> +static inline void printk_safe_flush_line(const char *text, int len)
> {
> /*
> - * The buffers are flushed in NMI only on panic. The messages must
> - * go only into the ring buffer at this stage. Consoles will get
> - * explicitly called later when a crashdump is not generated.
> + * Avoid any console drivers calls from here, because we may be
> + * in NMI or printk_safe context (when in panic). The messages
> + * must go only into the ring buffer at this stage. Consoles will
> + * get explicitly called later when a crashdump is not generated.
> */
> - if (in_nmi())
> - printk_deferred("%.*s", len, text);
> - else
> - printk("%.*s", len, text);
> + printk_deferred("%.*s", len, text);
> }
>
> /* printk part of the temporary buffer line by line */
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Steven Rostedt <rostedt@goodmis.org> - 2017-02-01 17:10 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-02-02 07:10 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Petr Mladek <pmladek@suse.com> - 2017-02-02 16:40 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Petr Mladek <pmladek@suse.com> - 2017-02-02 17:00 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-02-03 03:10 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Petr Mladek <pmladek@suse.com> - 2017-02-03 12:20 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-02-06 02:50 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-02-06 03:10 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Petr Mladek <pmladek@suse.com> - 2017-02-06 13:20 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Steven Rostedt <rostedt@goodmis.org> - 2017-02-06 14:30 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-02-06 17:50 +0100
Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Steven Rostedt <rostedt@goodmis.org> - 2017-02-06 18:00 +0100
csiph-web