aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/init/main.c b/init/main.c
index db843bff5732..17e9757bfde2 100644
--- a/init/main.c
+++ b/init/main.c
@@ -63,6 +63,7 @@
63#include <linux/signal.h> 63#include <linux/signal.h>
64#include <linux/idr.h> 64#include <linux/idr.h>
65#include <linux/ftrace.h> 65#include <linux/ftrace.h>
66#include <trace/boot.h>
66 67
67#include <asm/io.h> 68#include <asm/io.h>
68#include <asm/bugs.h> 69#include <asm/bugs.h>
@@ -704,31 +705,35 @@ core_param(initcall_debug, initcall_debug, bool, 0644);
704int do_one_initcall(initcall_t fn) 705int do_one_initcall(initcall_t fn)
705{ 706{
706 int count = preempt_count(); 707 int count = preempt_count();
707 ktime_t delta; 708 ktime_t calltime, delta, rettime;
708 char msgbuf[64]; 709 char msgbuf[64];
709 struct boot_trace it; 710 struct boot_trace_call call;
711 struct boot_trace_ret ret;
710 712
711 if (initcall_debug) { 713 if (initcall_debug) {
712 it.caller = task_pid_nr(current); 714 call.caller = task_pid_nr(current);
713 printk("calling %pF @ %i\n", fn, it.caller); 715 printk("calling %pF @ %i\n", fn, call.caller);
714 it.calltime = ktime_get(); 716 calltime = ktime_get();
717 trace_boot_call(&call, fn);
718 enable_boot_trace();
715 } 719 }
716 720
717 it.result = fn(); 721 ret.result = fn();
718 722
719 if (initcall_debug) { 723 if (initcall_debug) {
720 it.rettime = ktime_get(); 724 disable_boot_trace();
721 delta = ktime_sub(it.rettime, it.calltime); 725 rettime = ktime_get();
722 it.duration = (unsigned long long) delta.tv64 >> 10; 726 delta = ktime_sub(rettime, calltime);
727 ret.duration = (unsigned long long) ktime_to_ns(delta) >> 10;
728 trace_boot_ret(&ret, fn);
723 printk("initcall %pF returned %d after %Ld usecs\n", fn, 729 printk("initcall %pF returned %d after %Ld usecs\n", fn,
724 it.result, it.duration); 730 ret.result, ret.duration);
725 trace_boot(&it, fn);
726 } 731 }
727 732
728 msgbuf[0] = 0; 733 msgbuf[0] = 0;
729 734
730 if (it.result && it.result != -ENODEV && initcall_debug) 735 if (ret.result && ret.result != -ENODEV && initcall_debug)
731 sprintf(msgbuf, "error code %d ", it.result); 736 sprintf(msgbuf, "error code %d ", ret.result);
732 737
733 if (preempt_count() != count) { 738 if (preempt_count() != count) {
734 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 739 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
@@ -742,7 +747,7 @@ int do_one_initcall(initcall_t fn)
742 printk("initcall %pF returned with %s\n", fn, msgbuf); 747 printk("initcall %pF returned with %s\n", fn, msgbuf);
743 } 748 }
744 749
745 return it.result; 750 return ret.result;
746} 751}
747 752
748 753
@@ -883,7 +888,7 @@ static int __init kernel_init(void * unused)
883 * we're essentially up and running. Get rid of the 888 * we're essentially up and running. Get rid of the
884 * initmem segments and start the user-mode stuff.. 889 * initmem segments and start the user-mode stuff..
885 */ 890 */
886 stop_boot_trace(); 891
887 init_post(); 892 init_post();
888 return 0; 893 return 0;
889} 894}