提交 31f6d9d6 编写于 作者: A Andrew Morton 提交者: Linus Torvalds

[PATCH] Add printk_clock()

ia64's sched_clock() accesses per-cpu data which isn't set up at boot time.
Hence ia64 cannot use printk timestamping, because printk() will crash in
sched_clock().

So make printk() use printk_clock(), defaulting to sched_clock(), overrideable
by the architecture via attribute(weak).

Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 66dcca06
...@@ -488,6 +488,11 @@ static int __init printk_time_setup(char *str) ...@@ -488,6 +488,11 @@ static int __init printk_time_setup(char *str)
__setup("time", printk_time_setup); __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. * This is printk. It can be called from any context. We want it to work.
* *
...@@ -565,7 +570,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) ...@@ -565,7 +570,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
loglev_char = default_message_loglevel loglev_char = default_message_loglevel
+ '0'; + '0';
} }
t = sched_clock(); t = printk_clock();
nanosec_rem = do_div(t, 1000000000); nanosec_rem = do_div(t, 1000000000);
tlen = sprintf(tbuf, tlen = sprintf(tbuf,
"<%c>[%5lu.%06lu] ", "<%c>[%5lu.%06lu] ",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册