Skip to contentSkip to conversation

How to write marker info in MMIO trace from kernel

DISCUSSION Larry Finger 2 participants 5 messages May 4, 2010 – May 5, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Stephen,

I hope you are the correct person for this question.

I would like to write information into the MMIO trace file similar to what the user space write to /sys/.../trace_marker would accomplish, however, I want to do it in place of printk statements in the driver I'm tracing. Do you have any suggestions on how to do this? I have tools to merge the trace dump with dmesg output, but the latter lags behind and I do not get good correlation.

Thanks,

Larry

maintainer
#1 lore raw
Quoted 10 lines · Larry Finger

Stephen,

I hope you are the correct person for this question.

I would like to write information into the MMIO trace file similar to what the user space write to /sys/.../trace_marker would accomplish, however, I want to do it in place of printk statements in the driver I'm tracing. Do you have any suggestions on how to do this? I have tools to merge the trace dump with dmesg output, but the latter lags behind and I do not get good correlation.

You can use "trace_printk()". I think that is what you are looking for.

-- Steve

#2 lore raw
Quoted 5 lines · Steven Rostedt
Quoted 4 lines · Larry Finger

Stephen,

I hope you are the correct person for this question.

Quoted 8 lines
Quoted 6 lines

I would like to write information into the MMIO trace file similar to what the user space write to /sys/.../trace_marker would accomplish, however, I want to do it in place of printk statements in the driver I'm tracing. Do you have any suggestions on how to do this? I have tools to merge the trace dump with dmesg output, but the latter lags behind and I do not get good correlation.

You can use "trace_printk()". I think that is what you are looking for.

Thanks for the info. One other question - when I write only mmiotrace to the current_tracer, the trace_printk() stuff does not end up in the buffer. I can get it by using the "sysprof" tracer, but that has a lot of stuff I do not want. Did I miss some configuration? My list of available tracers is "blk kmemtrace mmiotrace wakeup_rt wakeup function sysprof sched_switch nop".

Thanks,

Larry

maintainer
#3 lore raw
Quoted 6 lines · Larry Finger

Thanks for the info. One other question - when I write only mmiotrace to the current_tracer, the trace_printk() stuff does not end up in the buffer. I can get it by using the "sysprof" tracer, but that has a lot of stuff I do not want. Did I miss some configuration? My list of available tracers is "blk kmemtrace mmiotrace wakeup_rt wakeup function sysprof sched_switch nop".

Ug, that's because the mmiotrace handles its own prints and ignores anything it does not know about. Here, try this patch:

-- Steve

kernel/trace/trace_mmiotrace.c +1 -1
index 017fa37..8652f28 100644
@@ -282,7 +282,7 @@ static enum print_line_t mmio_print_line(struct trace_iterator *iter)
 	case TRACE_PRINT:
 		return mmio_print_mark(iter);
 	default:
-		return TRACE_TYPE_HANDLED; /* ignore unknown entries */
+		return TRACE_TYPE_UNHANDLED;
 	}
 }
 
#4 lore raw
Quoted 19 lines · Steven Rostedt
Quoted 6 lines · Larry Finger

Thanks for the info. One other question - when I write only mmiotrace to the current_tracer, the trace_printk() stuff does not end up in the buffer. I can get it by using the "sysprof" tracer, but that has a lot of stuff I do not want. Did I miss some configuration? My list of available tracers is "blk kmemtrace mmiotrace wakeup_rt wakeup function sysprof sched_switch nop".

Ug, that's because the mmiotrace handles its own prints and ignores anything it does not know about. Here, try this patch:

-- Steve

kernel/trace/trace_mmiotrace.c +0 -0
index 017fa37..8652f28 100644

kernel/trace/trace_mmiotrace.c static enum print_line_t mmio_print_line(struct trace_iterator *iter) · line 287

Quoted 7 lines
kernel/trace/trace_mmiotrace.c +1 -1
@@ -282,7 +282,7 @@ static enum print_line_t mmio_print_line(struct trace_iterator *iter)
 	case TRACE_PRINT:
 		return mmio_print_mark(iter);
 	default:
-		return TRACE_TYPE_HANDLED; /* ignore unknown entries */
+		return TRACE_TYPE_UNHANDLED;
 	}
 }

That did the trick.

Thanks a lot,

Larry