diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/init/main.c b/init/main.c index 4371d11721f6..3e17a3bafe60 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/sched.h> | 61 | #include <linux/sched.h> |
62 | #include <linux/signal.h> | 62 | #include <linux/signal.h> |
63 | #include <linux/idr.h> | 63 | #include <linux/idr.h> |
64 | #include <linux/ftrace.h> | ||
64 | 65 | ||
65 | #include <asm/io.h> | 66 | #include <asm/io.h> |
66 | #include <asm/bugs.h> | 67 | #include <asm/bugs.h> |
@@ -689,6 +690,8 @@ asmlinkage void __init start_kernel(void) | |||
689 | 690 | ||
690 | acpi_early_init(); /* before LAPIC and SMP init */ | 691 | acpi_early_init(); /* before LAPIC and SMP init */ |
691 | 692 | ||
693 | ftrace_init(); | ||
694 | |||
692 | /* Do the rest non-__init'ed, we're now alive */ | 695 | /* Do the rest non-__init'ed, we're now alive */ |
693 | rest_init(); | 696 | rest_init(); |
694 | } | 697 | } |
@@ -705,30 +708,31 @@ __setup("initcall_debug", initcall_debug_setup); | |||
705 | int do_one_initcall(initcall_t fn) | 708 | int do_one_initcall(initcall_t fn) |
706 | { | 709 | { |
707 | int count = preempt_count(); | 710 | int count = preempt_count(); |
708 | ktime_t t0, t1, delta; | 711 | ktime_t delta; |
709 | char msgbuf[64]; | 712 | char msgbuf[64]; |
710 | int result; | 713 | struct boot_trace it; |
711 | 714 | ||
712 | if (initcall_debug) { | 715 | if (initcall_debug) { |
713 | printk("calling %pF @ %i\n", fn, task_pid_nr(current)); | 716 | it.caller = task_pid_nr(current); |
714 | t0 = ktime_get(); | 717 | printk("calling %pF @ %i\n", fn, it.caller); |
718 | it.calltime = ktime_get(); | ||
715 | } | 719 | } |
716 | 720 | ||
717 | result = fn(); | 721 | it.result = fn(); |
718 | 722 | ||
719 | if (initcall_debug) { | 723 | if (initcall_debug) { |
720 | t1 = ktime_get(); | 724 | it.rettime = ktime_get(); |
721 | delta = ktime_sub(t1, t0); | 725 | delta = ktime_sub(it.rettime, it.calltime); |
722 | 726 | it.duration = (unsigned long long) delta.tv64 >> 10; | |
723 | printk("initcall %pF returned %d after %Ld msecs\n", | 727 | printk("initcall %pF returned %d after %Ld usecs\n", fn, |
724 | fn, result, | 728 | it.result, it.duration); |
725 | (unsigned long long) delta.tv64 >> 20); | 729 | trace_boot(&it, fn); |
726 | } | 730 | } |
727 | 731 | ||
728 | msgbuf[0] = 0; | 732 | msgbuf[0] = 0; |
729 | 733 | ||
730 | if (result && result != -ENODEV && initcall_debug) | 734 | if (it.result && it.result != -ENODEV && initcall_debug) |
731 | sprintf(msgbuf, "error code %d ", result); | 735 | sprintf(msgbuf, "error code %d ", it.result); |
732 | 736 | ||
733 | if (preempt_count() != count) { | 737 | if (preempt_count() != count) { |
734 | strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); | 738 | strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); |
@@ -742,7 +746,7 @@ int do_one_initcall(initcall_t fn) | |||
742 | printk("initcall %pF returned with %s\n", fn, msgbuf); | 746 | printk("initcall %pF returned with %s\n", fn, msgbuf); |
743 | } | 747 | } |
744 | 748 | ||
745 | return result; | 749 | return it.result; |
746 | } | 750 | } |
747 | 751 | ||
748 | 752 | ||
@@ -857,6 +861,7 @@ static int __init kernel_init(void * unused) | |||
857 | smp_prepare_cpus(setup_max_cpus); | 861 | smp_prepare_cpus(setup_max_cpus); |
858 | 862 | ||
859 | do_pre_smp_initcalls(); | 863 | do_pre_smp_initcalls(); |
864 | start_boot_trace(); | ||
860 | 865 | ||
861 | smp_init(); | 866 | smp_init(); |
862 | sched_init_smp(); | 867 | sched_init_smp(); |
@@ -883,6 +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 | */ |
891 | stop_boot_trace(); | ||
886 | init_post(); | 892 | init_post(); |
887 | return 0; | 893 | return 0; |
888 | } | 894 | } |