~ubuntu-branches/ubuntu/lucid/linux-rt/lucid

« back to all changes in this revision

Viewing changes to kernel/trace/trace_boot.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-08-05 23:00:52 UTC
  • Revision ID: james.westby@ubuntu.com-20090805230052-7xedvqcyk9dnnxb2
Tags: 2.6.31-1.1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#include <linux/debugfs.h>
10
10
#include <linux/ftrace.h>
11
11
#include <linux/kallsyms.h>
 
12
#include <linux/time.h>
12
13
 
13
14
#include "trace.h"
 
15
#include "trace_output.h"
14
16
 
15
17
static struct trace_array *boot_trace;
16
18
static bool pre_initcalls_finished;
27
29
 
28
30
void enable_boot_trace(void)
29
31
{
30
 
        if (pre_initcalls_finished)
 
32
        if (boot_trace && pre_initcalls_finished)
31
33
                tracing_start_sched_switch_record();
32
34
}
33
35
 
34
36
void disable_boot_trace(void)
35
37
{
36
 
        if (pre_initcalls_finished)
 
38
        if (boot_trace && pre_initcalls_finished)
37
39
                tracing_stop_sched_switch_record();
38
40
}
39
41
 
42
44
        int cpu;
43
45
        boot_trace = tr;
44
46
 
 
47
        if (!tr)
 
48
                return 0;
 
49
 
45
50
        for_each_cpu(cpu, cpu_possible_mask)
46
51
                tracing_reset(tr, cpu);
47
52
 
63
68
        trace_assign_type(field, entry);
64
69
        call = &field->boot_call;
65
70
        ts = iter->ts;
66
 
        nsec_rem = do_div(ts, 1000000000);
 
71
        nsec_rem = do_div(ts, NSEC_PER_SEC);
67
72
 
68
73
        ret = trace_seq_printf(s, "[%5ld.%09ld] calling  %s @ %i\n",
69
74
                        (unsigned long)ts, nsec_rem, call->func, call->caller);
88
93
        trace_assign_type(field, entry);
89
94
        init_ret = &field->boot_ret;
90
95
        ts = iter->ts;
91
 
        nsec_rem = do_div(ts, 1000000000);
 
96
        nsec_rem = do_div(ts, NSEC_PER_SEC);
92
97
 
93
98
        ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s "
94
99
                        "returned %d after %llu msecs\n",
128
133
{
129
134
        struct ring_buffer_event *event;
130
135
        struct trace_boot_call *entry;
131
 
        unsigned long irq_flags;
132
136
        struct trace_array *tr = boot_trace;
133
137
 
134
 
        if (!pre_initcalls_finished)
 
138
        if (!tr || !pre_initcalls_finished)
135
139
                return;
136
140
 
137
141
        /* Get its name now since this function could
140
144
        sprint_symbol(bt->func, (unsigned long)fn);
141
145
        preempt_disable();
142
146
 
143
 
        event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
144
 
                                         &irq_flags);
 
147
        event = trace_buffer_lock_reserve(tr, TRACE_BOOT_CALL,
 
148
                                          sizeof(*entry), 0, 0);
145
149
        if (!event)
146
150
                goto out;
147
151
        entry   = ring_buffer_event_data(event);
148
 
        tracing_generic_entry_update(&entry->ent, 0, 0);
149
 
        entry->ent.type = TRACE_BOOT_CALL;
150
152
        entry->boot_call = *bt;
151
 
        ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
152
 
 
153
 
        trace_wake_up();
154
 
 
 
153
        trace_buffer_unlock_commit(tr, event, 0, 0);
155
154
 out:
156
155
        preempt_enable();
157
156
}
160
159
{
161
160
        struct ring_buffer_event *event;
162
161
        struct trace_boot_ret *entry;
163
 
        unsigned long irq_flags;
164
162
        struct trace_array *tr = boot_trace;
165
163
 
166
 
        if (!pre_initcalls_finished)
 
164
        if (!tr || !pre_initcalls_finished)
167
165
                return;
168
166
 
169
167
        sprint_symbol(bt->func, (unsigned long)fn);
170
168
        preempt_disable();
171
169
 
172
 
        event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
173
 
                                         &irq_flags);
 
170
        event = trace_buffer_lock_reserve(tr, TRACE_BOOT_RET,
 
171
                                          sizeof(*entry), 0, 0);
174
172
        if (!event)
175
173
                goto out;
176
174
        entry   = ring_buffer_event_data(event);
177
 
        tracing_generic_entry_update(&entry->ent, 0, 0);
178
 
        entry->ent.type = TRACE_BOOT_RET;
179
175
        entry->boot_ret = *bt;
180
 
        ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
181
 
 
182
 
        trace_wake_up();
183
 
 
 
176
        trace_buffer_unlock_commit(tr, event, 0, 0);
184
177
 out:
185
178
        preempt_enable();
186
179
}