]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - init/main.c
Make initcall_debug a core_param
[linux-2.6-omap-h63xx.git] / init / main.c
index 416bca4f734fdec102ebfe22f36922d9e02afd4b..3d68aaaf6160614645cb2c346275aa752dc66d4e 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/gfp.h>
 #include <linux/percpu.h>
 #include <linux/kmod.h>
+#include <linux/vmalloc.h>
 #include <linux/kernel_stat.h>
 #include <linux/start_kernel.h>
 #include <linux/security.h>
@@ -60,6 +61,7 @@
 #include <linux/sched.h>
 #include <linux/signal.h>
 #include <linux/idr.h>
+#include <linux/ftrace.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -391,19 +393,17 @@ EXPORT_SYMBOL(__per_cpu_offset);
 
 static void __init setup_per_cpu_areas(void)
 {
-       unsigned long size, i, old_size;
+       unsigned long size, i;
        char *ptr;
        unsigned long nr_possible_cpus = num_possible_cpus();
 
        /* Copy section for each CPU (we discard the original) */
-       old_size = PERCPU_ENOUGH_ROOM;
-       size = ALIGN(old_size + per_cpu_dyn_array_size(), PAGE_SIZE);
+       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;
                memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
-               per_cpu_alloc_dyn_array(i, ptr + old_size);
                ptr += size;
        }
 }
@@ -538,86 +538,6 @@ void __init __weak thread_info_cache_init(void)
 {
 }
 
-void pre_alloc_dyn_array(void)
-{
-#ifdef CONFIG_HAVE_DYN_ARRAY
-       unsigned long size, phys = 0;
-       struct dyn_array **daa;
-
-       for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) {
-               struct dyn_array *da = *daa;
-
-               size = da->size * (*da->nr);
-               print_fn_descriptor_symbol("dyna_array %s ", da->name);
-               printk(KERN_CONT "size:%#lx nr:%d align:%#lx",
-                       da->size, *da->nr, da->align);
-               *da->name = __alloc_bootmem(size, da->align, phys);
-               phys = virt_to_phys(*da->name);
-               printk(KERN_CONT " ==> [%#lx - %#lx]\n", phys, phys + size);
-
-               if (da->init_work)
-                       da->init_work(da);
-       }
-#endif
-}
-
-unsigned long per_cpu_dyn_array_size(void)
-{
-       unsigned long total_size = 0;
-#ifdef CONFIG_HAVE_DYN_ARRAY
-       unsigned long size;
-       struct dyn_array **daa;
-
-       for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
-               struct dyn_array *da = *daa;
-
-               size = da->size * (*da->nr);
-               print_fn_descriptor_symbol("per_cpu_dyna_array %s ", da->name);
-               printk(KERN_CONT "size:%#lx nr:%d align:%#lx\n",
-                       da->size, *da->nr, da->align);
-               total_size += roundup(size, da->align);
-       }
-       if (total_size)
-               printk(KERN_DEBUG "per_cpu_dyna_array total_size: %#lx\n",
-                        total_size);
-#endif
-       return total_size;
-}
-
-void per_cpu_alloc_dyn_array(int cpu, char *ptr)
-{
-#ifdef CONFIG_HAVE_DYN_ARRAY
-       unsigned long size, phys;
-       struct dyn_array **daa;
-       unsigned long addr;
-       void **array;
-
-       phys = virt_to_phys(ptr);
-
-       for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
-               struct dyn_array *da = *daa;
-
-               size = da->size * (*da->nr);
-               print_fn_descriptor_symbol("per_cpu_dyna_array %s ", da->name);
-               printk(KERN_CONT "size:%#lx nr:%d align:%#lx",
-                       da->size, *da->nr, da->align);
-
-               phys = roundup(phys, da->align);
-               addr = (unsigned long)da->name;
-               addr += per_cpu_offset(cpu);
-               array = (void **)addr;
-               *array = phys_to_virt(phys);
-               *da->name = *array; /* so init_work could use it directly */
-               printk(KERN_CONT " %p ==> [%#lx - %#lx]\n", array, phys, phys + size);
-               phys += size;
-
-               if (da->init_work) {
-                       da->init_work(da);
-               }
-       }
-#endif
-}
-
 asmlinkage void __init start_kernel(void)
 {
        char * command_line;
@@ -649,7 +569,6 @@ asmlinkage void __init start_kernel(void)
        printk(KERN_NOTICE);
        printk(linux_banner);
        setup_arch(&command_line);
-       pre_alloc_dyn_array();
        mm_init_owner(&init_mm, &init_task);
        setup_command_line(command_line);
        unwind_setup();
@@ -725,6 +644,7 @@ asmlinkage void __init start_kernel(void)
                initrd_start = 0;
        }
 #endif
+       vmalloc_init();
        vfs_caches_init_early();
        cpuset_init_early();
        mem_init();
@@ -770,46 +690,43 @@ asmlinkage void __init start_kernel(void)
 
        acpi_early_init(); /* before LAPIC and SMP init */
 
+       ftrace_init();
+
        /* Do the rest non-__init'ed, we're now alive */
        rest_init();
 }
 
 static int initcall_debug;
-
-static int __init initcall_debug_setup(char *str)
-{
-       initcall_debug = 1;
-       return 1;
-}
-__setup("initcall_debug", initcall_debug_setup);
+core_param(initcall_debug, initcall_debug, bool, 0644);
 
 int do_one_initcall(initcall_t fn)
 {
        int count = preempt_count();
-       ktime_t t0, t1, delta;
+       ktime_t delta;
        char msgbuf[64];
-       int result;
+       struct boot_trace it;
 
        if (initcall_debug) {
-               printk("calling  %pF @ %i\n", fn, task_pid_nr(current));
-               t0 = ktime_get();
+               it.caller = task_pid_nr(current);
+               printk("calling  %pF @ %i\n", fn, it.caller);
+               it.calltime = ktime_get();
        }
 
-       result = fn();
+       it.result = fn();
 
        if (initcall_debug) {
-               t1 = ktime_get();
-               delta = ktime_sub(t1, t0);
-
-               printk("initcall %pF returned %d after %Ld msecs\n",
-                       fn, result,
-                       (unsigned long long) delta.tv64 >> 20);
+               it.rettime = ktime_get();
+               delta = ktime_sub(it.rettime, it.calltime);
+               it.duration = (unsigned long long) delta.tv64 >> 10;
+               printk("initcall %pF returned %d after %Ld usecs\n", fn,
+                       it.result, it.duration);
+               trace_boot(&it, fn);
        }
 
        msgbuf[0] = 0;
 
-       if (result && result != -ENODEV && initcall_debug)
-               sprintf(msgbuf, "error code %d ", result);
+       if (it.result && it.result != -ENODEV && initcall_debug)
+               sprintf(msgbuf, "error code %d ", it.result);
 
        if (preempt_count() != count) {
                strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
@@ -823,7 +740,7 @@ int do_one_initcall(initcall_t fn)
                printk("initcall %pF returned with %s\n", fn, msgbuf);
        }
 
-       return result;
+       return it.result;
 }
 
 
@@ -938,6 +855,7 @@ static int __init kernel_init(void * unused)
        smp_prepare_cpus(setup_max_cpus);
 
        do_pre_smp_initcalls();
+       start_boot_trace();
 
        smp_init();
        sched_init_smp();
@@ -964,6 +882,7 @@ static int __init kernel_init(void * unused)
         * we're essentially up and running. Get rid of the
         * initmem segments and start the user-mode stuff..
         */
+       stop_boot_trace();
        init_post();
        return 0;
 }