Skip to contentSkip to conversation

tracing: function graph output for preempt/irqs-off tracers

PATCH Superseded Jiri Olsa 2 participants 9 messages Feb 22, 2010 – Mar 9, 2010

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

cover tracing: function graph output for preempt/irqs-off tracers

hi,

I'm sending reworked version of the graph output support for preemptirqsoff/preemptoff/irqsoff tracers.

I made the graph output as an output event, so it could be shared within tracers - patch 1/4.

I also added raw trace output for graph tracer. I have this one around for long time and it was quite handy for investigating graph tracer issues. (patch 4/4)

attached patches:
- 1/4 adding ftrace events for graph tracer
- 2/4 graph output support for irqsoff tracer
- 3/4 graph output support for preemptirqsoff/preemptoff tracers
- 4/4 raw output for graph tracer

wbr,
jirka

---
 kernel/trace/trace.c                 |    2 +-
 kernel/trace/trace.h                 |   11 ++-
 kernel/trace/trace_functions_graph.c |  117 +++++++++++++++++++----
 kernel/trace/trace_irqsoff.c         |  174 ++++++++++++++++++++++++++++++++--
 4 files changed, 277 insertions(+), 27 deletions(-)
author
#1 lore raw

PATCH 1/4 tracing: adding ftrace events for graph tracer

hi,

this patch adds ftrace events for graph tracer, so the graph output could be shared within other tracers.

wbr,
jirka

---
 kernel/trace/trace.h                 |    3 ++-
 kernel/trace/trace_functions_graph.c |   25 ++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)
kernel/trace/trace.h +2 -1
index b477fce..1feda87 100644
@@ -490,7 +490,8 @@ 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(struct trace_iterator *iter,
+					      int flags);
 extern enum print_line_t
 trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
 
kernel/trace/trace_functions_graph.c +22 -3
index 616b135..41cec17 100644
@@ -38,7 +38,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) */
@@ -985,7 +985,7 @@ print_graph_comment(struct trace_seq *s,  struct trace_entry *ent,
 
 
 enum print_line_t
-print_graph_function(struct trace_iterator *iter)
+print_graph_function(struct trace_iterator *iter, int flags)
 {
 	struct ftrace_graph_ent_entry *field;
 	struct fgraph_data *data = iter->private;
@@ -1143,6 +1143,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,
+};
+
+static struct trace_event graph_trace_ret_event = {
+	.type		= TRACE_GRAPH_RET,
+	.trace		= print_graph_function,
+};
+
 static struct tracer graph_trace __read_mostly = {
 	.name		= "function_graph",
 	.open		= graph_trace_open,
@@ -1152,7 +1162,6 @@ static struct tracer graph_trace __read_mostly = {
 	.wait_pipe	= poll_wait_pipe,
 	.init		= graph_trace_init,
 	.reset		= graph_trace_reset,
-	.print_line	= print_graph_function,
 	.print_header	= print_graph_headers,
 	.flags		= &tracer_flags,
 #ifdef CONFIG_FTRACE_SELFTEST
@@ -1164,6 +1173,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 (!register_ftrace_event(&graph_trace_ret_event)) {
+		pr_warning("Warning: could not register graph trace events\n");
+		return 1;
+	}
+
 	return register_tracer(&graph_trace);
 }
 
Signature · 1 line
1.6.6
maintainer
#2 lore raw

Re: [PATCH 1/4] tracing: adding ftrace events for graph tracer

Quoted 5 lines · Jiri Olsa

hi,

this patch adds ftrace events for graph tracer, so the graph output could be shared within other tracers.

Sorry but NAK to this,

What use to be:

 2) + 25.633 us   |                        }
 3) ! 252.132 us  |              } /* do_softirq */
 2) ! 898.211 us  |                      } /* rcu_process_callbacks */
 2)               |                      /* softirq_exit: vec=9 [action=RCU] */
 3)   5.534 us    |              rcu_irq_exit();
 2)   6.405 us    |                      preempt_schedule();
 3)   5.221 us    |              idle_cpu();
 2)   6.014 us    |                      rcu_bh_qs();
 3) ! 289.729 us  |            } /* irq_exit */
 2)               |                      /* softirq_entry: vec=1 [action=TIMER] */
 3) ! 860.416 us  |          } /* smp_apic_timer_interrupt */
 3)   <========== |
 2)   5.785 us    |                      preempt_schedule();

Is now:

      gdmgreeter-3382  [002]   119.609346:  2) + 25.633 us   |                        }
           pcscd-2849  [003]   119.609352:  3) ! 252.132 us  |              } /* do_softirq */
      gdmgreeter-3382  [002]   119.609353:  2) ! 898.211 us  |                      } /* rcu_process_callbacks */
      gdmgreeter-3382  [002]   119.609357: softirq_exit: vec=9 [action=RCU]
           pcscd-2849  [003]   119.609360:  3)   5.534 us    |              rcu_irq_exit();
      gdmgreeter-3382  [002]   119.609363:  2)   6.405 us    |                      preempt_schedule();
           pcscd-2849  [003]   119.609370:  3)   5.221 us    |              idle_cpu();
      gdmgreeter-3382  [002]   119.609376:  2)   6.014 us    |                      rcu_bh_qs();
           pcscd-2849  [003]   119.609383:  3) ! 289.729 us  |            } /* irq_exit */
      gdmgreeter-3382  [002]   119.609387: softirq_entry: vec=1 [action=TIMER]
           pcscd-2849  [003]   119.609389:  3) ! 860.416 us  |          } /* smp_apic_timer_interrupt */
 3)   <========== |
      gdmgreeter-3382  [002]   119.609393:  2)   5.785 us    |                      preempt_schedule();

Keep the function graph output as is. You can still add the event callbacks but do not remove the print_line of the function graph tracer. That simply breaks what we worked hard to format nicely.

-- Steve

Quoted 85 lines
---
 kernel/trace/trace.h                 |    3 ++-
 kernel/trace/trace_functions_graph.c |   25 ++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)
kernel/trace/trace.h +2 -1
index b477fce..1feda87 100644
@@ -490,7 +490,8 @@ 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(struct trace_iterator *iter,
+					      int flags);
 extern enum print_line_t
 trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
 
kernel/trace/trace_functions_graph.c +22 -3
index 616b135..41cec17 100644
@@ -38,7 +38,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) */
@@ -985,7 +985,7 @@ print_graph_comment(struct trace_seq *s,  struct trace_entry *ent,
 
 
 enum print_line_t
-print_graph_function(struct trace_iterator *iter)
+print_graph_function(struct trace_iterator *iter, int flags)
 {
 	struct ftrace_graph_ent_entry *field;
 	struct fgraph_data *data = iter->private;
@@ -1143,6 +1143,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,
+};
+
+static struct trace_event graph_trace_ret_event = {
+	.type		= TRACE_GRAPH_RET,
+	.trace		= print_graph_function,
+};
+
 static struct tracer graph_trace __read_mostly = {
 	.name		= "function_graph",
 	.open		= graph_trace_open,
@@ -1152,7 +1162,6 @@ static struct tracer graph_trace __read_mostly = {
 	.wait_pipe	= poll_wait_pipe,
 	.init		= graph_trace_init,
 	.reset		= graph_trace_reset,
-	.print_line	= print_graph_function,
 	.print_header	= print_graph_headers,
 	.flags		= &tracer_flags,
 #ifdef CONFIG_FTRACE_SELFTEST
@@ -1164,6 +1173,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 (!register_ftrace_event(&graph_trace_ret_event)) {
+		pr_warning("Warning: could not register graph trace events\n");
+		return 1;
+	}
+
 	return register_tracer(&graph_trace);
 }
 
author
#3 lore raw

Re: [PATCH 1/4] tracing: adding ftrace events for graph tracer

Quoted 8 lines · Steven Rostedt
Quoted 5 lines · Jiri Olsa

hi,

this patch adds ftrace events for graph tracer, so the graph output could be shared within other tracers.

Sorry but NAK to this,

right, I haven't realized this to be a problem,
I'll send new version shortly

wbr,
jirka

Quoted 128 lines

What use to be:

 2) + 25.633 us   |                        }
 3) ! 252.132 us  |              } /* do_softirq */
 2) ! 898.211 us  |                      } /* rcu_process_callbacks */
 2)               |                      /* softirq_exit: vec=9 [action=RCU] */
 3)   5.534 us    |              rcu_irq_exit();
 2)   6.405 us    |                      preempt_schedule();
 3)   5.221 us    |              idle_cpu();
 2)   6.014 us    |                      rcu_bh_qs();
 3) ! 289.729 us  |            } /* irq_exit */
 2)               |                      /* softirq_entry: vec=1 [action=TIMER] */
 3) ! 860.416 us  |          } /* smp_apic_timer_interrupt */
 3)   <========== |
 2)   5.785 us    |                      preempt_schedule();

Is now:

      gdmgreeter-3382  [002]   119.609346:  2) + 25.633 us   |                        }
           pcscd-2849  [003]   119.609352:  3) ! 252.132 us  |              } /* do_softirq */
      gdmgreeter-3382  [002]   119.609353:  2) ! 898.211 us  |                      } /* rcu_process_callbacks */
      gdmgreeter-3382  [002]   119.609357: softirq_exit: vec=9 [action=RCU]
           pcscd-2849  [003]   119.609360:  3)   5.534 us    |              rcu_irq_exit();
      gdmgreeter-3382  [002]   119.609363:  2)   6.405 us    |                      preempt_schedule();
           pcscd-2849  [003]   119.609370:  3)   5.221 us    |              idle_cpu();
      gdmgreeter-3382  [002]   119.609376:  2)   6.014 us    |                      rcu_bh_qs();
           pcscd-2849  [003]   119.609383:  3) ! 289.729 us  |            } /* irq_exit */
      gdmgreeter-3382  [002]   119.609387: softirq_entry: vec=1 [action=TIMER]
           pcscd-2849  [003]   119.609389:  3) ! 860.416 us  |          } /* smp_apic_timer_interrupt */
 3)   <========== |
      gdmgreeter-3382  [002]   119.609393:  2)   5.785 us    |                      preempt_schedule();

Keep the function graph output as is. You can still add the event callbacks but do not remove the print_line of the function graph tracer. That simply breaks what we worked hard to format nicely.

-- Steve

Quoted 85 lines
---
 kernel/trace/trace.h                 |    3 ++-
 kernel/trace/trace_functions_graph.c |   25 ++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)
kernel/trace/trace.h +2 -1
index b477fce..1feda87 100644
@@ -490,7 +490,8 @@ 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(struct trace_iterator *iter,
+					      int flags);
 extern enum print_line_t
 trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
 
kernel/trace/trace_functions_graph.c +22 -3
index 616b135..41cec17 100644
@@ -38,7 +38,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) */
@@ -985,7 +985,7 @@ print_graph_comment(struct trace_seq *s,  struct trace_entry *ent,
 
 
 enum print_line_t
-print_graph_function(struct trace_iterator *iter)
+print_graph_function(struct trace_iterator *iter, int flags)
 {
 	struct ftrace_graph_ent_entry *field;
 	struct fgraph_data *data = iter->private;
@@ -1143,6 +1143,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,
+};
+
+static struct trace_event graph_trace_ret_event = {
+	.type		= TRACE_GRAPH_RET,
+	.trace		= print_graph_function,
+};
+
 static struct tracer graph_trace __read_mostly = {
 	.name		= "function_graph",
 	.open		= graph_trace_open,
@@ -1152,7 +1162,6 @@ static struct tracer graph_trace __read_mostly = {
 	.wait_pipe	= poll_wait_pipe,
 	.init		= graph_trace_init,
 	.reset		= graph_trace_reset,
-	.print_line	= print_graph_function,
 	.print_header	= print_graph_headers,
 	.flags		= &tracer_flags,
 #ifdef CONFIG_FTRACE_SELFTEST
@@ -1164,6 +1173,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 (!register_ftrace_event(&graph_trace_ret_event)) {
+		pr_warning("Warning: could not register graph trace events\n");
+		return 1;
+	}
+
 	return register_tracer(&graph_trace);
 }
 
author
#4 lore raw

PATCH 2/4 tracing: graph output support for irqsoff tracer

In reply to Jiri Olsa

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.

It looks like this:

[root@dell-pe1950-05 tracing]# echo irqsoff-graph > ./trace_options [root@dell-pe1950-05 tracing]# cat ./trace
# tracer: irqsoff
#
# _-----=> irqs-off
# / _----=> need-resched

#    | / _---=> hardirq/softirq 
#    || / _--=> preempt-depth   
#    ||| / _-=> lock-depth      
#    |||| /                     
# CPU|||||  DURATION                  FUNCTION CALLS
# |  |||||   |   |                     |   |   |   |
hald-add-1048    3d...0    0us : _raw_spin_lock_irqsave <-scsi_dispatch_cmd
 3)  d...0              |      ata_scsi_queuecmd() {
 3)  d...0  0.318 us    |        _raw_spin_lock();
 3)  d...0              |        ata_scsi_find_dev() {
 3)  d...0              |          __ata_scsi_find_dev() {
 3)  d...0  0.273 us    |            ata_find_dev();
 3)  d...0  0.798 us    |          }
 3)  d...0  1.419 us    |        }
 3)  d...0              |        __ata_scsi_queuecmd() {
 3)  d...0              |          ata_qc_new_init() {
 3)  d...0              |            ata_qc_reinit() {
 3)  d...0  0.258 us    |              ata_tf_init();
 3)  d...0  0.784 us    |            }
 3)  d...0  1.441 us    |          }
 3)  d...0  0.348 us    |          atapi_xlat();
 3)  d...0              |          ata_qc_issue() {

...

SNIP

...

 3)  d...0+ 31.244 us   |                }
 3)  d...0+ 32.393 us   |              }
 3)  d...0+ 99.146 us   |            }
 3)  d...0! 100.455 us  |          }
 3)  d...0! 103.669 us  |        }
 3)  d...0  0.267 us    |        _raw_spin_lock();
 3)  d...0! 107.264 us  |      }
 3)  d...0              |      spin_unlock_irqrestore() {
 3)  d...0              |        _raw_spin_unlock_irqrestore() {

hald-add-1048 3d...0 109us : _raw_spin_unlock_irqrestore <-return_to_handler
hald-add-1048 3d...0 109us : trace_hardirqs_on <-return_to_handler
hald-add-1048 3d...0 109us : <stack trace>
=> trace_hardirqs_on
=> _raw_spin_unlock_irqrestore
=> return_to_handler
=> scsi_dispatch_cmd
=> return_to_handler
=> __generic_unplug_device
=> scsi_request_fn
=> return_to_handler
[root@dell-pe1950-05 tracing]#

wbr,
jirka

---
 kernel/trace/trace.h                 |    8 ++
 kernel/trace/trace_functions_graph.c |   25 ++----
 kernel/trace/trace_irqsoff.c         |  162 ++++++++++++++++++++++++++++++++--
 3 files changed, 172 insertions(+), 23 deletions(-)
kernel/trace/trace.h +8 -0
index 1feda87..d2a42c9 100644
@@ -494,6 +494,14 @@ extern enum print_line_t print_graph_function(struct trace_iterator *iter,
 					      int flags);
 extern enum print_line_t
 trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
+void graph_trace_open(struct trace_iterator *iter);
+void graph_trace_close(struct trace_iterator *iter);
+int __trace_graph_entry(struct trace_array *tr, struct ftrace_graph_ent *trace,
+			unsigned long flags, int pc);
+void __trace_graph_return(struct trace_array *tr,
+			struct ftrace_graph_ret *trace,
+			unsigned long flags, int pc);
+
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 /* TODO: make this variable */
kernel/trace/trace_functions_graph.c +9 -16
index 41cec17..eca09b3 100644
@@ -177,7 +177,7 @@ unsigned long ftrace_return_to_handler(unsigned long frame_pointer)
 	return ret;
 }
 
-static int __trace_graph_entry(struct trace_array *tr,
+int __trace_graph_entry(struct trace_array *tr,
 				struct ftrace_graph_ent *trace,
 				unsigned long flags,
 				int pc)
@@ -236,7 +236,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
 	return ret;
 }
 
-static void __trace_graph_return(struct trace_array *tr,
+void __trace_graph_return(struct trace_array *tr,
 				struct ftrace_graph_ret *trace,
 				unsigned long flags,
 				int pc)
@@ -911,9 +911,7 @@ static enum print_line_t
 print_graph_comment(struct trace_seq *s,  struct trace_entry *ent,
 		    struct trace_iterator *iter)
 {
-	unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK);
 	struct fgraph_data *data = iter->private;
-	struct trace_event *event;
 	int depth = 0;
 	int ret;
 	int i;
@@ -960,14 +958,6 @@ print_graph_comment(struct trace_seq *s,  struct trace_entry *ent,
 		if (ret != TRACE_TYPE_HANDLED)
 			return ret;
 		break;
-	default:
-		event = ftrace_find_event(ent->type);
-		if (!event)
-			return TRACE_TYPE_UNHANDLED;
-
-		ret = event->trace(iter, sym_flags);
-		if (ret != TRACE_TYPE_HANDLED)
-			return ret;
 	}
 
 	/* Strip ending newline */
@@ -1033,8 +1023,11 @@ print_graph_function(struct trace_iterator *iter, int flags)
 		trace_assign_type(field, entry);
 		return print_graph_return(&field->ret, s, entry, iter);
 	}
-	default:
+	case TRACE_BPRINT:
+	case TRACE_PRINT:
 		return print_graph_comment(s, entry, iter);
+	default:
+		return TRACE_TYPE_UNHANDLED;
 	}
 
 	return TRACE_TYPE_HANDLED;
@@ -1062,7 +1055,7 @@ static void print_lat_header(struct seq_file *s)
 	seq_printf(s, "#%.*s|||| /                     \n", size, spaces);
 }
 
-static void print_graph_headers(struct seq_file *s)
+void print_graph_headers(struct seq_file *s)
 {
 	int lat = trace_flags & TRACE_ITER_LATENCY_FMT;
 
@@ -1098,7 +1091,7 @@ static void print_graph_headers(struct seq_file *s)
 	seq_printf(s, "               |   |   |   |\n");
 }
 
-static void graph_trace_open(struct trace_iterator *iter)
+void graph_trace_open(struct trace_iterator *iter)
 {
 	/* pid and depth on the last trace processed */
 	struct fgraph_data *data;
@@ -1133,7 +1126,7 @@ static void graph_trace_open(struct trace_iterator *iter)
 	pr_warning("function graph tracer: not enough memory\n");
 }
 
-static void graph_trace_close(struct trace_iterator *iter)
+void graph_trace_close(struct trace_iterator *iter)
 {
 	struct fgraph_data *data = iter->private;
 
kernel/trace/trace_irqsoff.c +155 -7

214 lines not on this page · raw message

Signature · 1 line
1.6.6
author
#5 lore raw

PATCH 3/4 tracing: graph output support for preemptirqsoff/preemptoff tracers

In reply to Jiri Olsa

hi,

adding support for graph output for preemptirqsoff/preemptoff tracers.

wbr,
jirka

---
 kernel/trace/trace_irqsoff.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
kernel/trace/trace_irqsoff.c +17 -5
index f3f43fc..15e05c9 100644
@@ -58,12 +58,12 @@ irq_trace(void)
 # define irq_trace() (0)
 #endif
 
-#define TRACE_IRQSOFF_GRAPH	1
+#define TRACE_DISPLAY_GRAPH	1
 
 static struct tracer_opt trace_opts[] = {
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	/* display latency trace as call graph */
-	{ TRACER_OPT(irqsoff-graph, TRACE_IRQSOFF_GRAPH) },
+	{ TRACER_OPT(display-graph, TRACE_DISPLAY_GRAPH) },
 #endif
 	{ } /* Empty entry */
 };
@@ -73,7 +73,7 @@ static struct tracer_flags tracer_flags = {
 	.opts = trace_opts,
 };
 
-#define is_graph() (tracer_flags.val & TRACE_IRQSOFF_GRAPH)
+#define is_graph() (tracer_flags.val & TRACE_DISPLAY_GRAPH)
 
 /*
  * Sequence count - we record it when starting a measurement and
@@ -133,7 +133,7 @@ static int irqsoff_set_flag(u32 old_flags, u32 bit, int set)
 {
 	int cpu;
 
-	if (!(bit & TRACE_IRQSOFF_GRAPH))
+	if (!(bit & TRACE_DISPLAY_GRAPH))
 		return -EINVAL;
 
 	if (!(is_graph() ^ set))
@@ -550,8 +550,8 @@ static struct tracer irqsoff_tracer __read_mostly =
 	.reset		= irqsoff_tracer_reset,
 	.start		= irqsoff_tracer_start,
 	.stop		= irqsoff_tracer_stop,
-	.flags		= &tracer_flags,
 	.print_max	= 1,
+	.flags		= &tracer_flags,
 	.set_flag	= irqsoff_set_flag,
 #ifdef CONFIG_FTRACE_SELFTEST
 	.selftest    = trace_selftest_startup_irqsoff,
@@ -583,9 +583,15 @@ static struct tracer preemptoff_tracer __read_mostly =
 	.start		= irqsoff_tracer_start,
 	.stop		= irqsoff_tracer_stop,
 	.print_max	= 1,
+	.flags		= &tracer_flags,
+	.set_flag	= irqsoff_set_flag,
 #ifdef CONFIG_FTRACE_SELFTEST
 	.selftest    = trace_selftest_startup_preemptoff,
 #endif
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+	.open           = irqsoff_trace_open,
+	.close          = irqsoff_trace_close,
+#endif
 };
 # define register_preemptoff(trace) register_tracer(&trace)
 #else
@@ -611,9 +617,15 @@ static struct tracer preemptirqsoff_tracer __read_mostly =
 	.start		= irqsoff_tracer_start,
 	.stop		= irqsoff_tracer_stop,
 	.print_max	= 1,
+	.flags		= &tracer_flags,
+	.set_flag	= irqsoff_set_flag,
 #ifdef CONFIG_FTRACE_SELFTEST
 	.selftest    = trace_selftest_startup_preemptirqsoff,
 #endif
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+	.open           = irqsoff_trace_open,
+	.close          = irqsoff_trace_close,
+#endif
 };
 
 # define register_preemptirqsoff(trace) register_tracer(&trace)
Signature · 1 line
1.6.6
author
#6 lore raw

PATCH 4/4 tracing: raw output for graph tracer

In reply to Jiri Olsa

hi,

this patch adds raw trace output for graph tracer.

I have this one around for long time and it was quite handy for investigating graph tracer issues.

wbr,
jirka

---
 kernel/trace/trace.c                 |    2 +-
 kernel/trace/trace_functions_graph.c |   69 ++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletions(-)
kernel/trace/trace.c +1 -1
index 032c57c..723fa93 100644
@@ -1900,7 +1900,7 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)
 	entry = iter->ent;
 
 	if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
-		if (!trace_seq_printf(s, "%d %d %llu ",
+		if (!trace_seq_printf(s, " %6d %3d %20llu ",
 				      entry->pid, iter->cpu, iter->ts))
 			goto partial;
 	}
kernel/trace/trace_functions_graph.c +69 -0

101 lines not on this page · raw message

Signature · 1 line
1.6.6
author
#7 lore raw
In reply to Jiri Olsa

hi,
any feedback?

thanks,
jirka

Quoted 32 lines · Jiri Olsa

hi,

I'm sending reworked version of the graph output support for preemptirqsoff/preemptoff/irqsoff tracers.

I made the graph output as an output event, so it could be shared within tracers - patch 1/4.

I also added raw trace output for graph tracer. I have this one around for long time and it was quite handy for investigating graph tracer issues. (patch 4/4)

attached patches:
- 1/4 adding ftrace events for graph tracer
- 2/4 graph output support for irqsoff tracer
- 3/4 graph output support for preemptirqsoff/preemptoff tracers
- 4/4 raw output for graph tracer

wbr,
jirka

---
 kernel/trace/trace.c                 |    2 +-
 kernel/trace/trace.h                 |   11 ++-
 kernel/trace/trace_functions_graph.c |  117 +++++++++++++++++++----
 kernel/trace/trace_irqsoff.c         |  174 ++++++++++++++++++++++++++++++++--
 4 files changed, 277 insertions(+), 27 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

maintainer
#8 lore raw
Quoted 2 lines · Jiri Olsa

hi,
any feedback?

Ah, I forgot about this patch set. I'll take a look at it today.

Thanks,

-- Steve

Quoted 37 lines

thanks,
jirka

Quoted 32 lines · Jiri Olsa

hi,

I'm sending reworked version of the graph output support for preemptirqsoff/preemptoff/irqsoff tracers.

I made the graph output as an output event, so it could be shared within tracers - patch 1/4.

I also added raw trace output for graph tracer. I have this one around for long time and it was quite handy for investigating graph tracer issues. (patch 4/4)

attached patches:
- 1/4 adding ftrace events for graph tracer
- 2/4 graph output support for irqsoff tracer
- 3/4 graph output support for preemptirqsoff/preemptoff tracers
- 4/4 raw output for graph tracer

wbr,
jirka

---
 kernel/trace/trace.c                 |    2 +-
 kernel/trace/trace.h                 |   11 ++-
 kernel/trace/trace_functions_graph.c |  117 +++++++++++++++++++----
 kernel/trace/trace_irqsoff.c         |  174 ++++++++++++++++++++++++++++++++--
 4 files changed, 277 insertions(+), 27 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/