Skip to contentSkip to conversation

Tracing/ftrace: Launch initcall tracing after pre-smp initcalls.

PATCH In review Frédéric Weisbecker 1 participant 1 message Sep 23, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 Tracing/ftrace: Launch initcall tracing after pre-smp initcalls.

Launch the initcall tracing inside the initcall_debug area. Old printk have not been removed to keep the old way of initcall tracing for backward compatibility.

---

init/main.c +9 -3
index a9e36fb..a90d4f5 100644
@@ -724,9 +724,12 @@ int do_one_initcall(initcall_t fn)
 	ktime_t t0, t1, delta;
 	char msgbuf[64];
 	int result;
+	struct initcall_trace it;
 
 	if (initcall_debug) {
-		printk("calling  %pF @ %i\n", fn, task_pid_nr(current));
+		it.caller = task_pid_nr(current);
+		it.func = fn;
+		printk("calling  %pF @ %i\n", fn, it.caller);
 		t0 = ktime_get();
 	}
 
@@ -735,9 +738,11 @@ int do_one_initcall(initcall_t fn)
 	if (initcall_debug) {
 		t1 = ktime_get();
 		delta = ktime_sub(t1, t0);
-
+		it.result = result;
+		it.duration = (unsigned long long) delta.tv64 >> 20;
 		printk("initcall %pF returned %d after %Ld msecs\n", fn,
-			result, (unsigned long long) delta.tv64 >> 20);
+			result, it.duration);
+		trace_initcall(&it);
 	}
 
 	msgbuf[0] = 0;
@@ -947,6 +952,7 @@ static int __init kernel_init(void * unused)
 	smp_prepare_cpus(setup_max_cpus);
 
 	do_pre_smp_initcalls();
+	start_initcall_trace();
 
 	smp_init();
 	sched_init_smp();