Skip to content

Commit

Permalink
init: use ktime_us_delta() to make initcall_debug log more precise
Browse files Browse the repository at this point in the history
Use ktime_us_delta() to make the initcall_debug log more precise than
right shifting the result of ktime_to_ns() by 10 bits.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Mark-PK Tsai <[email protected]>
Reviewed-by: Andrew Halaney <[email protected]>
Tested-by: Andrew Halaney <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Valentin Schneider <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: YJ Chiang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
PeikanTsai authored and torvalds committed Mar 24, 2022
1 parent c882c6b commit 105e8c2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,15 +1246,11 @@ trace_initcall_start_cb(void *data, initcall_t fn)
static __init_or_module void
trace_initcall_finish_cb(void *data, initcall_t fn, int ret)
{
ktime_t *calltime = (ktime_t *)data;
ktime_t delta, rettime;
unsigned long long duration;
ktime_t rettime, *calltime = (ktime_t *)data;

rettime = ktime_get();
delta = ktime_sub(rettime, *calltime);
duration = (unsigned long long) ktime_to_ns(delta) >> 10;
printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n",
fn, ret, duration);
fn, ret, (unsigned long long)ktime_us_delta(rettime, *calltime));
}

static ktime_t initcall_calltime;
Expand Down

0 comments on commit 105e8c2

Please sign in to comment.