* [PATCH 1/4] x86/stacktrace: return 0 instead of -1 for stack ops
2009-05-15 4:05 [PATCH 0/4] [GIT PULL] tracing: small updates for tip Steven Rostedt
@ 2009-05-15 4:05 ` Steven Rostedt
2009-05-15 4:05 ` [PATCH 2/4] tracing: stop stack trace on first empty entry Steven Rostedt
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-05-15 4:05 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker
[-- Attachment #1: 0001-x86-stacktrace-return-0-instead-of-1-for-stack-ops.patch --]
[-- Type: text/plain, Size: 1347 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
If we return -1 in the ops->stack for the stacktrace saving, we end up
breaking out of the loop if the stack we are tracing is in the exception
stack. This causes traces like:
<idle>-0 [002] 34263.745825: raise_softirq_irqoff <-__blk_complete_request
<idle>-0 [002] 34263.745826:
<= 0
<= 0
<= 0
<= 0
<= 0
<= 0
<= 0
By returning "0" instead, the irq stack is saved as well, and we see:
<idle>-0 [003] 883.280992: raise_softirq_irqoff <-__hrtimer_star
t_range_ns
<idle>-0 [003] 883.280992:
<= hrtimer_start_range_ns
<= tick_nohz_restart_sched_tick
<= cpu_idle
<= start_secondary
<=
<= 0
<= 0
[ Impact: record stacks from interrupts ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
arch/x86/kernel/stacktrace.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index f7bddc2..4aaf7e4 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -20,7 +20,7 @@ save_stack_warning_symbol(void *data, char *msg, unsigned long symbol)
static int save_stack_stack(void *data, char *name)
{
- return -1;
+ return 0;
}
static void save_stack_address(void *data, unsigned long addr, int reliable)
--
1.6.2.4
--
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/4] tracing: stop stack trace on first empty entry
2009-05-15 4:05 [PATCH 0/4] [GIT PULL] tracing: small updates for tip Steven Rostedt
2009-05-15 4:05 ` [PATCH 1/4] x86/stacktrace: return 0 instead of -1 for stack ops Steven Rostedt
@ 2009-05-15 4:05 ` Steven Rostedt
2009-05-15 4:05 ` [PATCH 3/4] tracing/filters: add missing unlock in a failure path Steven Rostedt
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-05-15 4:05 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker
[-- Attachment #1: 0002-tracing-stop-stack-trace-on-first-empty-entry.patch --]
[-- Type: text/plain, Size: 952 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The stack tracer stores eight entries in the ring buffer when an event
traces the stack. The output outputs all eight entries regardless of
how many entries were recorded.
This patch breaks out of the loop when a null entry is discovered.
[ Impact: only print the stack that is recorded ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_output.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 8bd9a2c..489c0e8 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -898,6 +898,8 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter,
trace_assign_type(field, iter->ent);
for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
+ if (!field->caller[i])
+ break;
if (i) {
if (!trace_seq_puts(s, " <= "))
goto partial;
--
1.6.2.4
--
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/4] tracing/filters: add missing unlock in a failure path
2009-05-15 4:05 [PATCH 0/4] [GIT PULL] tracing: small updates for tip Steven Rostedt
2009-05-15 4:05 ` [PATCH 1/4] x86/stacktrace: return 0 instead of -1 for stack ops Steven Rostedt
2009-05-15 4:05 ` [PATCH 2/4] tracing: stop stack trace on first empty entry Steven Rostedt
@ 2009-05-15 4:05 ` Steven Rostedt
2009-05-15 4:05 ` [PATCH 4/4] tracing/filters: fix off-by-one bug Steven Rostedt
2009-05-15 14:25 ` [PATCH 0/4] [GIT PULL] tracing: small updates for tip Ingo Molnar
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-05-15 4:05 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan
[-- Attachment #1: 0003-tracing-filters-add-missing-unlock-in-a-failure-pat.patch --]
[-- Type: text/plain, Size: 1503 bytes --]
From: Li Zefan <lizf@cn.fujitsu.com>
[ Impact: fix deadlock in a rare case we fail to allocate memory ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A0CDC6F.7070200@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events_filter.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 85ad6a8..22c2998 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1079,9 +1079,10 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
return 0;
}
+ err = -ENOMEM;
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
if (!ps)
- return -ENOMEM;
+ goto out_unlock;
filter_disable_preds(call);
replace_filter_string(call->filter, filter_string);
@@ -1101,7 +1102,7 @@ out:
filter_opstack_clear(ps);
postfix_clear(ps);
kfree(ps);
-
+out_unlock:
mutex_unlock(&filter_mutex);
return err;
@@ -1123,9 +1124,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
return 0;
}
+ err = -ENOMEM;
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
if (!ps)
- return -ENOMEM;
+ goto out_unlock;
filter_free_subsystem_preds(system);
replace_filter_string(system->filter, filter_string);
@@ -1145,7 +1147,7 @@ out:
filter_opstack_clear(ps);
postfix_clear(ps);
kfree(ps);
-
+out_unlock:
mutex_unlock(&filter_mutex);
return err;
--
1.6.2.4
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] tracing/filters: fix off-by-one bug
2009-05-15 4:05 [PATCH 0/4] [GIT PULL] tracing: small updates for tip Steven Rostedt
` (2 preceding siblings ...)
2009-05-15 4:05 ` [PATCH 3/4] tracing/filters: add missing unlock in a failure path Steven Rostedt
@ 2009-05-15 4:05 ` Steven Rostedt
2009-05-15 14:25 ` [PATCH 0/4] [GIT PULL] tracing: small updates for tip Ingo Molnar
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-05-15 4:05 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan
[-- Attachment #1: 0004-tracing-filters-fix-off-by-one-bug.patch --]
[-- Type: text/plain, Size: 957 bytes --]
From: Li Zefan <lizf@cn.fujitsu.com>
We should leave the last slot for the ending '\0'.
[ Impact: fix possible crash when the length of an operand is 128 ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A0CDC8C.30602@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events_filter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 22c2998..a7430b1 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -736,7 +736,7 @@ static inline void clear_operand_string(struct filter_parse_state *ps)
static inline int append_operand_char(struct filter_parse_state *ps, char c)
{
- if (ps->operand.tail == MAX_FILTER_STR_VAL)
+ if (ps->operand.tail == MAX_FILTER_STR_VAL - 1)
return -EINVAL;
ps->operand.string[ps->operand.tail++] = c;
--
1.6.2.4
--
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 0/4] [GIT PULL] tracing: small updates for tip
2009-05-15 4:05 [PATCH 0/4] [GIT PULL] tracing: small updates for tip Steven Rostedt
` (3 preceding siblings ...)
2009-05-15 4:05 ` [PATCH 4/4] tracing/filters: fix off-by-one bug Steven Rostedt
@ 2009-05-15 14:25 ` Ingo Molnar
4 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2009-05-15 14:25 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, Andrew Morton, Frederic Weisbecker
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Ingo,
>
> Please pull the latest tip/tracing/ftrace tree, which can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> tip/tracing/ftrace
>
>
> Li Zefan (2):
> tracing/filters: add missing unlock in a failure path
> tracing/filters: fix off-by-one bug
>
> Steven Rostedt (2):
> x86/stacktrace: return 0 instead of -1 for stack ops
> tracing: stop stack trace on first empty entry
>
> ----
> arch/x86/kernel/stacktrace.c | 2 +-
> kernel/trace/trace_events_filter.c | 12 +++++++-----
> kernel/trace/trace_output.c | 2 ++
> 3 files changed, 10 insertions(+), 6 deletions(-)
Pulled, thanks Steve!
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread