浏览代码

printk: use ktime_get()

printk timestamps: use ktime_get().

Some platforms have a functioning clocksource function only after
they are done with early bootup, so delay this until out of
SYSTEM_BOOTING state.

it's also inherently safe now, as any bugs in this area will be
caught by the printk recursion checks.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Ingo Molnar 17 年之前
父节点
当前提交
19ef930927
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      kernel/printk.c

+ 3 - 1
kernel/printk.c

@@ -702,7 +702,9 @@ asmlinkage int vprintk(const char *fmt, va_list args)
 					loglev_char = default_message_loglevel
 					loglev_char = default_message_loglevel
 						+ '0';
 						+ '0';
 				}
 				}
-				t = cpu_clock(printk_cpu);
+				t = 0;
+				if (system_state != SYSTEM_BOOTING)
+					t = ktime_to_ns(ktime_get());
 				nanosec_rem = do_div(t, 1000000000);
 				nanosec_rem = do_div(t, 1000000000);
 				tlen = sprintf(tbuf,
 				tlen = sprintf(tbuf,
 						"<%c>[%5lu.%06lu] ",
 						"<%c>[%5lu.%06lu] ",