Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[sfrench/cifs-2.6.git] / init / main.c
index 80f09f31bfabf68c3d6b317c7f0470f14f8bfac7..eb8bdbae4fc79026f8ee4664f34da66c82076c1e 100644 (file)
@@ -54,6 +54,7 @@
 #include <linux/lockdep.h>
 #include <linux/pid_namespace.h>
 #include <linux/device.h>
+#include <linux/kthread.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -82,7 +83,7 @@
 #warning gcc-4.1.0 is known to miscompile the kernel.  A different compiler version is recommended.
 #endif
 
-static int init(void *);
+static int kernel_init(void *);
 
 extern void init_IRQ(void);
 extern void fork_init(unsigned long);
@@ -94,7 +95,6 @@ extern void pidmap_init(void);
 extern void prio_tree_init(void);
 extern void radix_tree_init(void);
 extern void free_initmem(void);
-extern void prepare_namespace(void);
 #ifdef CONFIG_ACPI
 extern void acpi_early_init(void);
 #else
@@ -384,11 +384,6 @@ static void __init setup_per_cpu_areas(void)
 static void __init smp_init(void)
 {
        unsigned int cpu;
-       unsigned highest = 0;
-
-       for_each_cpu_mask(cpu, cpu_possible_map)
-               highest = cpu;
-       nr_cpu_ids = highest + 1;
 
        /* FIXME: This should be done in userspace --RR */
        for_each_present_cpu(cpu) {
@@ -428,11 +423,15 @@ static void __init setup_command_line(char *command_line)
  * gcc-3.4 accidentally inlines this function, so use noinline.
  */
 
-static void noinline rest_init(void)
+static void noinline __init_refok rest_init(void)
        __releases(kernel_lock)
 {
-       kernel_thread(init, NULL, CLONE_FS | CLONE_SIGHAND);
+       int pid;
+
+       kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
        numa_default_policy();
+       pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
+       kthreadd_task = find_task_by_pid(pid);
        unlock_kernel();
 
        /*
@@ -654,6 +653,7 @@ static void __init do_initcalls(void)
        int count = preempt_count();
 
        for (call = __initcall_start; call < __initcall_end; call++) {
+               ktime_t t0, t1, delta;
                char *msg = NULL;
                char msgbuf[40];
                int result;
@@ -663,10 +663,26 @@ static void __init do_initcalls(void)
                        print_fn_descriptor_symbol(": %s()",
                                        (unsigned long) *call);
                        printk("\n");
+                       t0 = ktime_get();
                }
 
                result = (*call)();
 
+               if (initcall_debug) {
+                       t1 = ktime_get();
+                       delta = ktime_sub(t1, t0);
+
+                       printk("initcall 0x%p", *call);
+                       print_fn_descriptor_symbol(": %s()",
+                                       (unsigned long) *call);
+                       printk(" returned %d.\n", result);
+
+                       printk("initcall 0x%p ran for %Ld msecs: ",
+                               *call, (unsigned long long)delta.tv64 >> 20);
+                       print_fn_descriptor_symbol("%s()\n",
+                               (unsigned long) *call);
+               }
+
                if (result && result != -ENODEV && initcall_debug) {
                        sprintf(msgbuf, "error code %d", result);
                        msg = msgbuf;
@@ -768,7 +784,7 @@ static int noinline init_post(void)
        panic("No init found.  Try passing init= option to kernel.");
 }
 
-static int __init init(void * unused)
+static int __init kernel_init(void * unused)
 {
        lock_kernel();
        /*
@@ -785,6 +801,7 @@ static int __init init(void * unused)
         */
        init_pid_ns.child_reaper = current;
 
+       __set_special_pids(1, 1);
        cad_pid = task_pid(current);
 
        smp_prepare_cpus(max_cpus);