From: xiang xiao <xiaoxiang781216@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-kernel@vger.kernel.org, Xiang Xiao <xiaoxiang@xiaomi.com>
Subject: Re: [PATCH] printk: add KERN_NOTIME to skip the timestamp
Date: Wed, 13 Feb 2019 21:49:30 +0800 [thread overview]
Message-ID: <CAH2Cfb-5-ZxQPBTx_Gxt9kK3DqwTOS1Z6RVJ-ewMSB2-U0eTRg@mail.gmail.com> (raw)
In-Reply-To: <20190213131912.4w3fonbgwjathpyp@pathway.suse.cz>
On Wed, Feb 13, 2019 at 9:19 PM Petr Mladek <pmladek@suse.com> wrote:
>
> On Wed 2019-02-13 14:19:01, xiang xiao wrote:
> > On Wed, Feb 13, 2019 at 3:46 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > On Wed, 13 Feb 2019 02:11:05 +0800
> > > Xiang Xiao <xiaoxiang781216@gmail.com> 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
>
> What do you exactly mean by the threshold, please?
The current algorithm is:
1.the free space is less than 25% or
2.the idle time is large than 100ms
> Does it mean
> that you use the kernel buffer when there are too many messages
> and they do not fit into the MCU local buffer?
The buffering just happen in MCU side, kernel don't do any buffering
except waiting for '\n' before printk.
>
> How exactly the kernel gets the messages, please?
> Via a kernel driver or from userspace (via /dev/kmsg)?
>
It's a kernel rpmsg driver:
https://github.com/thesofproject/linux/pull/177/commits/a0b7009fede5552dc98733f2996a8140bff62455
>
> > 4.Kernel call printk to dump the received buffer
> > So I want that printk skip the timestamp here.
>
> If the messages are printed by a kernel driver then
> a better solution would be to create a printk() API
> where you could pass the time stamp as a parameter.
Yes, this is a better approach and could fix all issues you list below.
>
> The aim is to store the precise time stamp in ts_nsec, struct
> printk_log. Then it will get handled correctly by any
> output, e.g. consoles, syslog, /dev/kmsg.
>
>
> There are several problems with your approach:
>
> 1. The time stamp is still duplicated in the output via /dev/kmsg,
> see msg_print_ext_header(). We could not change this
> because the time stamp is part of the format.
> Any change could break userspace (systemd).
>
>
> 2. The time stamp stays part of the message:
>
> + It might have different format than the normal
> time stamp. Therefore it might be hard to filter
>
> + dmesg might be unable to parse it and show in
> the other formats.
>
> + Kernel-5.1 will allow to print information
> about the caller. It is supposed to be between
> the time stamp and the message text, see
> http://lkml.kernel.org/r/93f19e57-5051-c67d-9af4-b17624062d44@i-love.sakura.ne.jp
>
>
> Best Regards,
> Petr
next prev parent reply other threads:[~2019-02-13 13:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 18:11 [PATCH] printk: add KERN_NOTIME to skip the timestamp Xiang Xiao
2019-02-12 19:46 ` Steven Rostedt
2019-02-13 6:19 ` xiang xiao
2019-02-13 6:29 ` Sergey Senozhatsky
2019-02-13 6:38 ` Sergey Senozhatsky
2019-02-13 7:14 ` xiang xiao
2019-02-13 8:08 ` Sergey Senozhatsky
2019-02-13 8:52 ` xiang xiao
2019-02-13 13:19 ` Petr Mladek
2019-02-13 13:49 ` xiang xiao [this message]
2019-02-13 13:47 ` Steven Rostedt
2019-02-13 14:00 ` xiang xiao
2019-02-13 14:31 ` Steven Rostedt
2019-02-13 16:25 ` xiang xiao
2019-02-14 1:26 ` Sergey Senozhatsky
2019-02-14 8:48 ` Petr Mladek
2019-02-13 0:48 ` Sergey Senozhatsky
2019-02-13 6:25 ` xiang xiao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH2Cfb-5-ZxQPBTx_Gxt9kK3DqwTOS1Z6RVJ-ewMSB2-U0eTRg@mail.gmail.com \
--to=xiaoxiang781216@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=xiaoxiang@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).