hi, updates based on comments by Frederic Weisbecker, also rebase to latest master. I'm sending reworked version of the graph output support for preemptirqsoff/preemptoff/irqsoff tracers. v6: - using stubs instead of ifdef in trace_irqsoff for graph tracer's calls v5: - function graph events are back in game - changed function graph tracer interface to be able to pass custom tracer flags - changed calls to trace_function to trace graph records when the display-graph otion is enabled. As function tracer and graph tracer have different spacing during the record output, this way it looks better, and the info stays. This could be also done via TRACE_PRINT, then it'd be displayed as comment.. I chose the first way, though it could be easily changed. v4: - fixed header to display all the info as for current irqsoff tracer - fixed reset of the max_tr buffer during the display-graph switch v3: - the function_graph tracer should have the same output as current version even with events enabled, unless I missed something again ;) - I gave up the idea of function_graph events, since it was unsuitable for outputing other events as comments "/* */" - I'm not including the raw function_graph for now attached patches: - 1/4 adding ftrace events for graph tracer - 2/4 graph tracer - adding support for passing flags to ouput functions - 3/4 graph output support for irqsoff tracer - 4/4 graph output support for preemptirqsoff/preemptoff tracers plz let me know what you think wbr, jirka --- --
hi,
this patch adds ftrace events for graph tracer, so the graph output
could be shared within other tracers.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/trace_functions_graph.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index e6989d9..75aa144 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -39,7 +39,7 @@ struct fgraph_data {
#define TRACE_GRAPH_PRINT_OVERHEAD 0x4
#define TRACE_GRAPH_PRINT_PROC 0x8
#define TRACE_GRAPH_PRINT_DURATION 0x10
-#define TRACE_GRAPH_PRINT_ABS_TIME 0X20
+#define TRACE_GRAPH_PRINT_ABS_TIME 0x20
static struct tracer_opt trace_opts[] = {
/* Display overruns? (for self-debug purpose) */
@@ -1094,6 +1094,12 @@ print_graph_function(struct trace_iterator *iter)
return TRACE_TYPE_HANDLED;
}
+static enum print_line_t
+print_graph_function_event(struct trace_iterator *iter, int flags)
+{
+ return print_graph_function(iter);
+}
+
static void print_lat_header(struct seq_file *s)
{
static const char spaces[] = " " /* 16 spaces */
@@ -1197,6 +1203,16 @@ static void graph_trace_close(struct trace_iterator *iter)
}
}
+static struct trace_event graph_trace_entry_event = {
+ .type = TRACE_GRAPH_ENT,
+ .trace = print_graph_function_event,
+};
+
+static struct trace_event graph_trace_ret_event = {
+ .type = TRACE_GRAPH_RET,
+ .trace = print_graph_function_event,
+};
+
static struct tracer graph_trace __read_mostly = {
.name = "function_graph",
.open = graph_trace_open,
@@ -1218,6 +1234,16 @@ static __init int init_graph_trace(void)
{
max_bytes_for_cpu = snprintf(NULL, 0, "%d", nr_cpu_ids - 1);
+ if (!register_ftrace_event(&graph_trace_entry_event)) {
+ pr_warning("Warning: could not register graph trace events\n");
+ return 1;
+ }
+
+ if ...Commit-ID: 9106b69382912ddc403a307b69bf894a6f3004e4 Gitweb: http://git.kernel.org/tip/9106b69382912ddc403a307b69bf894a6f3004e4 Author: Jiri Olsa <jolsa@redhat.com> AuthorDate: Fri, 2 Apr 2010 19:01:20 +0200 Committer: Steven Rostedt <rostedt@goodmis.org> CommitDate: Mon, 26 Apr 2010 16:55:08 -0400 tracing: Add ftrace events for graph tracer Add ftrace events for graph tracer, so the graph output could be shared with other tracers. Signed-off-by: Jiri Olsa <jolsa@redhat.com> LKML-Reference: <1270227683-14631-2-git-send-email-jolsa@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_functions_graph.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 669b9c3..db9e06b 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -40,7 +40,7 @@ struct fgraph_data { #define TRACE_GRAPH_PRINT_OVERHEAD 0x4 #define TRACE_GRAPH_PRINT_PROC 0x8 #define TRACE_GRAPH_PRINT_DURATION 0x10 -#define TRACE_GRAPH_PRINT_ABS_TIME 0X20 +#define TRACE_GRAPH_PRINT_ABS_TIME 0x20 static struct tracer_opt trace_opts[] = { /* Display overruns? (for self-debug purpose) */ @@ -1096,6 +1096,12 @@ print_graph_function(struct trace_iterator *iter) return TRACE_TYPE_HANDLED; } +static enum print_line_t +print_graph_function_event(struct trace_iterator *iter, int flags) +{ + return print_graph_function(iter); +} + static void print_lat_header(struct seq_file *s) { static const char spaces[] = " " /* 16 spaces */ @@ -1199,6 +1205,16 @@ static void graph_trace_close(struct trace_iterator *iter) } } +static struct trace_event graph_trace_entry_event = { + .type = TRACE_GRAPH_ENT, + .trace = print_graph_function_event, +}; + +static struct trace_event graph_trace_ret_event = { + .type = TRACE_GRAPH_RET, + .trace = ...
hi, adding support for graph output for preemptirqsoff/preemptoff tracers. wbr, jirka Signed-off-by: Jiri Olsa <jolsa@redhat.com> --- kernel/trace/trace_irqsoff.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index cc20d7c..6fd486e 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c @@ -672,9 +672,15 @@ static struct tracer preemptoff_tracer __read_mostly = .start = irqsoff_tracer_start, .stop = irqsoff_tracer_stop, .print_max = 1, + .print_header = irqsoff_print_header, + .print_line = irqsoff_print_line, + .flags = &tracer_flags, + .set_flag = irqsoff_set_flag, #ifdef CONFIG_FTRACE_SELFTEST .selftest = trace_selftest_startup_preemptoff, #endif + .open = irqsoff_trace_open, + .close = irqsoff_trace_close, }; # define register_preemptoff(trace) register_tracer(&trace) #else @@ -700,9 +706,15 @@ static struct tracer preemptirqsoff_tracer __read_mostly = .start = irqsoff_tracer_start, .stop = irqsoff_tracer_stop, .print_max = 1, + .print_header = irqsoff_print_header, + .print_line = irqsoff_print_line, + .flags = &tracer_flags, + .set_flag = irqsoff_set_flag, #ifdef CONFIG_FTRACE_SELFTEST .selftest = trace_selftest_startup_preemptirqsoff, #endif + .open = irqsoff_trace_open, + .close = irqsoff_trace_close, }; # define register_preemptirqsoff(trace) register_tracer(&trace) -- 1.6.6.1 --
So far I like the series. But I'm confused why this patch is separate from patch 3. Is there some reason for it? If not, I'll just merge this into patch 3 --
no particular reason, just wanted to separate the graph support for single tracer... I have no problem with merging those 2 --
hi,
when I was using irqsoff tracer, I thought it could be any use
to see the disabled IRQs flow output same way as function graph output.
The graph output is enabled by setting new 'display-graph' trace option
of irqsoff tracer.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
include/linux/ftrace.h | 15 ++-
kernel/trace/trace.c | 35 +++--
kernel/trace/trace.h | 21 +++
kernel/trace/trace_functions_graph.c | 15 ++-
kernel/trace/trace_irqsoff.c | 259 ++++++++++++++++++++++++++++++++--
5 files changed, 312 insertions(+), 33 deletions(-)
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index cc12b3c..205beae 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -352,6 +352,10 @@ struct ftrace_graph_ret {
int depth;
};
+/* Type of the callback handlers for tracing function graph*/
+typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
+typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
+
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
/* for init task */
@@ -400,10 +404,6 @@ extern char __irqentry_text_end[];
#define FTRACE_RETFUNC_DEPTH 50
#define FTRACE_RETSTACK_ALLOC_SIZE 32
-/* Type of the callback handlers for tracing function graph*/
-typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
-typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
-
extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
trace_func_graph_ent_t entryfunc);
@@ -441,6 +441,13 @@ static inline void unpause_graph_tracing(void)
static inline void ftrace_graph_init_task(struct task_struct *t) { }
static inline void ftrace_graph_exit_task(struct task_struct *t) { }
+static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
+ trace_func_graph_ent_t entryfunc)
+{
+ return -1;
+}
+static inline void unregister_ftrace_graph(void) { ...Why not having ABS_TIME in any case? And more important, you probably want to add TRACE_ITER_LATENCY_FMT as well to get the contexts (need-resched, hardirq/softirq, preempt-depth, Same here. Other than these few comments, the whole set looks good! Thanks! --
hi, latency info The latency info is governed by global 'trace_flags', the graph tracers follows that as well. absolute time The idea was to follow the current irqsoff function trace format. Though it cannot be exatly the same, it can print the same info. By default I added TRACE_GRAPH_PRINT_CPU and TRACE_GRAPH_PRINT_PROC, since they are always there for current irqsoff trace. Then the absolute time is printed only in the case when the latency info is switched off. AFAICS the 'time' field in the output (for latency enabled) actually represents the duration (computed/printed in trace_print_lat_context function). Hence I added TRACE_GRAPH_PRINT_DURATION to graph output for the latency case. So the answer to your question is, the absolute time is not part of the output, since it's not part of the original trace output. My opinion is the absolute time is not be that important for this tracer, the duration is. latency output OFF: current tracer: TASK-PID CPU# TIMESTAMP FUNCTION graph tracer: TIME CPU TASK/PID FUNCTION CALLS latency output ON: current tracer: _------=> CPU# / _-----=> irqs-off | / _----=> need-resched || / _---=> hardirq/softirq ||| / _--=> preempt-depth |||| /_--=> lock-depth |||||/ delay cmd pid |||||| time | caller \\ / |||||| \\ | / graph tracer: _-----=> irqs-off / _----=> need-resched | / _---=> hardirq/softirq || / _--=> preempt-depth ||| / _-=> lock-depth |||| / CPU TASK/PID ||||| DURATION FUNCTION CALLS Also the non-latency case covers the 'verbose' option output. thanks for your comments, hopefully I haven't missed anything.. ;) jirka --
And thanks for your work! For me it's ok. Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Steve? --
Commit-ID: 62b915f1060996a8e1f69be50e3b8e9e43b710cb Gitweb: http://git.kernel.org/tip/62b915f1060996a8e1f69be50e3b8e9e43b710cb Author: Jiri Olsa <jolsa@redhat.com> AuthorDate: Fri, 2 Apr 2010 19:01:22 +0200 Committer: Steven Rostedt <rostedt@goodmis.org> CommitDate: Tue, 27 Apr 2010 12:36:53 -0400 tracing: Add graph output support for irqsoff tracer Add function graph output to irqsoff tracer. The graph output is enabled by setting new 'display-graph' trace option. Signed-off-by: Jiri Olsa <jolsa@redhat.com> LKML-Reference: <1270227683-14631-4-git-send-email-jolsa@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- include/linux/ftrace.h | 15 ++- kernel/trace/trace.c | 35 +++-- kernel/trace/trace.h | 21 +++ kernel/trace/trace_functions_graph.c | 15 ++- kernel/trace/trace_irqsoff.c | 271 ++++++++++++++++++++++++++++++++-- 5 files changed, 324 insertions(+), 33 deletions(-) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index ea5b1aa..8415a52 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -352,6 +352,10 @@ struct ftrace_graph_ret { int depth; }; +/* Type of the callback handlers for tracing function graph*/ +typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ +typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ + #ifdef CONFIG_FUNCTION_GRAPH_TRACER /* for init task */ @@ -400,10 +404,6 @@ extern char __irqentry_text_end[]; #define FTRACE_RETFUNC_DEPTH 50 #define FTRACE_RETSTACK_ALLOC_SIZE 32 -/* Type of the callback handlers for tracing function graph*/ -typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ -typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ - extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, trace_func_graph_ent_t entryfunc); @@ -441,6 +441,13 @@ static inline void ...
hi,
changing function graph tracer's interface functions to be able to
use it from another tracer.
The main change is to be able to pass custom tracer flags.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/trace.h | 6 +-
kernel/trace/trace_functions_graph.c | 123 +++++++++++++++++++---------------
2 files changed, 73 insertions(+), 56 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index bec2c97..fd4a8f5 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -487,7 +487,9 @@ extern int trace_clock_id;
/* Standard output formatting function used for function return traces */
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-extern enum print_line_t print_graph_function(struct trace_iterator *iter);
+extern enum print_line_t
+print_graph_function_flags(struct trace_iterator *iter, u32 flags);
+extern void print_graph_headers_flags(struct seq_file *s, u32 flags);
extern enum print_line_t
trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
@@ -520,7 +522,7 @@ static inline int ftrace_graph_addr(unsigned long addr)
#endif /* CONFIG_DYNAMIC_FTRACE */
#else /* CONFIG_FUNCTION_GRAPH_TRACER */
static inline enum print_line_t
-print_graph_function(struct trace_iterator *iter)
+print_graph_function_flags(struct trace_iterator *iter, u32 flags)
{
return TRACE_TYPE_UNHANDLED;
}
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 75aa144..1b957af 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -525,17 +525,18 @@ get_return_for_leaf(struct trace_iterator *iter,
/* Signal a overhead of time execution to the output */
static int
-print_graph_overhead(unsigned long long duration, struct trace_seq *s)
+print_graph_overhead(unsigned long long duration, struct trace_seq *s,
+ u32 flags)
{
/* If duration disappear, we don't need anything */
- if (!(tracer_flags.val ...Commit-ID: d7a8d9e907cc294ec7a4a7046d1886375fbcc82e Gitweb: http://git.kernel.org/tip/d7a8d9e907cc294ec7a4a7046d1886375fbcc82e Author: Jiri Olsa <jolsa@redhat.com> AuthorDate: Fri, 2 Apr 2010 19:01:21 +0200 Committer: Steven Rostedt <rostedt@goodmis.org> CommitDate: Mon, 26 Apr 2010 17:30:18 -0400 tracing: Have graph flags passed in to ouput functions Let the function graph tracer have custom flags passed to its output functions. Signed-off-by: Jiri Olsa <jolsa@redhat.com> LKML-Reference: <1270227683-14631-3-git-send-email-jolsa@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.h | 6 +- kernel/trace/trace_functions_graph.c | 123 +++++++++++++++++++--------------- 2 files changed, 73 insertions(+), 56 deletions(-) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 2825ef2..970004c 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -491,7 +491,9 @@ extern int trace_clock_id; /* Standard output formatting function used for function return traces */ #ifdef CONFIG_FUNCTION_GRAPH_TRACER -extern enum print_line_t print_graph_function(struct trace_iterator *iter); +extern enum print_line_t +print_graph_function_flags(struct trace_iterator *iter, u32 flags); +extern void print_graph_headers_flags(struct seq_file *s, u32 flags); extern enum print_line_t trace_print_graph_duration(unsigned long long duration, struct trace_seq *s); @@ -524,7 +526,7 @@ static inline int ftrace_graph_addr(unsigned long addr) #endif /* CONFIG_DYNAMIC_FTRACE */ #else /* CONFIG_FUNCTION_GRAPH_TRACER */ static inline enum print_line_t -print_graph_function(struct trace_iterator *iter) +print_graph_function_flags(struct trace_iterator *iter, u32 flags) { return TRACE_TYPE_UNHANDLED; } diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index db9e06b..de5f651 100644 --- a/kernel/trace/trace_functions_graph.c +++ ...
Hi Jiri, I haven't forgotten about you. I came back from the Linux Collaboration Summit with a bunch of TODO's and one of them took me all week. I spent the entire week hacking the ftrace.h file which takes up 100% of my concentration, so I never got to look at your patches. Your patch set is next on my todo list, so expect feedback from me either later today or tomorrow. Thanks for you patience, -- Steve --
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
| Linux Kernel Mailing List | iSeries: fix section mismatch in iseries_veth |
| Linux Kernel Mailing List | ixbge: remove TX lock and redo TX accounting. |
| Linux Kernel Mailing List | ixgbe: fix several counter register errata |
| Linux Kernel Mailing List | b43: fix build with CONFIG_SSB_PCIHOST=n |
| Linux Kernel Mailing List | 9p: block-based virtio client |
