Re: [PATCH] printk: inject caller information into the body of message

From: Sergey Senozhatsky
Date: Wed Jun 20 2018 - 07:08:10 EST


On (06/20/18 11:31), Dmitry Vyukov wrote:
> > BTW, pr_cont() handling is not so simple when we are in printk_safe()
> > context. Unlike vprintk_emit() [normal printk], we don't use any
> > dedicated pr_cont() buffer in printk_safe. So, at a glance, I suspect
> > that injecting context info at every printk_safe_log_store() call for
> > `for (...) pr_cont()' loop is going to produce something like this:
> > I<10> 23 I<10> 43 I<10> 47 ....
> >
> > // Hmm, maybe the line will endup having two prefixes. Once
> > // from printk_safe_log_store, the other from normal printk
> > // log_store().
> >
> > While the same `for (...) pr_cont()' called from normal printk() context
> > will produce
> > I<10> 32 43 47 ....
> >
> > It could be that I'm wrong.
> > Tetsuo, have you tested pr_cont() from printk_safe() context?
>
>
> So this is another reason to get rid of pr_cont entirely, right?

Getting rid of pr_cont() from important output would be totally cool.
Quoting Linus:

Only acceptable use of continuations is basically boot-time testing,
when you do things like

printk("Testing feature XYZ..");
this_may_blow_up_because_of_hw_bugs();
printk(KERN_CONT " ... ok\n");


I can recall at least 4 attempts when people tried to introduce new pr_cont()
or some concept with similar functionality to pr_cont(), but SMP safe. We
brought the first one - per-CPU pr_cont() buffers - to KS several years ago
but Linus didn't like it. Then there was a buffered printk() mode patch from
Tetsuo, then a solution from Steven, then I had my second try with a
soft-of-pr_cont() replacement.

So, if we could get rid of pr_cont() from the most important parts
(instruction dumps, etc) then I would just vote to leave pr_cont()
alone and avoid any handling of it in printk context tracking. Simply
because we wouldn't care about pr_cont(). This also could simplify
Tetsuo's patch significantly.

-ss