aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-05-19 01:09:05 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-05-19 01:09:05 -0400
commitc203e45f069af47ca7623e4dcd8c00bfba2722e4 (patch)
tree4563115b6565dcfd97015c1c9366fb3d07cabf19 /init/main.c
parenta94477da38e0b261a7ecea71f4c95a3bcd5be69c (diff)
parentb8291ad07a7f3b5b990900f0001198ac23ba893e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c101
1 files changed, 52 insertions, 49 deletions
diff --git a/init/main.c b/init/main.c
index 1687b0167c4a..f7fb20021d48 100644
--- a/init/main.c
+++ b/init/main.c
@@ -52,12 +52,14 @@
52#include <linux/unwind.h> 52#include <linux/unwind.h>
53#include <linux/buffer_head.h> 53#include <linux/buffer_head.h>
54#include <linux/debug_locks.h> 54#include <linux/debug_locks.h>
55#include <linux/debugobjects.h>
55#include <linux/lockdep.h> 56#include <linux/lockdep.h>
56#include <linux/pid_namespace.h> 57#include <linux/pid_namespace.h>
57#include <linux/device.h> 58#include <linux/device.h>
58#include <linux/kthread.h> 59#include <linux/kthread.h>
59#include <linux/sched.h> 60#include <linux/sched.h>
60#include <linux/signal.h> 61#include <linux/signal.h>
62#include <linux/idr.h>
61 63
62#include <asm/io.h> 64#include <asm/io.h>
63#include <asm/bugs.h> 65#include <asm/bugs.h>
@@ -458,7 +460,7 @@ static void noinline __init_refok rest_init(void)
458 kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND); 460 kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
459 numa_default_policy(); 461 numa_default_policy();
460 pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES); 462 pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
461 kthreadd_task = find_task_by_pid(pid); 463 kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
462 unlock_kernel(); 464 unlock_kernel();
463 465
464 /* 466 /*
@@ -542,6 +544,7 @@ asmlinkage void __init start_kernel(void)
542 */ 544 */
543 unwind_init(); 545 unwind_init();
544 lockdep_init(); 546 lockdep_init();
547 debug_objects_early_init();
545 cgroup_init_early(); 548 cgroup_init_early();
546 549
547 local_irq_disable(); 550 local_irq_disable();
@@ -559,6 +562,7 @@ asmlinkage void __init start_kernel(void)
559 printk(KERN_NOTICE); 562 printk(KERN_NOTICE);
560 printk(linux_banner); 563 printk(linux_banner);
561 setup_arch(&command_line); 564 setup_arch(&command_line);
565 mm_init_owner(&init_mm, &init_task);
562 setup_command_line(command_line); 566 setup_command_line(command_line);
563 unwind_setup(); 567 unwind_setup();
564 setup_per_cpu_areas(); 568 setup_per_cpu_areas();
@@ -598,6 +602,7 @@ asmlinkage void __init start_kernel(void)
598 softirq_init(); 602 softirq_init();
599 timekeeping_init(); 603 timekeeping_init();
600 time_init(); 604 time_init();
605 sched_clock_init();
601 profile_init(); 606 profile_init();
602 if (!irqs_disabled()) 607 if (!irqs_disabled())
603 printk("start_kernel(): bug: interrupts were enabled early\n"); 608 printk("start_kernel(): bug: interrupts were enabled early\n");
@@ -636,6 +641,8 @@ asmlinkage void __init start_kernel(void)
636 enable_debug_pagealloc(); 641 enable_debug_pagealloc();
637 cpu_hotplug_init(); 642 cpu_hotplug_init();
638 kmem_cache_init(); 643 kmem_cache_init();
644 debug_objects_mem_init();
645 idr_init_cache();
639 setup_per_cpu_pageset(); 646 setup_per_cpu_pageset();
640 numa_policy_init(); 647 numa_policy_init();
641 if (late_time_init) 648 if (late_time_init)
@@ -686,63 +693,57 @@ static int __init initcall_debug_setup(char *str)
686} 693}
687__setup("initcall_debug", initcall_debug_setup); 694__setup("initcall_debug", initcall_debug_setup);
688 695
689extern initcall_t __initcall_start[], __initcall_end[]; 696static void __init do_one_initcall(initcall_t fn)
690
691static void __init do_initcalls(void)
692{ 697{
693 initcall_t *call;
694 int count = preempt_count(); 698 int count = preempt_count();
699 ktime_t t0, t1, delta;
700 char msgbuf[64];
701 int result;
695 702
696 for (call = __initcall_start; call < __initcall_end; call++) { 703 if (initcall_debug) {
697 ktime_t t0, t1, delta; 704 print_fn_descriptor_symbol("calling %s\n", fn);
698 char *msg = NULL; 705 t0 = ktime_get();
699 char msgbuf[40]; 706 }
700 int result;
701
702 if (initcall_debug) {
703 printk("Calling initcall 0x%p", *call);
704 print_fn_descriptor_symbol(": %s()",
705 (unsigned long) *call);
706 printk("\n");
707 t0 = ktime_get();
708 }
709 707
710 result = (*call)(); 708 result = fn();
711 709
712 if (initcall_debug) { 710 if (initcall_debug) {
713 t1 = ktime_get(); 711 t1 = ktime_get();
714 delta = ktime_sub(t1, t0); 712 delta = ktime_sub(t1, t0);
715 713
716 printk("initcall 0x%p", *call); 714 print_fn_descriptor_symbol("initcall %s", fn);
717 print_fn_descriptor_symbol(": %s()", 715 printk(" returned %d after %Ld msecs\n", result,
718 (unsigned long) *call); 716 (unsigned long long) delta.tv64 >> 20);
719 printk(" returned %d.\n", result); 717 }
720 718
721 printk("initcall 0x%p ran for %Ld msecs: ", 719 msgbuf[0] = 0;
722 *call, (unsigned long long)delta.tv64 >> 20);
723 print_fn_descriptor_symbol("%s()\n",
724 (unsigned long) *call);
725 }
726 720
727 if (result && result != -ENODEV && initcall_debug) { 721 if (result && result != -ENODEV && initcall_debug)
728 sprintf(msgbuf, "error code %d", result); 722 sprintf(msgbuf, "error code %d ", result);
729 msg = msgbuf; 723
730 } 724 if (preempt_count() != count) {
731 if (preempt_count() != count) { 725 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
732 msg = "preemption imbalance"; 726 preempt_count() = count;
733 preempt_count() = count;
734 }
735 if (irqs_disabled()) {
736 msg = "disabled interrupts";
737 local_irq_enable();
738 }
739 if (msg) {
740 printk(KERN_WARNING "initcall at 0x%p", *call);
741 print_fn_descriptor_symbol(": %s()",
742 (unsigned long) *call);
743 printk(": returned with %s\n", msg);
744 }
745 } 727 }
728 if (irqs_disabled()) {
729 strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
730 local_irq_enable();
731 }
732 if (msgbuf[0]) {
733 print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
734 printk(" returned with %s\n", msgbuf);
735 }
736}
737
738
739extern initcall_t __initcall_start[], __initcall_end[];
740
741static void __init do_initcalls(void)
742{
743 initcall_t *call;
744
745 for (call = __initcall_start; call < __initcall_end; call++)
746 do_one_initcall(*call);
746 747
747 /* Make sure there is no pending stuff from the initcall sequence */ 748 /* Make sure there is no pending stuff from the initcall sequence */
748 flush_scheduled_work(); 749 flush_scheduled_work();
@@ -807,6 +808,8 @@ static int noinline init_post(void)
807 (void) sys_dup(0); 808 (void) sys_dup(0);
808 (void) sys_dup(0); 809 (void) sys_dup(0);
809 810
811 current->signal->flags |= SIGNAL_UNKILLABLE;
812
810 if (ramdisk_execute_command) { 813 if (ramdisk_execute_command) {
811 run_init_process(ramdisk_execute_command); 814 run_init_process(ramdisk_execute_command);
812 printk(KERN_WARNING "Failed to execute %s\n", 815 printk(KERN_WARNING "Failed to execute %s\n",