mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Prarit Bhargava <prarit@redhat.com>,
	Mark Salyzyn <salyzyn@android.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Orson Zhai <orsonzhai@gmail.com>,
	Changki Kim <changki.kim@samsung.com>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] printk: Store all three timestamps
Date: Thu, 24 Sep 2020 13:49:52 +0200	[thread overview]
Message-ID: <20200924114952.GA29288@alley> (raw)
In-Reply-To: <87pn6cdtwa.fsf@jogness.linutronix.de>

On Thu 2020-09-24 00:18:53, John Ogness wrote:
> On 2020-09-23, Petr Mladek <pmladek@suse.com> wrote:
> > printk() historically shows the timestamps from the monotonic clock.
> 
> printk() uses the local clock, not the monotonic clock.
> 
> > It is fast, available early during boot, in any context, and even
> > without using any lock.
> >
> > There are repeated requests [1][2][3] to show the timestamps from other
> > clocks. The main motivation is to make it easier to correlate the kernel
> > and userspace logs. Where userspace logs usually use the real time
> > clock.
> >
> > Unfortunately, it is not possible to simply replace the default clock.
> > Userspace tools, like journalctl, dmesg, expect to get the timestamps
> > from the mono via /dev/kmsg interface or syslog syscall [4].
> > Also administrators would be confused when logs from different
> > systems use different clocks depending on kernel version or
> > build option [5].
> >
> > As a result, the mono clock has to stay as the default clock
> > and has to be used in the current user interfaces.
> 
> Actually this series is changing the default clock from local to
> monotonic. I for one welcome this change (and wish ftrace would do it as
> well), but it is a change.

Good point! I expected that it is enough when boot timestamps are
monotonic.

IMHO, it is really important to use the same clock by printk() and
ftrace! Otherwise, it would be hard to match them.

Honestly, I do not know enough about the different clocks and their
users. My view is:

1. printk() needs a clock that is:

      + monotonic (always increasing)
      + lockless access
      + updated fast enough (precision)
      + available during early boot
      + match clock used by other kernel logs (ftrace)

2. ftrace needs a clock that is:

      + same requirements as for printk()
      + fast access to reduce performance problems

3. user space developers need:

   + real time clock to match userspace logs


Now, we have 4 clocks. IMHO, storing all 4 timestamps is not worth it.
We need at least two:

    + local, mono, or boot clock as legacy kernel timestamp
    + real clock to match timestamps from userspace tools


I am not able to say what clock is the best one for kernel timestamps.
The following questions come to my mind:

Is mono or boot clock fast enough for ftrace (performance wise)?
Is mono or boot clock available early enough during boot?
Is is boot clock acceptable as the default kernel clock?


IMHO, the boot clock is interesting because it has similar semantic
as the real time (running even during sleep). But I am not sure if
some developers do not rely on the mono clock or even local clock.

I guess that this need opinion from a wide audience or developers
experienced in many areas. I do not feel quialified to make
a decision.

Best Regards,
Petr

  parent reply	other threads:[~2020-09-24 11:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 13:56 [RFC 0/2] printk: Add more metadata for each record Petr Mladek
2020-09-23 13:56 ` [PATCH 1/2] printk: Store all three timestamps Petr Mladek
2020-09-23 22:12   ` John Ogness
2020-09-24  1:45     ` Sergey Senozhatsky
2020-09-24 11:49     ` Petr Mladek [this message]
     [not found]       ` <CAJ-C09hqwOJhSXx1h40q96xhNZFXxP6dUVfjUQZpO4ZhOMZLbQ@mail.gmail.com>
2020-09-25  9:51         ` Petr Mladek
2020-09-24  0:00   ` John Ogness
2020-09-24 10:37     ` Petr Mladek
2020-09-23 13:56 ` [RFC 2/2] printk: Add more information about the printk caller Petr Mladek
2020-09-24  1:40   ` Sergey Senozhatsky
2020-09-24 11:58     ` Petr Mladek
2020-09-24  2:17   ` Sergey Senozhatsky
2020-09-24  8:23     ` John Ogness
2020-09-24 13:26       ` Petr Mladek
2020-09-24 13:06     ` Petr Mladek
2020-09-24  4:24   ` Ahmed S. Darwish
2020-09-24 12:53     ` Petr Mladek
2020-09-24 13:38       ` Petr Mladek
2020-09-25  0:54         ` Sergey Senozhatsky
2020-09-25 10:20           ` Petr Mladek
2020-10-21 11:48   ` 김창기

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=20200924114952.GA29288@alley \
    --to=pmladek@suse.com \
    --cc=changki.kim@samsung.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=prarit@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=salyzyn@android.com \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=zhang.lyra@gmail.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

all inboxes | Powered by JetHome®