X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=init%2Fmain.c;h=e8d080cab443750f7360d50bd32aa0c7644a6a4e;hb=e0863397cb8f3ede356ef2cb7dcdccc9956cdc6d;hp=953500b02ac4136f4ad30aa0ea6b285019234131;hpb=f630fe2817601314b2eb7ca5ddc23c7834646731;p=powerpc.git diff --git a/init/main.c b/init/main.c index 953500b02a..e8d080cab4 100644 --- a/init/main.c +++ b/init/main.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,7 @@ #include #include #include +#include #include #include @@ -81,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); @@ -93,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 @@ -368,12 +369,8 @@ static void __init setup_per_cpu_areas(void) unsigned long nr_possible_cpus = num_possible_cpus(); /* Copy section for each CPU (we discard the original) */ - size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); -#ifdef CONFIG_MODULES - if (size < PERCPU_ENOUGH_ROOM) - size = PERCPU_ENOUGH_ROOM; -#endif - ptr = alloc_bootmem(size * nr_possible_cpus); + size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE); + ptr = alloc_bootmem_pages(size * nr_possible_cpus); for_each_possible_cpu(i) { __per_cpu_offset[i] = ptr - __per_cpu_start; @@ -386,14 +383,14 @@ static void __init setup_per_cpu_areas(void) /* Called by boot processor to activate the rest. */ static void __init smp_init(void) { - unsigned int i; + unsigned int cpu; /* FIXME: This should be done in userspace --RR */ - for_each_present_cpu(i) { + for_each_present_cpu(cpu) { if (num_online_cpus() >= max_cpus) break; - if (!cpu_online(i)) - cpu_up(i); + if (!cpu_online(cpu)) + cpu_up(cpu); } /* Any cleanup work */ @@ -429,8 +426,12 @@ static void __init setup_command_line(char *command_line) static void noinline 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(); /* @@ -652,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; @@ -661,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; @@ -702,11 +720,7 @@ static void __init do_basic_setup(void) init_workqueues(); usermodehelper_init(); driver_init(); - -#ifdef CONFIG_PROC_FS init_irq_proc(); -#endif - do_initcalls(); } @@ -770,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(); /*