Linux Power Management development
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Mark Salyzyn <salyzyn@android.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz,
	linux-pm@vger.kernel.org, a.zummo@towertech.it,
	alexandre.belloni@free-electrons.com, linux-rtc@vger.kernel.org,
	andy.shevchenko@gmail.com, Mark Salyzyn <salyzyn@google.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Thierry Strudel <tstrudel@google.com>,
	John Stultz <john.stultz@linaro.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Kees Cook <keescook@chromium.org>, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Prarit Bhargava <prarit@redhat.com>
Subject: Re: [PATCH v2 1/4] time: rtc-lib: Add rtc_show_time(const char *prefix_msg)
Date: Wed, 19 Jul 2017 00:35:01 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1707190023010.2425@nanos> (raw)
In-Reply-To: <8afb372a-3951-6fb9-c0be-82756623061f@android.com>

On Tue, 18 Jul 2017, Mark Salyzyn wrote:
> On 07/18/2017 02:52 PM, Thomas Gleixner wrote:
> > Why on earth do you need to print that information in RTC format? What's
> > wrong with just doing:
> > 
> >        pr_info("My so important log message %lld\n",
> > ktime_get_real_seconds());
> 
> Legacy (these prints have been in Android tree since 2013) for all our battery
> and power analysis tools are keyed off RTC format. There is some momentum,
> default should be epoch seconds/nanoseconds as that is a good example; and
> another option can select RTC (the option can be an internal patch to alter
> the format ... ick)

Can we please fix the tools and not introduce that horror in the kernel?

> > and then decoding the seconds in post processing? That's completely
> > sufficient as you intend that for logging. Correlation with user space
> > CLOCK_REALTIME is even simpler as this is the same as reading it from user
> > space.
> This is part of triage and post-analysis, there is no user space call that can
> be made after the fact to correlate MONOTONIC time with REALTIME. The
> historgram for the relationship between the two time formats is built up in
> user space based on batched analysis of the kernel logs. Although the values
> slip because of ntp and other sources, suspend/resume/hibernate/restore and
> shutdown are definitive points of interest for analysis. The analysis is
> performed on klogd data which has a longer logging span than the internal
> buffer.

Printing ktime_get_real_seconds() gives you the wall time. I was merily
explaining that this is the same as reading CLOCK_REALTIME from userspace.

Just for the record: You cannot use that stuff deep in the suspend/resume
code because timekeeping is suspended there as well and that call to
getnstimeofday() is going to trigger a WARNON() when called after
timekeeping was suspended. So please be more precise about the limitations
of this.

> > If your main intention is logging/debugging, then you can just use
> > tracepoints. The tracer allows correlation to user space tracing already.
> tracepoints are disabled on field devices. As is debugfs. This is not
> logging/debugging, but field battery and power analysis. Some of the data
> shows up in the Battery Settings screen on the devices. We also _benefit_ from
> this information when correlating kernel logs with user space logs during
> triage.

There was some discussion about making the clock source for dmesg time
stamps selectable, so you can use MONOTONIC, REALTIME, BOOTTIME. The
patches looked sensible, but there was some showstopper vs. the user space
dmesg utility. See:

  http://lkml.kernel.org/r/1456250040-22351-1-git-send-email-prarit@redhat.com

I rather see that resolved and these patches merged than having yet another
half baken special purpose debug band aid. Maybe Prarit can shed some light
on the state of this.

Thanks,

	tglx

  reply	other threads:[~2017-07-18 22:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 21:19 [PATCH v2 1/4] time: rtc-lib: Add rtc_show_time(const char *prefix_msg) Mark Salyzyn
2017-07-18 21:52 ` Thomas Gleixner
2017-07-18 22:06   ` Mark Salyzyn
2017-07-18 22:35     ` Thomas Gleixner [this message]
2017-07-18 23:25       ` Mark Salyzyn
2017-07-19  7:23         ` Thomas Gleixner
2017-07-19 12:03           ` Prarit Bhargava
2017-07-19 12:28             ` Thomas Gleixner
2017-07-19 14:28               ` Prarit Bhargava
2017-07-19 18:13             ` Mark Salyzyn
2017-07-20  8:20     ` Pavel Machek

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=alpine.DEB.2.20.1707190023010.2425@nanos \
    --to=tglx@linutronix.de \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=keescook@chromium.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pavel@ucw.cz \
    --cc=peterz@infradead.org \
    --cc=prarit@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=salyzyn@android.com \
    --cc=salyzyn@google.com \
    --cc=tstrudel@google.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