aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-31 02:31:57 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-31 02:31:57 -0500
commita9de18eb761f7c1c860964b2e5addc1a35c7e861 (patch)
tree886e75fdfd09690cd262ca69cb7f5d1d42b48602 /init/main.c
parentb2aaf8f74cdc84a9182f6cabf198b7763bcb9d40 (diff)
parent6a94cb73064c952255336cc57731904174b2c58f (diff)
Merge branch 'linus' into stackprotector
Conflicts: arch/x86/include/asm/pda.h kernel/fork.c
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c65
1 files changed, 42 insertions, 23 deletions
diff --git a/init/main.c b/init/main.c
index 6aaff34a38c0..07da4dea50c3 100644
--- a/init/main.c
+++ b/init/main.c
@@ -28,6 +28,7 @@
28#include <linux/gfp.h> 28#include <linux/gfp.h>
29#include <linux/percpu.h> 29#include <linux/percpu.h>
30#include <linux/kmod.h> 30#include <linux/kmod.h>
31#include <linux/vmalloc.h>
31#include <linux/kernel_stat.h> 32#include <linux/kernel_stat.h>
32#include <linux/start_kernel.h> 33#include <linux/start_kernel.h>
33#include <linux/security.h> 34#include <linux/security.h>
@@ -52,6 +53,7 @@
52#include <linux/key.h> 53#include <linux/key.h>
53#include <linux/unwind.h> 54#include <linux/unwind.h>
54#include <linux/buffer_head.h> 55#include <linux/buffer_head.h>
56#include <linux/page_cgroup.h>
55#include <linux/debug_locks.h> 57#include <linux/debug_locks.h>
56#include <linux/debugobjects.h> 58#include <linux/debugobjects.h>
57#include <linux/lockdep.h> 59#include <linux/lockdep.h>
@@ -61,6 +63,8 @@
61#include <linux/sched.h> 63#include <linux/sched.h>
62#include <linux/signal.h> 64#include <linux/signal.h>
63#include <linux/idr.h> 65#include <linux/idr.h>
66#include <linux/ftrace.h>
67#include <trace/boot.h>
64 68
65#include <asm/io.h> 69#include <asm/io.h>
66#include <asm/bugs.h> 70#include <asm/bugs.h>
@@ -537,6 +541,15 @@ void __init __weak thread_info_cache_init(void)
537{ 541{
538} 542}
539 543
544void __init __weak arch_early_irq_init(void)
545{
546}
547
548void __init __weak early_irq_init(void)
549{
550 arch_early_irq_init();
551}
552
540asmlinkage void __init start_kernel(void) 553asmlinkage void __init start_kernel(void)
541{ 554{
542 char * command_line; 555 char * command_line;
@@ -607,6 +620,8 @@ asmlinkage void __init start_kernel(void)
607 sort_main_extable(); 620 sort_main_extable();
608 trap_init(); 621 trap_init();
609 rcu_init(); 622 rcu_init();
623 /* init some links before init_ISA_irqs() */
624 early_irq_init();
610 init_IRQ(); 625 init_IRQ();
611 pidhash_init(); 626 pidhash_init();
612 init_timers(); 627 init_timers();
@@ -649,8 +664,10 @@ asmlinkage void __init start_kernel(void)
649 initrd_start = 0; 664 initrd_start = 0;
650 } 665 }
651#endif 666#endif
667 vmalloc_init();
652 vfs_caches_init_early(); 668 vfs_caches_init_early();
653 cpuset_init_early(); 669 cpuset_init_early();
670 page_cgroup_init();
654 mem_init(); 671 mem_init();
655 enable_debug_pagealloc(); 672 enable_debug_pagealloc();
656 cpu_hotplug_init(); 673 cpu_hotplug_init();
@@ -671,10 +688,10 @@ asmlinkage void __init start_kernel(void)
671 efi_enter_virtual_mode(); 688 efi_enter_virtual_mode();
672#endif 689#endif
673 thread_info_cache_init(); 690 thread_info_cache_init();
691 cred_init();
674 fork_init(num_physpages); 692 fork_init(num_physpages);
675 proc_caches_init(); 693 proc_caches_init();
676 buffer_init(); 694 buffer_init();
677 unnamed_dev_init();
678 key_init(); 695 key_init();
679 security_init(); 696 security_init();
680 vfs_caches_init(num_physpages); 697 vfs_caches_init(num_physpages);
@@ -694,46 +711,47 @@ asmlinkage void __init start_kernel(void)
694 711
695 acpi_early_init(); /* before LAPIC and SMP init */ 712 acpi_early_init(); /* before LAPIC and SMP init */
696 713
714 ftrace_init();
715
697 /* Do the rest non-__init'ed, we're now alive */ 716 /* Do the rest non-__init'ed, we're now alive */
698 rest_init(); 717 rest_init();
699} 718}
700 719
701static int initcall_debug; 720static int initcall_debug;
702 721core_param(initcall_debug, initcall_debug, bool, 0644);
703static int __init initcall_debug_setup(char *str)
704{
705 initcall_debug = 1;
706 return 1;
707}
708__setup("initcall_debug", initcall_debug_setup);
709 722
710int do_one_initcall(initcall_t fn) 723int do_one_initcall(initcall_t fn)
711{ 724{
712 int count = preempt_count(); 725 int count = preempt_count();
713 ktime_t t0, t1, delta; 726 ktime_t calltime, delta, rettime;
714 char msgbuf[64]; 727 char msgbuf[64];
715 int result; 728 struct boot_trace_call call;
729 struct boot_trace_ret ret;
716 730
717 if (initcall_debug) { 731 if (initcall_debug) {
718 printk("calling %pF @ %i\n", fn, task_pid_nr(current)); 732 call.caller = task_pid_nr(current);
719 t0 = ktime_get(); 733 printk("calling %pF @ %i\n", fn, call.caller);
734 calltime = ktime_get();
735 trace_boot_call(&call, fn);
736 enable_boot_trace();
720 } 737 }
721 738
722 result = fn(); 739 ret.result = fn();
723 740
724 if (initcall_debug) { 741 if (initcall_debug) {
725 t1 = ktime_get(); 742 disable_boot_trace();
726 delta = ktime_sub(t1, t0); 743 rettime = ktime_get();
727 744 delta = ktime_sub(rettime, calltime);
728 printk("initcall %pF returned %d after %Ld msecs\n", 745 ret.duration = (unsigned long long) ktime_to_ns(delta) >> 10;
729 fn, result, 746 trace_boot_ret(&ret, fn);
730 (unsigned long long) delta.tv64 >> 20); 747 printk("initcall %pF returned %d after %Ld usecs\n", fn,
748 ret.result, ret.duration);
731 } 749 }
732 750
733 msgbuf[0] = 0; 751 msgbuf[0] = 0;
734 752
735 if (result && result != -ENODEV && initcall_debug) 753 if (ret.result && ret.result != -ENODEV && initcall_debug)
736 sprintf(msgbuf, "error code %d ", result); 754 sprintf(msgbuf, "error code %d ", ret.result);
737 755
738 if (preempt_count() != count) { 756 if (preempt_count() != count) {
739 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 757 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
@@ -747,7 +765,7 @@ int do_one_initcall(initcall_t fn)
747 printk("initcall %pF returned with %s\n", fn, msgbuf); 765 printk("initcall %pF returned with %s\n", fn, msgbuf);
748 } 766 }
749 767
750 return result; 768 return ret.result;
751} 769}
752 770
753 771
@@ -774,7 +792,6 @@ static void __init do_initcalls(void)
774static void __init do_basic_setup(void) 792static void __init do_basic_setup(void)
775{ 793{
776 rcu_init_sched(); /* needed by module_init stage. */ 794 rcu_init_sched(); /* needed by module_init stage. */
777 /* drivers will send hotplug events */
778 init_workqueues(); 795 init_workqueues();
779 usermodehelper_init(); 796 usermodehelper_init();
780 driver_init(); 797 driver_init();
@@ -862,6 +879,7 @@ static int __init kernel_init(void * unused)
862 smp_prepare_cpus(setup_max_cpus); 879 smp_prepare_cpus(setup_max_cpus);
863 880
864 do_pre_smp_initcalls(); 881 do_pre_smp_initcalls();
882 start_boot_trace();
865 883
866 smp_init(); 884 smp_init();
867 sched_init_smp(); 885 sched_init_smp();
@@ -888,6 +906,7 @@ static int __init kernel_init(void * unused)
888 * we're essentially up and running. Get rid of the 906 * we're essentially up and running. Get rid of the
889 * initmem segments and start the user-mode stuff.. 907 * initmem segments and start the user-mode stuff..
890 */ 908 */
909
891 init_post(); 910 init_post();
892 return 0; 911 return 0;
893} 912}