diff options
Diffstat (limited to 'init/main.c')
| -rw-r--r-- | init/main.c | 36 | 
1 files changed, 22 insertions, 14 deletions
diff --git a/init/main.c b/init/main.c index 27f6bf6108e..3e17a3bafe6 100644 --- a/init/main.c +++ b/init/main.c @@ -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> @@ -642,6 +644,7 @@ asmlinkage void __init start_kernel(void)  		initrd_start = 0;  	}  #endif +	vmalloc_init();  	vfs_caches_init_early();  	cpuset_init_early();  	mem_init(); @@ -687,6 +690,8 @@ 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();  } @@ -703,30 +708,31 @@ __setup("initcall_debug", initcall_debug_setup);  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)); @@ -740,7 +746,7 @@ int do_one_initcall(initcall_t fn)  		printk("initcall %pF returned with %s\n", fn, msgbuf);  	} -	return result; +	return it.result;  } @@ -855,6 +861,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(); @@ -881,6 +888,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;  }  |