From: Tim Bird <tim.bird@am.sony.com>
To: Tim Schmielau <tim@physik3.uni-rostock.de>
Cc: jesper.juhl@gmail.com, "Randy.Dunlap" <rdunlap@xenotime.net>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: early printk timings way off
Date: Fri, 16 Sep 2005 10:37:34 -0700 [thread overview]
Message-ID: <432B02DE.7060308@am.sony.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0509161909500.31820@gans.physik3.uni-rostock.de>
Tim Schmielau wrote:
> So, one jump (probably the first) happens when time_init sets use_tsc.
> Do we understand the other jump as well?
I haven't specifically tested, but I'd put good money on it being
a result of the initialization of cyc2ns_scale. Before this
is set, cycles_2_ns() returns 0 (which would explain the _exactly_
0 value). The value of 27.<something> seconds is very likely the
real value based on the TSC (which would mean the BIOS took
a good long time during boot).
So, in summary, this is probably what's happening:
* from start_kernel - sched_clock() returns jiffies_64 (which
is pre-initialized high and is not incrementing yet)
* when use_tsc is set, sched_clock returns 0, until
* when cyc2ns_scale is set, sched_clock returns TSC-based values,
representing time from cold machine start
On other platforms, I have sometimes replaced the call to sched_clock()
in printk() with something else that gives valid data from the very first
kernel instruction.
A while ago Andrew Morton said that maybe the clock used here should be
replaceable, using something like the code below. Does anyone know
if someone worked on this. If not I'll take a stab at submitting it.
--- devel/kernel/printk.c~printk_clock 2005-08-21 02:14:05.000000000
-0700
+++ devel-akpm/kernel/printk.c 2005-08-21 02:15:14.000000000 -0700
@@ -488,6 +488,11 @@ static int __init printk_time_setup(char
__setup("time", printk_time_setup);
+__attribute__((weak)) unsigned long long printk_clock(void)
+{
+ return sched_clock();
+}
+
/*
* This is printk. It can be called from any context. We want it to
work.
*
@@ -558,7 +563,7 @@ asmlinkage int vprintk(const char *fmt,
loglev_char =
default_message_loglevel
+ '0';
}
- t = sched_clock();
+ t = printk_clock();
nanosec_rem = do_div(t, 1000000000);
tlen = sprintf(tbuf,
"<%c>[%5lu.%06lu] ",
Regards,
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================
next prev parent reply other threads:[~2005-09-16 17:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-15 21:42 early printk timings way off Jesper Juhl
2005-09-15 21:59 ` Randy.Dunlap
2005-09-15 22:07 ` Jesper Juhl
2005-09-15 22:37 ` Randy.Dunlap
2005-09-15 22:49 ` Jesper Juhl
2005-09-15 22:55 ` Randy.Dunlap
2005-09-15 23:00 ` Jesper Juhl
2005-09-16 10:30 ` Rogier Wolff
2005-09-16 13:55 ` Jesper Juhl
2005-09-16 17:04 ` Tim Bird
2005-09-16 17:15 ` Tim Schmielau
2005-09-16 17:25 ` Tim Schmielau
2005-09-16 17:42 ` Tim Bird
2005-09-16 18:24 ` Tony Luck
2005-09-16 17:37 ` Tim Bird [this message]
2005-09-16 10:09 ` Tim Schmielau
2005-09-16 10:33 ` Tim Schmielau
2005-09-16 13:56 ` Jesper Juhl
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=432B02DE.7060308@am.sony.com \
--to=tim.bird@am.sony.com \
--cc=akpm@osdl.org \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=tim@physik3.uni-rostock.de \
/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