* [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups
@ 2010-09-15 3:01 Steven Rostedt
2010-09-15 3:01 ` [PATCH 1/3] tracing: Add funcgraph-irq option for function graph tracer Steven Rostedt
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Steven Rostedt @ 2010-09-15 3:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
Ingo,
This series is based off of your tip/perf/core and does not contain
the changes in the previous git pull request (does not include
my repo's tip/perf/core). This is a separate pull.
Please pull the latest tip/perf/core-2 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/perf/core-2
Jiri Olsa (1):
tracing: Add funcgraph-irq option for function graph tracer.
Steven Rostedt (2):
tracing: Do not trace in irq when funcgraph-irq option is zero
tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums
----
kernel/trace/ftrace.c | 18 +----
kernel/trace/trace_functions_graph.c | 124 +++++++++++++++++++++++++++++++++-
2 files changed, 126 insertions(+), 16 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] tracing: Add funcgraph-irq option for function graph tracer.
2010-09-15 3:01 [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Steven Rostedt
@ 2010-09-15 3:01 ` Steven Rostedt
2010-09-15 3:01 ` [PATCH 2/3] tracing: Do not trace in irq when funcgraph-irq option is zero Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2010-09-15 3:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Jiri Olsa
[-- Attachment #1: 0001-tracing-Add-funcgraph-irq-option-for-function-graph-.patch --]
[-- Type: text/plain, Size: 5099 bytes --]
From: Jiri Olsa <jolsa@redhat.com>
It's handy to be able to disable the irq related output
and not to have to jump over each irq related code, when
you have no interrest in it.
The option is by default enabled, so there's no change to
current behaviour. It affects only the final output, so all
the irq related data stay in the ring buffer.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
LKML-Reference: <20100907145344.GC1912@jolsa.brq.redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_functions_graph.c | 101 +++++++++++++++++++++++++++++++++-
1 files changed, 100 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index c93bcb2..8674750 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -18,6 +18,7 @@
struct fgraph_cpu_data {
pid_t last_pid;
int depth;
+ int depth_irq;
int ignore;
unsigned long enter_funcs[FTRACE_RETFUNC_DEPTH];
};
@@ -41,6 +42,7 @@ struct fgraph_data {
#define TRACE_GRAPH_PRINT_PROC 0x8
#define TRACE_GRAPH_PRINT_DURATION 0x10
#define TRACE_GRAPH_PRINT_ABS_TIME 0x20
+#define TRACE_GRAPH_PRINT_IRQS 0x40
static struct tracer_opt trace_opts[] = {
/* Display overruns? (for self-debug purpose) */
@@ -55,13 +57,15 @@ static struct tracer_opt trace_opts[] = {
{ TRACER_OPT(funcgraph-duration, TRACE_GRAPH_PRINT_DURATION) },
/* Display absolute time of an entry */
{ TRACER_OPT(funcgraph-abstime, TRACE_GRAPH_PRINT_ABS_TIME) },
+ /* Display interrupts */
+ { TRACER_OPT(funcgraph-irqs, TRACE_GRAPH_PRINT_IRQS) },
{ } /* Empty entry */
};
static struct tracer_flags tracer_flags = {
/* Don't display overruns and proc by default */
.val = TRACE_GRAPH_PRINT_CPU | TRACE_GRAPH_PRINT_OVERHEAD |
- TRACE_GRAPH_PRINT_DURATION,
+ TRACE_GRAPH_PRINT_DURATION | TRACE_GRAPH_PRINT_IRQS,
.opts = trace_opts
};
@@ -855,6 +859,92 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s,
return 0;
}
+/*
+ * Entry check for irq code
+ *
+ * returns 1 if
+ * - we are inside irq code
+ * - we just extered irq code
+ *
+ * retunns 0 if
+ * - funcgraph-interrupts option is set
+ * - we are not inside irq code
+ */
+static int
+check_irq_entry(struct trace_iterator *iter, u32 flags,
+ unsigned long addr, int depth)
+{
+ int cpu = iter->cpu;
+ struct fgraph_data *data = iter->private;
+ int *depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq);
+
+ if (flags & TRACE_GRAPH_PRINT_IRQS)
+ return 0;
+
+ /*
+ * We are inside the irq code
+ */
+ if (*depth_irq >= 0)
+ return 1;
+
+ if ((addr < (unsigned long)__irqentry_text_start) ||
+ (addr >= (unsigned long)__irqentry_text_end))
+ return 0;
+
+ /*
+ * We are entering irq code.
+ */
+ *depth_irq = depth;
+ return 1;
+}
+
+/*
+ * Return check for irq code
+ *
+ * returns 1 if
+ * - we are inside irq code
+ * - we just left irq code
+ *
+ * returns 0 if
+ * - funcgraph-interrupts option is set
+ * - we are not inside irq code
+ */
+static int
+check_irq_return(struct trace_iterator *iter, u32 flags, int depth)
+{
+ int cpu = iter->cpu;
+ struct fgraph_data *data = iter->private;
+ int *depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq);
+
+ if (flags & TRACE_GRAPH_PRINT_IRQS)
+ return 0;
+
+ /*
+ * We are not inside the irq code.
+ */
+ if (*depth_irq == -1)
+ return 0;
+
+ /*
+ * We are inside the irq code, and this is returning entry.
+ * Let's not trace it and clear the entry depth, since
+ * we are out of irq code.
+ *
+ * This condition ensures that we 'leave the irq code' once
+ * we are out of the entry depth. Thus protecting us from
+ * the RETURN entry loss.
+ */
+ if (*depth_irq >= depth) {
+ *depth_irq = -1;
+ return 1;
+ }
+
+ /*
+ * We are inside the irq code, and this is not the entry.
+ */
+ return 1;
+}
+
static enum print_line_t
print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s,
struct trace_iterator *iter, u32 flags)
@@ -865,6 +955,9 @@ print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s,
static enum print_line_t ret;
int cpu = iter->cpu;
+ if (check_irq_entry(iter, flags, call->func, call->depth))
+ return TRACE_TYPE_HANDLED;
+
if (print_graph_prologue(iter, s, TRACE_GRAPH_ENT, call->func, flags))
return TRACE_TYPE_PARTIAL_LINE;
@@ -902,6 +995,9 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
int ret;
int i;
+ if (check_irq_return(iter, flags, trace->depth))
+ return TRACE_TYPE_HANDLED;
+
if (data) {
struct fgraph_cpu_data *cpu_data;
int cpu = iter->cpu;
@@ -1210,9 +1306,12 @@ void graph_trace_open(struct trace_iterator *iter)
pid_t *pid = &(per_cpu_ptr(data->cpu_data, cpu)->last_pid);
int *depth = &(per_cpu_ptr(data->cpu_data, cpu)->depth);
int *ignore = &(per_cpu_ptr(data->cpu_data, cpu)->ignore);
+ int *depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq);
+
*pid = -1;
*depth = 0;
*ignore = 0;
+ *depth_irq = -1;
}
iter->private = data;
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] tracing: Do not trace in irq when funcgraph-irq option is zero
2010-09-15 3:01 [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Steven Rostedt
2010-09-15 3:01 ` [PATCH 1/3] tracing: Add funcgraph-irq option for function graph tracer Steven Rostedt
@ 2010-09-15 3:01 ` Steven Rostedt
2010-09-15 3:01 ` [PATCH 3/3] tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums Steven Rostedt
2010-09-15 8:29 ` [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Ingo Molnar
3 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2010-09-15 3:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
[-- Attachment #1: 0002-tracing-Do-not-trace-in-irq-when-funcgraph-irq-optio.patch --]
[-- Type: text/plain, Size: 2506 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
When the function graph tracer funcgraph-irq option is zero, disable
tracing in IRQs. This makes the option have two effects.
1) When reading the trace file, do not display the functions that
happen in interrupt context (when detected)
2) [*new*] When recording a trace, skip those that are detected
to be in interrupt by the 'in_irq()' function
Note, in_irq() is updated at irq_enter() and irq_exit(). There are
still functions that are recorded by the function graph tracer that
is in interrupt context but outside the irq_enter/exit() routines.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_functions_graph.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 8674750..02c708a 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -15,6 +15,9 @@
#include "trace.h"
#include "trace_output.h"
+/* When set, irq functions will be ignored */
+static int ftrace_graph_skip_irqs;
+
struct fgraph_cpu_data {
pid_t last_pid;
int depth;
@@ -208,6 +211,14 @@ int __trace_graph_entry(struct trace_array *tr,
return 1;
}
+static inline int ftrace_graph_ignore_irqs(void)
+{
+ if (!ftrace_graph_skip_irqs)
+ return 0;
+
+ return in_irq();
+}
+
int trace_graph_entry(struct ftrace_graph_ent *trace)
{
struct trace_array *tr = graph_array;
@@ -222,7 +233,8 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
return 0;
/* trace it when it is-nested-in or is a function enabled. */
- if (!(trace->depth || ftrace_graph_addr(trace->func)))
+ if (!(trace->depth || ftrace_graph_addr(trace->func)) ||
+ ftrace_graph_ignore_irqs())
return 0;
local_irq_save(flags);
@@ -1334,6 +1346,14 @@ void graph_trace_close(struct trace_iterator *iter)
}
}
+static int func_graph_set_flag(u32 old_flags, u32 bit, int set)
+{
+ if (bit == TRACE_GRAPH_PRINT_IRQS)
+ ftrace_graph_skip_irqs = !set;
+
+ return 0;
+}
+
static struct trace_event_functions graph_functions = {
.trace = print_graph_function_event,
};
@@ -1360,6 +1380,7 @@ static struct tracer graph_trace __read_mostly = {
.print_line = print_graph_function,
.print_header = print_graph_headers,
.flags = &tracer_flags,
+ .set_flag = func_graph_set_flag,
#ifdef CONFIG_FTRACE_SELFTEST
.selftest = trace_selftest_startup_function_graph,
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums
2010-09-15 3:01 [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Steven Rostedt
2010-09-15 3:01 ` [PATCH 1/3] tracing: Add funcgraph-irq option for function graph tracer Steven Rostedt
2010-09-15 3:01 ` [PATCH 2/3] tracing: Do not trace in irq when funcgraph-irq option is zero Steven Rostedt
@ 2010-09-15 3:01 ` Steven Rostedt
2010-09-15 16:10 ` Valdis.Kletnieks
2010-09-15 8:29 ` [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Ingo Molnar
3 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2010-09-15 3:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
[-- Attachment #1: 0003-tracing-Remove-leftover-FTRACE_ENABLE-DISABLE_MCOUNT.patch --]
[-- Type: text/plain, Size: 1960 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The enums for FTRACE_ENABLE_MCOUNT and FTRACE_DISABLE_MCOUNT were
used as commands to ftrace_run_update_code(). But these commands
were used by the old nasty ftrace daemon that has long been slain.
This is a clean up patch to remove the references to these enums
and simplify the code a little.
Reported-by: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 83a16e9..20aff3f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -884,10 +884,8 @@ enum {
FTRACE_ENABLE_CALLS = (1 << 0),
FTRACE_DISABLE_CALLS = (1 << 1),
FTRACE_UPDATE_TRACE_FUNC = (1 << 2),
- FTRACE_ENABLE_MCOUNT = (1 << 3),
- FTRACE_DISABLE_MCOUNT = (1 << 4),
- FTRACE_START_FUNC_RET = (1 << 5),
- FTRACE_STOP_FUNC_RET = (1 << 6),
+ FTRACE_START_FUNC_RET = (1 << 3),
+ FTRACE_STOP_FUNC_RET = (1 << 4),
};
static int ftrace_filtered;
@@ -1226,8 +1224,6 @@ static void ftrace_shutdown(int command)
static void ftrace_startup_sysctl(void)
{
- int command = FTRACE_ENABLE_MCOUNT;
-
if (unlikely(ftrace_disabled))
return;
@@ -1235,23 +1231,17 @@ static void ftrace_startup_sysctl(void)
saved_ftrace_func = NULL;
/* ftrace_start_up is true if we want ftrace running */
if (ftrace_start_up)
- command |= FTRACE_ENABLE_CALLS;
-
- ftrace_run_update_code(command);
+ ftrace_run_update_code(FTRACE_ENABLE_CALLS);
}
static void ftrace_shutdown_sysctl(void)
{
- int command = FTRACE_DISABLE_MCOUNT;
-
if (unlikely(ftrace_disabled))
return;
/* ftrace_start_up is true if ftrace is running */
if (ftrace_start_up)
- command |= FTRACE_DISABLE_CALLS;
-
- ftrace_run_update_code(command);
+ ftrace_run_update_code(FTRACE_DISABLE_CALLS);
}
static cycle_t ftrace_update_time;
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups
2010-09-15 3:01 [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Steven Rostedt
` (2 preceding siblings ...)
2010-09-15 3:01 ` [PATCH 3/3] tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums Steven Rostedt
@ 2010-09-15 8:29 ` Ingo Molnar
3 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2010-09-15 8:29 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Peter Zijlstra,
Arnaldo Carvalho de Melo, Frédéric Weisbecker,
Thomas Gleixner
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Ingo,
>
> This series is based off of your tip/perf/core and does not contain
> the changes in the previous git pull request (does not include my
> repo's tip/perf/core). This is a separate pull.
>
> Please pull the latest tip/perf/core-2 tree, which can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> tip/perf/core-2
>
>
> Jiri Olsa (1):
> tracing: Add funcgraph-irq option for function graph tracer.
>
> Steven Rostedt (2):
> tracing: Do not trace in irq when funcgraph-irq option is zero
> tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums
>
> ----
> kernel/trace/ftrace.c | 18 +----
> kernel/trace/trace_functions_graph.c | 124 +++++++++++++++++++++++++++++++++-
> 2 files changed, 126 insertions(+), 16 deletions(-)
Pulled, thanks a lot Steve!
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums
2010-09-15 3:01 ` [PATCH 3/3] tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums Steven Rostedt
@ 2010-09-15 16:10 ` Valdis.Kletnieks
2010-09-15 16:21 ` Steven Rostedt
0 siblings, 1 reply; 7+ messages in thread
From: Valdis.Kletnieks @ 2010-09-15 16:10 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, Ingo Molnar, Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
On Tue, 14 Sep 2010 23:01:42 EDT, Steven Rostedt said:
> From: Steven Rostedt <srostedt@redhat.com>
>
> The enums for FTRACE_ENABLE_MCOUNT and FTRACE_DISABLE_MCOUNT were
> used as commands to ftrace_run_update_code(). But these commands
> were used by the old nasty ftrace daemon that has long been slain.
> - FTRACE_START_FUNC_RET = (1 << 5),
> - FTRACE_STOP_FUNC_RET = (1 << 6),
> + FTRACE_START_FUNC_RET = (1 << 3),
> + FTRACE_STOP_FUNC_RET = (1 << 4),
This renumber isn't visible to user space, correct? (Asking because the enable/
disable apparently *were* visible to the since-slain userspace daemon)
[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums
2010-09-15 16:10 ` Valdis.Kletnieks
@ 2010-09-15 16:21 ` Steven Rostedt
0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2010-09-15 16:21 UTC (permalink / raw)
To: Valdis.Kletnieks; +Cc: linux-kernel, Ingo Molnar, Andrew Morton
On Wed, 2010-09-15 at 12:10 -0400, Valdis.Kletnieks@vt.edu wrote:
> On Tue, 14 Sep 2010 23:01:42 EDT, Steven Rostedt said:
> > From: Steven Rostedt <srostedt@redhat.com>
> >
> > The enums for FTRACE_ENABLE_MCOUNT and FTRACE_DISABLE_MCOUNT were
> > used as commands to ftrace_run_update_code(). But these commands
> > were used by the old nasty ftrace daemon that has long been slain.
>
> > - FTRACE_START_FUNC_RET = (1 << 5),
> > - FTRACE_STOP_FUNC_RET = (1 << 6),
> > + FTRACE_START_FUNC_RET = (1 << 3),
> > + FTRACE_STOP_FUNC_RET = (1 << 4),
>
> This renumber isn't visible to user space, correct? (Asking because the enable/
> disable apparently *were* visible to the since-slain userspace daemon)
Nope, it's not visible to userspace, and the slain-daemon was a kernel
thread, not userspace.
-- Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-15 16:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 3:01 [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Steven Rostedt
2010-09-15 3:01 ` [PATCH 1/3] tracing: Add funcgraph-irq option for function graph tracer Steven Rostedt
2010-09-15 3:01 ` [PATCH 2/3] tracing: Do not trace in irq when funcgraph-irq option is zero Steven Rostedt
2010-09-15 3:01 ` [PATCH 3/3] tracing: Remove leftover FTRACE_ENABLE/DISABLE_MCOUNT enums Steven Rostedt
2010-09-15 16:10 ` Valdis.Kletnieks
2010-09-15 16:21 ` Steven Rostedt
2010-09-15 8:29 ` [PATCH 0/3] [GIT PULL] tracing: ftrace features and clean ups Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox