Skip to contentSkip to conversation

tracing: small updates for tip

GIT PULL New Steven Rostedt 2 participants 6 messages May 15, 2009

Subsystems (3)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/4 x86/stacktrace: return 0 instead of -1 for stack ops

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

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 ]

---
 arch/x86/kernel/stacktrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/stacktrace.c +1 -1
index f7bddc2..4aaf7e4 100644
@@ -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)
Signature · 3 lines
1.6.2.4

-- 
author maintainer
#4 lore raw

PATCH 4/4 tracing/filters: fix off-by-one bug

In reply to Steven Rostedt

From: Li Zefan <[email protected]>

We should leave the last slot for the ending '\0'.

[ Impact: fix possible crash when the length of an operand is 128 ]

LKML-Reference: <[email protected]>

---
 kernel/trace/trace_events_filter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace_events_filter.c +1 -1
index 22c2998..a7430b1 100644
@@ -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;
Signature · 3 lines
1.6.2.4

-- 

Steven Rostedt

author maintainer
#0 lore raw

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(-)
author maintainer
#3 lore raw

PATCH 3/4 tracing/filters: add missing unlock in a failure path

From: Li Zefan <[email protected]>

[ Impact: fix deadlock in a rare case we fail to allocate memory ]

LKML-Reference: <[email protected]>

---
 kernel/trace/trace_events_filter.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
kernel/trace/trace_events_filter.c +6 -4
index 85ad6a8..22c2998 100644
@@ -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;
Signature · 3 lines
1.6.2.4

-- 
author maintainer
#2 lore raw

PATCH 2/4 tracing: stop stack trace on first empty entry

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

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 ]

---
 kernel/trace/trace_output.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/trace/trace_output.c +2 -0
index 8bd9a2c..489c0e8 100644
@@ -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;
Signature · 3 lines
1.6.2.4

-- 
#5 lore raw
In reply to Steven Rostedt
Quoted 16 lines · Steven Rostedt

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

Quoted 5 lines

----

 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