From: Peter Zijlstra <peterz@infradead.org>
To: John Stultz <john.stultz@linaro.org>
Cc: Lei Wen <leiwen@marvell.com>,
Thomas Gleixner <tglx@linutronix.de>,
Stephen Boyd <sboyd@codeaurora.org>,
Andrew Morton <akpm@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Michael Opdenacker <michael.opdenacker@free-electrons.com>,
Joe Perches <joe@perches.com>, Tejun Heo <tj@kernel.org>,
Petr Mladek <pmladek@suse.cz>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] printk: using booting time as the timestamp
Date: Sat, 5 Apr 2014 10:01:19 +0200 [thread overview]
Message-ID: <20140405080119.GA11096@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <533F2A57.1060808@linaro.org>
On Fri, Apr 04, 2014 at 02:55:35PM -0700, John Stultz wrote:
> On 04/03/2014 08:18 PM, Lei Wen wrote:
> > As people may want to align the kernel log with some other processor
> > running over the same machine but not the same copy of linux, we
> > need to keep their log aligned, so that it would not make debug
> > process hard and confused.
> >
> > Signed-off-by: Lei Wen <leiwen@marvell.com>
> > ---
> > kernel/printk/printk.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index a45b509..af96fbd 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -349,7 +349,7 @@ static void log_store(int facility, int level,
> > if (ts_nsec > 0)
> > msg->ts_nsec = ts_nsec;
> > else
> > - msg->ts_nsec = local_clock();
> > + msg->ts_nsec = ktime_to_ns(ktime_get_boottime());
>
> No no... Since ktime_get_boottime() takes the timekeeping seqlock, this
> will cause any printk (or WARN_ON, etc) that is done while holding a
> write in the timekeeping seqlock to deadlock (which I mentioned last time).
>
> I think the better solution here is to have the timekeeping code provide
> the printk logic the offset value whenever the sleep time is updated.
> That way the printk logic can manage its own values w/o having to take
> any timekeeping locks.
>
> That said, I'm still not really fond of trying to add this
> functionality. The printk timestamping code was always a little fuzzy,
> using jiffies or sched_clock in order to give a rough estimate of boot
> delays (and didn't include ntp freq correction, etc). When it was
> introduced, I feel like folks were concerned about this, but folks
> agreed the rough estimates were worth it, and it didn't have to involve
> the real timekeeping code. Now, trying to raise the bar here to make
> printk timestamps actually correlate with
> CLOCK_BOOTTIME/REALTIME/MONOTONIC (which I'll admit, seems quite
> reasonable given we have timestamps already - but ends up being feature
> creep) will add quite a bit of complexity due to the fact that printk is
> supposed to be safe to call from everywhere.
>
> And again, syslog can add timestamps to the kernel messages relatively
> well in userland. So I'm not sure the need is clear.
Not to mention that ktime_get*() is stupid slow for some.
prev parent reply other threads:[~2014-04-05 8:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-04 3:18 [PATCH 0/3] switch printk timestamp to use booting time Lei Wen
2014-04-04 3:18 ` [PATCH 1/3] time: create __get_monotonic_boottime for WARNless calls Lei Wen
2014-04-04 3:18 ` [PATCH 2/3] timekeeping: move clocksource init to the early place Lei Wen
2014-04-04 3:18 ` [PATCH 3/3] printk: using booting time as the timestamp Lei Wen
2014-04-04 21:55 ` John Stultz
2014-04-05 8:01 ` Peter Zijlstra [this message]
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=20140405080119.GA11096@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=john.stultz@linaro.org \
--cc=leiwen@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.opdenacker@free-electrons.com \
--cc=pmladek@suse.cz \
--cc=rostedt@goodmis.org \
--cc=sboyd@codeaurora.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/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
Powered by JetHome