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

From: Dmitry Vyukov
Date: Sat May 26 2018 - 02:37:10 EST


On Thu, May 24, 2018 at 4:14 AM, Sergey Senozhatsky
<sergey.senozhatsky.work@xxxxxxxxx> wrote:
>> First, we should ask what we expect from this feature.
>
> Yeah. Can't really comment on this, it's up to Tetsuo and Dmitry to
> decide. So far I've seen slightly different requirements/expectations.

The root problem is that it's not possible to make sense out of kernel
output if message takes more than 1 line (or output non-atomically
with several printk's) because of intermixed output from several
tasks/interrupts/etc. For example, it's not generally possible to
recover crash stack trace, because one gets random mix of frames.
Humans usually, but not always, can restore most of the sense. So the
goal is to make this ought-to-be-simple task actually simple and not
requiring human intelligence and time each time.

Prefixing each line with task/cpu/interrupt context should do the
trick as it will be possible to split kernel output into multiple
independent streams and analyze them independently.

In our context (syzbot testing) we can enable an additional config,
and adopt parser to understand additional line prefix. But I don't
know how prefixing lines fits into a larger picture. Does it make
sense to thought out a potential extension story for this format? E.g.
user specifies set of extension records that are dumped before each
line, and then can unambiguously parse them? I guess some
consoles/interfaces will never be extended to provide access to the
extension records, so it can make sense to make them accessible in
text format too (optionally).