diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/init/main.c b/init/main.c index 3820323c4c84..7e117a231af1 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/gfp.h> | 27 | #include <linux/gfp.h> |
28 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
29 | #include <linux/kmod.h> | 29 | #include <linux/kmod.h> |
30 | #include <linux/vmalloc.h> | ||
30 | #include <linux/kernel_stat.h> | 31 | #include <linux/kernel_stat.h> |
31 | #include <linux/start_kernel.h> | 32 | #include <linux/start_kernel.h> |
32 | #include <linux/security.h> | 33 | #include <linux/security.h> |
@@ -51,6 +52,7 @@ | |||
51 | #include <linux/key.h> | 52 | #include <linux/key.h> |
52 | #include <linux/unwind.h> | 53 | #include <linux/unwind.h> |
53 | #include <linux/buffer_head.h> | 54 | #include <linux/buffer_head.h> |
55 | #include <linux/page_cgroup.h> | ||
54 | #include <linux/debug_locks.h> | 56 | #include <linux/debug_locks.h> |
55 | #include <linux/debugobjects.h> | 57 | #include <linux/debugobjects.h> |
56 | #include <linux/lockdep.h> | 58 | #include <linux/lockdep.h> |
@@ -60,6 +62,7 @@ | |||
60 | #include <linux/sched.h> | 62 | #include <linux/sched.h> |
61 | #include <linux/signal.h> | 63 | #include <linux/signal.h> |
62 | #include <linux/idr.h> | 64 | #include <linux/idr.h> |
65 | #include <linux/ftrace.h> | ||
63 | 66 | ||
64 | #include <asm/io.h> | 67 | #include <asm/io.h> |
65 | #include <asm/bugs.h> | 68 | #include <asm/bugs.h> |
@@ -642,8 +645,10 @@ asmlinkage void __init start_kernel(void) | |||
642 | initrd_start = 0; | 645 | initrd_start = 0; |
643 | } | 646 | } |
644 | #endif | 647 | #endif |
648 | vmalloc_init(); | ||
645 | vfs_caches_init_early(); | 649 | vfs_caches_init_early(); |
646 | cpuset_init_early(); | 650 | cpuset_init_early(); |
651 | page_cgroup_init(); | ||
647 | mem_init(); | 652 | mem_init(); |
648 | enable_debug_pagealloc(); | 653 | enable_debug_pagealloc(); |
649 | cpu_hotplug_init(); | 654 | cpu_hotplug_init(); |
@@ -667,7 +672,6 @@ asmlinkage void __init start_kernel(void) | |||
667 | fork_init(num_physpages); | 672 | fork_init(num_physpages); |
668 | proc_caches_init(); | 673 | proc_caches_init(); |
669 | buffer_init(); | 674 | buffer_init(); |
670 | unnamed_dev_init(); | ||
671 | key_init(); | 675 | key_init(); |
672 | security_init(); | 676 | security_init(); |
673 | vfs_caches_init(num_physpages); | 677 | vfs_caches_init(num_physpages); |
@@ -687,46 +691,43 @@ asmlinkage void __init start_kernel(void) | |||
687 | 691 | ||
688 | acpi_early_init(); /* before LAPIC and SMP init */ | 692 | acpi_early_init(); /* before LAPIC and SMP init */ |
689 | 693 | ||
694 | ftrace_init(); | ||
695 | |||
690 | /* Do the rest non-__init'ed, we're now alive */ | 696 | /* Do the rest non-__init'ed, we're now alive */ |
691 | rest_init(); | 697 | rest_init(); |
692 | } | 698 | } |
693 | 699 | ||
694 | static int initcall_debug; | 700 | static int initcall_debug; |
695 | 701 | core_param(initcall_debug, initcall_debug, bool, 0644); | |
696 | static int __init initcall_debug_setup(char *str) | ||
697 | { | ||
698 | initcall_debug = 1; | ||
699 | return 1; | ||
700 | } | ||
701 | __setup("initcall_debug", initcall_debug_setup); | ||
702 | 702 | ||
703 | int do_one_initcall(initcall_t fn) | 703 | int do_one_initcall(initcall_t fn) |
704 | { | 704 | { |
705 | int count = preempt_count(); | 705 | int count = preempt_count(); |
706 | ktime_t t0, t1, delta; | 706 | ktime_t delta; |
707 | char msgbuf[64]; | 707 | char msgbuf[64]; |
708 | int result; | 708 | struct boot_trace it; |
709 | 709 | ||
710 | if (initcall_debug) { | 710 | if (initcall_debug) { |
711 | printk("calling %pF\n", fn); | 711 | it.caller = task_pid_nr(current); |
712 | t0 = ktime_get(); | 712 | printk("calling %pF @ %i\n", fn, it.caller); |
713 | it.calltime = ktime_get(); | ||
713 | } | 714 | } |
714 | 715 | ||
715 | result = fn(); | 716 | it.result = fn(); |
716 | 717 | ||
717 | if (initcall_debug) { | 718 | if (initcall_debug) { |
718 | t1 = ktime_get(); | 719 | it.rettime = ktime_get(); |
719 | delta = ktime_sub(t1, t0); | 720 | delta = ktime_sub(it.rettime, it.calltime); |
720 | 721 | it.duration = (unsigned long long) delta.tv64 >> 10; | |
721 | printk("initcall %pF returned %d after %Ld msecs\n", | 722 | printk("initcall %pF returned %d after %Ld usecs\n", fn, |
722 | fn, result, | 723 | it.result, it.duration); |
723 | (unsigned long long) delta.tv64 >> 20); | 724 | trace_boot(&it, fn); |
724 | } | 725 | } |
725 | 726 | ||
726 | msgbuf[0] = 0; | 727 | msgbuf[0] = 0; |
727 | 728 | ||
728 | if (result && result != -ENODEV && initcall_debug) | 729 | if (it.result && it.result != -ENODEV && initcall_debug) |
729 | sprintf(msgbuf, "error code %d ", result); | 730 | sprintf(msgbuf, "error code %d ", it.result); |
730 | 731 | ||
731 | if (preempt_count() != count) { | 732 | if (preempt_count() != count) { |
732 | strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); | 733 | strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); |
@@ -740,7 +741,7 @@ int do_one_initcall(initcall_t fn) | |||
740 | printk("initcall %pF returned with %s\n", fn, msgbuf); | 741 | printk("initcall %pF returned with %s\n", fn, msgbuf); |
741 | } | 742 | } |
742 | 743 | ||
743 | return result; | 744 | return it.result; |
744 | } | 745 | } |
745 | 746 | ||
746 | 747 | ||
@@ -767,7 +768,6 @@ static void __init do_initcalls(void) | |||
767 | static void __init do_basic_setup(void) | 768 | static void __init do_basic_setup(void) |
768 | { | 769 | { |
769 | rcu_init_sched(); /* needed by module_init stage. */ | 770 | rcu_init_sched(); /* needed by module_init stage. */ |
770 | /* drivers will send hotplug events */ | ||
771 | init_workqueues(); | 771 | init_workqueues(); |
772 | usermodehelper_init(); | 772 | usermodehelper_init(); |
773 | driver_init(); | 773 | driver_init(); |
@@ -855,6 +855,7 @@ static int __init kernel_init(void * unused) | |||
855 | smp_prepare_cpus(setup_max_cpus); | 855 | smp_prepare_cpus(setup_max_cpus); |
856 | 856 | ||
857 | do_pre_smp_initcalls(); | 857 | do_pre_smp_initcalls(); |
858 | start_boot_trace(); | ||
858 | 859 | ||
859 | smp_init(); | 860 | smp_init(); |
860 | sched_init_smp(); | 861 | sched_init_smp(); |
@@ -881,6 +882,7 @@ static int __init kernel_init(void * unused) | |||
881 | * we're essentially up and running. Get rid of the | 882 | * we're essentially up and running. Get rid of the |
882 | * initmem segments and start the user-mode stuff.. | 883 | * initmem segments and start the user-mode stuff.. |
883 | */ | 884 | */ |
885 | stop_boot_trace(); | ||
884 | init_post(); | 886 | init_post(); |
885 | return 0; | 887 | return 0; |
886 | } | 888 | } |