diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-02-05 13:14:13 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-05 19:01:41 -0500 |
commit | 51a763dd84253bab1d0a1e68e11a7753d1b702ca (patch) | |
tree | 2cc2cf0509db480391c585786285267e360c1338 /kernel/trace/trace_mmiotrace.c | |
parent | 0a9877514c4fed10a70720293b37213dd172ee3e (diff) |
tracing: Introduce trace_buffer_{lock_reserve,unlock_commit}
Impact: new API
These new functions do what previously was being open coded, reducing
the number of details ftrace plugin writers have to worry about.
It also standardizes the handling of stacktrace, userstacktrace and
other trace options we may introduce in the future.
With this patch, for instance, the blk tracer (and some others already
in the tree) can use the "userstacktrace" /d/tracing/trace_options
facility.
$ codiff /tmp/vmlinux.before /tmp/vmlinux.after
linux-2.6-tip/kernel/trace/trace.c:
trace_vprintk | -5
trace_graph_return | -22
trace_graph_entry | -26
trace_function | -45
__ftrace_trace_stack | -27
ftrace_trace_userstack | -29
tracing_sched_switch_trace | -66
tracing_stop | +1
trace_seq_to_user | -1
ftrace_trace_special | -63
ftrace_special | +1
tracing_sched_wakeup_trace | -70
tracing_reset_online_cpus | -1
13 functions changed, 2 bytes added, 355 bytes removed, diff: -353
linux-2.6-tip/block/blktrace.c:
__blk_add_trace | -58
1 function changed, 58 bytes removed, diff: -58
linux-2.6-tip/kernel/trace/trace.c:
trace_buffer_lock_reserve | +88
trace_buffer_unlock_commit | +86
2 functions changed, 174 bytes added, diff: +174
/tmp/vmlinux.after:
16 functions changed, 176 bytes added, 413 bytes removed, diff: -237
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Frédéric Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_mmiotrace.c')
-rw-r--r-- | kernel/trace/trace_mmiotrace.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index 104ddebc11d1..c401b908e805 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c | |||
@@ -307,19 +307,17 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, | |||
307 | { | 307 | { |
308 | struct ring_buffer_event *event; | 308 | struct ring_buffer_event *event; |
309 | struct trace_mmiotrace_rw *entry; | 309 | struct trace_mmiotrace_rw *entry; |
310 | int pc = preempt_count(); | ||
310 | 311 | ||
311 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry)); | 312 | event = trace_buffer_lock_reserve(tr, TRACE_MMIO_RW, |
313 | sizeof(*entry), 0, pc); | ||
312 | if (!event) { | 314 | if (!event) { |
313 | atomic_inc(&dropped_count); | 315 | atomic_inc(&dropped_count); |
314 | return; | 316 | return; |
315 | } | 317 | } |
316 | entry = ring_buffer_event_data(event); | 318 | entry = ring_buffer_event_data(event); |
317 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); | ||
318 | entry->ent.type = TRACE_MMIO_RW; | ||
319 | entry->rw = *rw; | 319 | entry->rw = *rw; |
320 | ring_buffer_unlock_commit(tr->buffer, event); | 320 | trace_buffer_unlock_commit(tr, event, 0, pc); |
321 | |||
322 | trace_wake_up(); | ||
323 | } | 321 | } |
324 | 322 | ||
325 | void mmio_trace_rw(struct mmiotrace_rw *rw) | 323 | void mmio_trace_rw(struct mmiotrace_rw *rw) |
@@ -335,19 +333,17 @@ static void __trace_mmiotrace_map(struct trace_array *tr, | |||
335 | { | 333 | { |
336 | struct ring_buffer_event *event; | 334 | struct ring_buffer_event *event; |
337 | struct trace_mmiotrace_map *entry; | 335 | struct trace_mmiotrace_map *entry; |
336 | int pc = preempt_count(); | ||
338 | 337 | ||
339 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry)); | 338 | event = trace_buffer_lock_reserve(tr, TRACE_MMIO_MAP, |
339 | sizeof(*entry), 0, pc); | ||
340 | if (!event) { | 340 | if (!event) { |
341 | atomic_inc(&dropped_count); | 341 | atomic_inc(&dropped_count); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | entry = ring_buffer_event_data(event); | 344 | entry = ring_buffer_event_data(event); |
345 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); | ||
346 | entry->ent.type = TRACE_MMIO_MAP; | ||
347 | entry->map = *map; | 345 | entry->map = *map; |
348 | ring_buffer_unlock_commit(tr->buffer, event); | 346 | trace_buffer_unlock_commit(tr, event, 0, pc); |
349 | |||
350 | trace_wake_up(); | ||
351 | } | 347 | } |
352 | 348 | ||
353 | void mmio_trace_mapping(struct mmiotrace_map *map) | 349 | void mmio_trace_mapping(struct mmiotrace_map *map) |