POC: Alternative solution: Re: [PATCH 0/4] printk: reimplement LOG_CONT handling

Linus Torvalds torvalds at linux-foundation.org
Fri Aug 14 18:46:30 EDT 2020


On Thu, Aug 13, 2020 at 4:54 AM Sergey Senozhatsky
<sergey.senozhatsky at gmail.com> wrote:
>
> I think what Linus said a long time ago was that the initial purpose of
> pr_cont was
>
>         pr_info("Initialize feature foo...");
>         if (init_feature_foo() == 0)
>                 pr_cont("ok\n");
>         else
>                 pr_cont("not ok\n");
>
>         And if init_feature_foo() crashes the kernel then the first printk()
>         form panic() will flush the cont buffer.

Right.

This is why I think any discussion that says "people should buffer
their lines themselves and we should get rid if pr_cont()" is
fundamentally broken.

Don't go down that hole. I won't take it. It's wrong.

The fact is, pr_cont() goes back to the original kernel. No, it wasn't
pr_cont() back then, and no, there were no actual explicit markers for
"this is a continuation" at all, it was all just "the last printk
didn't have a newline, so we continue where we left off".

We've added pr_cont (and KERN_CONT) since then, and I realize that a
lot of people hate the complexity it introduces, but it's a
fundamental complexity that you have to live with.

If you can't live with pr_cont(), you shouldn't be working on
printk(), and find some other area of the kernel that you _can_ live
with.

It really is that simple.

            Linus



More information about the kexec mailing list