Re: [PATCH] printk: add KERN_NOTIME to skip the timestamp

From: Steven Rostedt
Date: Wed Feb 13 2019 - 08:47:46 EST


On Wed, 13 Feb 2019 14:19:01 +0800
xiang xiao <xiaoxiang781216@xxxxxxxxx> wrote:

> On Wed, Feb 13, 2019 at 3:46 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > On Wed, 13 Feb 2019 02:11:05 +0800
> > Xiang Xiao <xiaoxiang781216@xxxxxxxxx> wrote:
> >
> > > Because log may already add the timestamp sometime
> >
> > Can you be a bit more detailed on this. When and where does this
> > happen?
>
> Here is my case:
> 1.A small MCU(Cortex M4) in SoC run RTOS
> 2.RTOS append timestamp to log for the accurate timing
> 3.RTOS send log to Linux kernel when buffer exceed the threshold
> 4.Kernel call printk to dump the received buffer
> So I want that printk skip the timestamp here.
>
> > If anything, I would probably prefer that we export whether
> > time is being printed, and have the caller not print time if printk is
> > doing it already, than to add the complexity into printk itself.
>
> Actually, the timestamp of our initial implementation like your
> suggestion come from printk,
> but we found that timestamp from kernel isn't accurate as from RTOS
> due the buffer and IPC.
>

If the timestamps are different, then you don't want to remove the
printk one. Otherwise you are going to have a confusion between your
added timestamp mixed in with the kernel's inaccurate timestamps.

-- Steve