Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines

From: Sergey Senozhatsky
Date: Sun Feb 05 2017 - 20:48:35 EST


On (02/03/17 12:18), Petr Mladek wrote:
[..]
> > by "the new approved variant" do you mean resend of the entire
> > patch set (v8) or just 0004 patch?
>
> I depends on how many and how complicated are possible conflicts
> with the followup patches.
>
> It is perfectly fine to send just 0004 if there are no conflicts
> or if they are trivial to resolve.

so there are no conflicts at all. 0004 can be replaced with the patch below.
but the thing is - I want to keep printk_safe_flush_line() around.

we call

static void printk_safe_flush_line(const char *text, int len)
{
/*
* 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.
*/
printk_deferred("%.*s", len, text);
}

from many places:

4x printk_safe_flush_buffer()
1x __printk_safe_flush()


replacing printk_safe_flush_line() with printk_deferred() produces things
like these

printk_deferred("%.*s", end - start, start);
printk_deferred("%.*s", strlen(newline), newline);

which, I think, makes the code worse. any objections?

just in case, the patch (which I prefer to be ignored)

===8<======8<===