Tracing/ftrace: Adapt mmiotrace to the new type of print_line
Subsystems (2)
PATCH v2 3/4 Tracing/ftrace: Adapt mmiotrace to the new type of print_line
Adapt mmiotrace to the new print_line type.
By default, it ignores (and consumes) types it doesn't support.
--- kernel/trace/trace_mmiotrace.c | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-)
kernel/trace/trace_mmiotrace.c +12 -13
@@ -171,7 +171,7 @@ print_out:return (ret == -EBUSY ) ?0 : ret; } -static int mmio_print_rw (struct trace_iterator *iter) +static enum print_line_t mmio_print_rw (struct trace_iterator *iter) {struct trace_entry *entry = iter->ent;struct mmiotrace_rw *rw = &entry->field.mmiorw;
@@ -209,11 +209,11 @@ static int mmio_print_rw(struct trace_iterator *iter)break ; }if (ret) -return 1 ; -return 0 ; +return TRACE_TYPE_HANDLED ; +return TRACE_TYPE_PARTIAL_LINE ; } -static int mmio_print_map (struct trace_iterator *iter) +static enum print_line_t mmio_print_map (struct trace_iterator *iter) {struct trace_entry *entry = iter->ent;struct mmiotrace_map *m = &entry->field.mmiomap;
@@ -221,7 +221,7 @@ static int mmio_print_map(struct trace_iterator *iter)unsigned long long t =ns2usecs (entry->field.t);unsigned long usec_rem =do_div (t,1000000ULL );unsigned secs = (unsigned long )t; -int ret =1 ; +int ret;switch (entry->field.mmiorw.opcode) {case MMIO_PROBE :
@@ -241,11 +241,11 @@ static int mmio_print_map(struct trace_iterator *iter)break ; }if (ret) -return 1 ; -return 0 ; +return TRACE_TYPE_HANDLED ; +return TRACE_TYPE_PARTIAL_LINE ; } -static int mmio_print_mark (struct trace_iterator *iter) +static enum print_line_t mmio_print_mark (struct trace_iterator *iter) {struct trace_entry *entry = iter->ent;const char *msg = entry->field.print.buf;
@@ -258,16 +258,15 @@ static int mmio_print_mark(struct trace_iterator *iter)/* The trailing newline must be in the message. */ ret =trace_seq_printf (s,"MARK %lu.%06lu %s" , secs, usec_rem, msg);if (!ret) -return 0 ; +return TRACE_TYPE_PARTIAL_LINE ;if (entry->field.flags &TRACE_FLAG_CONT )trace_seq_print_cont (s, iter); -return 1 ; +return TRACE_TYPE_HANDLED ; } -/* return 0 to abort printing without consuming current entry in pipe mode */ -static int mmio_print_line (struct trace_iterator *iter) +static enum print_line_t mmio_print_line (struct trace_iterator *iter) {switch (iter->ent->type) {case TRACE_MMIO_RW :
@@ -277,7 +276,7 @@ static int mmio_print_line(struct trace_iterator *iter)case TRACE_PRINT :return mmio_print_mark (iter);default : -return 1 ;/* ignore unknown entries */ +return TRACE_TYPE_HANDLED ;/* ignore unknown entries */ } }
Quoted 5 lines · On Mon, 29 Sep 2008 20:27:42 +0200 Frederic Weisbecker <[email protected]>…
Adapt mmiotrace to the new
print_linetype.
By default, it ignores (and consumes) types it doesn't support.Acked-by Pekka Paalanen <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>
Ack!
All four patches looking good.
Cheers.
Quoted 86 lines
--- kernel/trace/trace_mmiotrace.c | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-)kernel/trace/trace_mmiotrace.c +12
-13@@ -171,7 +171,7 @@ print_out:return (ret == -EBUSY ) ?0 : ret; } -static int mmio_print_rw (struct trace_iterator *iter) +static enum print_line_t mmio_print_rw (struct trace_iterator *iter) {struct trace_entry *entry = iter->ent;struct mmiotrace_rw *rw = &entry->field.mmiorw;@@ -209,11 +209,11 @@ static int mmio_print_rw(struct trace_iterator *iter)break ; }if (ret) -return 1 ; -return 0 ; +return TRACE_TYPE_HANDLED ; +return TRACE_TYPE_PARTIAL_LINE ; } -static int mmio_print_map (struct trace_iterator *iter) +static enum print_line_t mmio_print_map (struct trace_iterator *iter) {struct trace_entry *entry = iter->ent;struct mmiotrace_map *m = &entry->field.mmiomap;@@ -221,7 +221,7 @@ static int mmio_print_map(struct trace_iterator *iter)unsigned long long t =ns2usecs (entry->field.t);unsigned long usec_rem =do_div (t,1000000ULL );unsigned secs = (unsigned long )t; -int ret =1 ; +int ret;switch (entry->field.mmiorw.opcode) {case MMIO_PROBE :@@ -241,11 +241,11 @@ static int mmio_print_map(struct trace_iterator *iter)break ; }if (ret) -return 1 ; -return 0 ; +return TRACE_TYPE_HANDLED ; +return TRACE_TYPE_PARTIAL_LINE ; } -static int mmio_print_mark (struct trace_iterator *iter) +static enum print_line_t mmio_print_mark (struct trace_iterator *iter) {struct trace_entry *entry = iter->ent;const char *msg = entry->field.print.buf;@@ -258,16 +258,15 @@ static int mmio_print_mark(struct trace_iterator *iter)/* The trailing newline must be in the message. */ ret =trace_seq_printf (s,"MARK %lu.%06lu %s" , secs, usec_rem, msg);if (!ret) -return 0 ; +return TRACE_TYPE_PARTIAL_LINE ;if (entry->field.flags &TRACE_FLAG_CONT )trace_seq_print_cont (s, iter); -return 1 ; +return TRACE_TYPE_HANDLED ; } -/* return 0 to abort printing without consuming current entry in pipe mode */ -static int mmio_print_line (struct trace_iterator *iter) +static enum print_line_t mmio_print_line (struct trace_iterator *iter) {switch (iter->ent->type) {case TRACE_MMIO_RW :@@ -277,7 +276,7 @@ static int mmio_print_line(struct trace_iterator *iter)case TRACE_PRINT :return mmio_print_mark (iter);default : -return 1 ;/* ignore unknown entries */ +return TRACE_TYPE_HANDLED ;/* ignore unknown entries */ } }
Signature · 2 lines
Pekka Paalanen http://www.iki.fi/pq/
Quoted 11 lines · Pekka Paalanen
Quoted 5 lines · On Mon, 29 Sep 2008 20:27:42 +0200 Frederic Weisbecker <[email protected]>…
Adapt mmiotrace to the new
print_linetype.
By default, it ignores (and consumes) types it doesn't support.Acked-by Pekka Paalanen <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>Ack!
All four patches looking good.
thanks guys!
Steve's latest trace-ringbuffer code against -tip complicates life a little bit.
We dont yet know whether tip/tracing/ring-buffer is ready for wider consumption, so it's in a separate feature branch. These four patches conflict with the ring-buffer code quite widely.
So ... i did an optimistic merge approach: i merged these 4 patches ontop of the new tip/tracing/ring-buffer code, and have put it into a new tip/tracing/pipe branch:
# f19d495: tracing/ftrace: adapt the boot tracer to the new print_line type # 92261f6: tracing/ftrace: adapt mmiotrace to the new type of print_line # 157190e: tracing/ftrace: fix pipe breaking
# 92e359a: tracing/ftrace: change the type of the print_line callback
i'm merging this into tip/master for a bit of testing, but if it breaks something (or if i havent pushed it out yet) you can merge it locally too, by doing this ontop of tip/master:
git-merge tip/tracing/pipe
it should merge up cleanly and you should be able to check the end result. (and send me any fixes for merge mistakes)
( Once it's all in reasonably well-tested shape it will all show up in
tip/master and you can stop dealing with tip/tracing/* sub-branches.)
Ingo
2008/9/30 Ingo Molnar <[email protected]>:
Quoted 24 lines
thanks guys!
Steve's latest trace-ringbuffer code against -tip complicates life a little bit.
We dont yet know whether tip/tracing/ring-buffer is ready for wider consumption, so it's in a separate feature branch. These four patches conflict with the ring-buffer code quite widely.
So ... i did an optimistic merge approach: i merged these 4 patches ontop of the new tip/tracing/ring-buffer code, and have put it into a new tip/tracing/pipe branch:
# f19d495: tracing/ftrace: adapt the boot tracer to the new
print_linetype # 92261f6: tracing/ftrace: adapt mmiotrace to the new type ofprint_line# 157190e: tracing/ftrace: fix pipe breaking
# 92e359a: tracing/ftrace: change the type of theprint_linecallbacki'm merging this into tip/master for a bit of testing, but if it breaks something (or if i havent pushed it out yet) you can merge it locally too, by doing this ontop of tip/master:
git-merge tip/tracing/pipe
Quoted 8 lines
it should merge up cleanly and you should be able to check the end result. (and send me any fixes for merge mistakes)
( Once it's all in reasonably well-tested shape it will all show up in
tip/master and you can stop dealing with tip/tracing/* sub-branches.)Ingo
Thanks Ingo.
I'm currently testing tip/master, since tracing/pipe is merged into. It seems there are some locking issues that I hadn't when I tested the patches. Perhaps it's because of the merge with the new ring buffer.
I just launched the sched_switch tracer and it worked well until 4 seconds of execution. And after that it blocked.
I tested too a marker message adding and it is never displayed. Worse:
I can't break the pipe with Ctrl + C after that.
When I will have some time, I will try to debug all what I find.
Steven Rostedt
maintainerQuoted 7 lines · Fr?d?ric Weisbecker
Thanks Ingo.
I'm currently testing tip/master, since tracing/pipe is merged into. It seems there are some locking issues that I hadn't when I tested the patches. Perhaps it's because of the merge with the new ring buffer.
Quoted 7 lines
I just launched the
sched_switchtracer and it worked well until 4 seconds of execution. And after that it blocked.
I tested too a marker message adding and it is never displayed. Worse:
I can't break the pipe with Ctrl + C after that.When I will have some time, I will try to debug all what I find.
OK, I'll nuke the ring_buffer_lock :-/
The trace_pipe calls that and then calls print_trace_line which will eventually lock the buffer again. This is a bug on my part. I'll fix that today.
Thanks,
-- Steve
2008/9/30 Steven Rostedt <[email protected]>:
Quoted 8 lines
OK, I'll nuke the
ring_buffer_lock:-/The
trace_pipecalls that and then callsprint_trace_linewhich will eventually lock the buffer again. This is a bug on my part. I'll fix that today.Thanks,
Strange, I can't see any case where print_trace_line could call the ring_buffer_lock.
Hmm, I will see in your patch.
Ingo, I just saw one damage from the merging, trace_empty() returns TRACE_TYPE_HANDLED. The type is wrong, it should return 1. It's not urgent since the value is the same. Should I send a patch for such a small error?
Thanks.
Steven Rostedt
maintainerQuoted 8 lines · Fr?d?ric Weisbecker
2008/9/30 Steven Rostedt <[email protected]>:
Quoted 7 lines
OK, I'll nuke the
ring_buffer_lock:-/The
trace_pipecalls that and then callsprint_trace_linewhich will eventually lock the buffer again. This is a bug on my part. I'll fix that today.
Quoted 5 lines
Quoted 1 line
Thanks,
Strange, I can't see any case where
print_trace_linecould call thering_buffer_lock.
Hmm, I will see in your patch.
Opps, I mean the find_next_entry_inc will do the lock.
The ring_buffer_lock locks all CPU buffers, and the find_next_entry_inc will read from the ring buffer which will also lock the buffer. Hence a deadlock.
-- Steve
Quoted 5 lines
Ingo, I just saw one damage from the merging,
trace_empty()returnsTRACE_TYPE_HANDLED. The type is wrong, it should return 1. It's not urgent since the value is the same. Should I send a patch for such a small error?
Quoted 10 lines · Frédéric Weisbecker
2008/9/30 Steven Rostedt <[email protected]>:
Quoted 8 lines
OK, I'll nuke the
ring_buffer_lock:-/The
trace_pipecalls that and then callsprint_trace_linewhich will eventually lock the buffer again. This is a bug on my part. I'll fix that today.Thanks,
Quoted 8 lines
Strange, I can't see any case where
print_trace_linecould call thering_buffer_lock.
Hmm, I will see in your patch.Ingo, I just saw one damage from the merging,
trace_empty()returnsTRACE_TYPE_HANDLED. The type is wrong, it should return 1. It's not urgent since the value is the same. Should I send a patch for such a small error?
yes, please do. One too many patch is far better than one too few ;-)
Ingo
Quoted 14 lines · Ingo Molnar
Quoted 12 lines · Frédéric Weisbecker
2008/9/30 Steven Rostedt <[email protected]>:
Quoted 7 lines
OK, I'll nuke the
ring_buffer_lock:-/The
trace_pipecalls that and then callsprint_trace_linewhich will eventually lock the buffer again. This is a bug on my part. I'll fix that today.Thanks,
Strange, I can't see any case where
print_trace_linecould call thering_buffer_lock.
Hmm, I will see in your patch.
Quoted 9 lines
Quoted 4 lines
Ingo, I just saw one damage from the merging,
trace_empty()returnsTRACE_TYPE_HANDLED. The type is wrong, it should return 1. It's not urgent since the value is the same. Should I send a patch for such a small error?yes, please do. One too many patch is far better than one too few ;-)
Ingo
:)
Here it is!
Subject: [PATCH -tip] Tracing/ftrace: correct return value of trace_empty
Correct the value's type of trace_empty function
---
kernel/trace/trace.c +1 -1
@@ -1686,7 +1686,7 @@ static int trace_empty(struct trace_iterator *iter)if (!ring_buffer_iter_empty (iter->buffer_iter[cpu]))return 0 ; } -return TRACE_TYPE_HANDLED ; +return 1 ; }static enum print_line_t print_trace_line (struct trace_iterator *iter)
kernel/trace/trace.c +1 -1
@@ -1686,7 +1686,7 @@ static int trace_empty(struct trace_iterator *iter)if (!ring_buffer_iter_empty (iter->buffer_iter[cpu]))return 0 ; } -return TRACE_TYPE_HANDLED ; +return 1 ; }static enum print_line_t print_trace_line (struct trace_iterator *iter)
Oops sorry...
Cut in the middle....
2008/9/30 Frederic Weisbecker <[email protected]>:
Quoted 64 lines
Quoted 14 lines · Ingo Molnar
Quoted 12 lines · Frédéric Weisbecker
2008/9/30 Steven Rostedt <[email protected]>:
Quoted 7 lines
OK, I'll nuke the
ring_buffer_lock:-/The
trace_pipecalls that and then callsprint_trace_linewhich will eventually lock the buffer again. This is a bug on my part. I'll fix that today.Thanks,
Strange, I can't see any case where
print_trace_linecould call thering_buffer_lock.
Hmm, I will see in your patch.Quoted 9 lines
Quoted 4 lines
Ingo, I just saw one damage from the merging,
trace_empty()returnsTRACE_TYPE_HANDLED. The type is wrong, it should return 1. It's not urgent since the value is the same. Should I send a patch for such a small error?yes, please do. One too many patch is far better than one too few ;-)
Ingo
:)
Here it is!
Subject: [PATCH -tip] Tracing/ftrace: correct return value of
trace_emptyCorrect the value's type of
trace_emptyfunctionSigned-off-by Frederic Weisbecker <[email protected]>---
kernel/trace/trace.c +1
-1@@ -1686,7 +1686,7 @@ static int trace_empty(struct trace_iterator *iter)if (!ring_buffer_iter_empty (iter->buffer_iter[cpu]))return 0 ; } -return TRACE_TYPE_HANDLED ; +return 1 ; }static enum print_line_t print_trace_line (struct trace_iterator *iter)kernel/trace/trace.c +1
-1@@ -1686,7 +1686,7 @@ static int trace_empty(struct trace_iterator *iter)if (!ring_buffer_iter_empty (iter->buffer_iter[cpu]))return 0 ; } -return TRACE_TYPE_HANDLED ; +return 1 ; }static enum print_line_t print_trace_line (struct trace_iterator *iter)
Quoted 11 lines · Frederic Weisbecker
Subject: [PATCH -tip] Tracing/ftrace: correct return value of
trace_emptyCorrect the value's type of
trace_emptyfunctionSigned-off-by Frederic Weisbecker <[email protected]>---
kernel/trace/trace.c +0
-0
kernel/trace/trace.c static int trace_empty(struct trace_iterator *iter) · line 1689
Quoted 5 lines
kernel/trace/trace.c +1
-1@@ -1686,7 +1686,7 @@ static int trace_empty(struct trace_iterator *iter)if (!ring_buffer_iter_empty (iter->buffer_iter[cpu]))return 0 ; } -return TRACE_TYPE_HANDLED ; +return 1 ;
applied the commit below to tip/tracing/ring-buffer, thanks Frederic! (had to do manual merging due to flux in that function due to the locking changes - please double-check that i got it right.)
btw., we still have the mmiotrace type casting buglet unfixed:
kernel/trace/trace.c static int trace_empty(struct trace_iterator *iter) · line 1692
Quoted 3 lines
kernel/trace/trace.c +0
-0> > struct trace_entry *entry = iter->ent; > > - struct mmiotrace_map *m = &entry->field.mmiomap; > > + struct mmiotrace_map *m = (struct mmiotrace_map *)entry;
Ingo
------------>
Quoted 1 line
From
a2e221682b91ff83dc8a5e7fbb60a9d87a4e83f2Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <[email protected]>
Date: Tue, 30 Sep 2008 18:13:45 +0200
Subject: [PATCH] tracing/ftrace: Adapt mmiotrace to the new type of print_line, fix
Correct the value's type of trace_empty function
--- kernel/trace/trace.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace.c +1 -1
@@ -1750,7 +1750,7 @@ static int trace_empty(struct trace_iterator *iter) } } -return TRACE_TYPE_HANDLED ; +return 1 ; }static enum print_line_t print_trace_line (struct trace_iterator *iter)