Skip to content

Commit

Permalink
Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/sc…
Browse files Browse the repository at this point in the history
…m/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  tracing: Fix missing function_graph events when we splice_read from trace_pipe
  tracing: Fix invalid function_graph entry
  trace: stop tracer in oops_enter()
  ftrace: Only update $offset when we update $ref_func
  ftrace: Fix the conditional that updates $ref_func
  tracing: only truncate ftrace files when O_TRUNC is set
  tracing: show proper address for trace-printk format
  • Loading branch information
torvalds committed Aug 4, 2009
2 parents b5a7c9a + e16852c commit 9c66812
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ int oops_may_print(void)
*/
void oops_enter(void)
{
tracing_off();
/* can't trust the integrity of the kernel anymore: */
debug_locks_off();
do_oops_enter_exit();
Expand Down
4 changes: 2 additions & 2 deletions kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)

mutex_lock(&ftrace_regex_lock);
if ((file->f_mode & FMODE_WRITE) &&
!(file->f_flags & O_APPEND))
(file->f_flags & O_TRUNC))
ftrace_filter_reset(enable);

if (file->f_mode & FMODE_READ) {
Expand Down Expand Up @@ -2577,7 +2577,7 @@ ftrace_graph_open(struct inode *inode, struct file *file)

mutex_lock(&graph_lock);
if ((file->f_mode & FMODE_WRITE) &&
!(file->f_flags & O_APPEND)) {
(file->f_flags & O_TRUNC)) {
ftrace_graph_count = 0;
memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs));
}
Expand Down
12 changes: 8 additions & 4 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ static int tracing_open(struct inode *inode, struct file *file)

/* If this file was open for write, then erase contents */
if ((file->f_mode & FMODE_WRITE) &&
!(file->f_flags & O_APPEND)) {
(file->f_flags & O_TRUNC)) {
long cpu = (long) inode->i_private;

if (cpu == TRACE_PIPE_ALL_CPU)
Expand Down Expand Up @@ -3085,7 +3085,8 @@ tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter)
break;
}

trace_consume(iter);
if (ret != TRACE_TYPE_NO_CONSUME)
trace_consume(iter);
rem -= count;
if (!find_next_entry_inc(iter)) {
rem = 0;
Expand Down Expand Up @@ -4233,8 +4234,11 @@ static void __ftrace_dump(bool disable_tracing)
iter.pos = -1;

if (find_next_entry_inc(&iter) != NULL) {
print_trace_line(&iter);
trace_consume(&iter);
int ret;

ret = print_trace_line(&iter);
if (ret != TRACE_TYPE_NO_CONSUME)
trace_consume(&iter);
}

trace_printk_seq(&iter.seq);
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ ftrace_event_seq_open(struct inode *inode, struct file *file)
const struct seq_operations *seq_ops;

if ((file->f_mode & FMODE_WRITE) &&
!(file->f_flags & O_APPEND))
(file->f_flags & O_TRUNC))
ftrace_clear_events();

seq_ops = inode->i_private;
Expand Down
11 changes: 9 additions & 2 deletions kernel/trace/trace_functions_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,16 @@ print_graph_function(struct trace_iterator *iter)

switch (entry->type) {
case TRACE_GRAPH_ENT: {
struct ftrace_graph_ent_entry *field;
/*
* print_graph_entry() may consume the current event,
* thus @field may become invalid, so we need to save it.
* sizeof(struct ftrace_graph_ent_entry) is very small,
* it can be safely saved at the stack.
*/
struct ftrace_graph_ent_entry *field, saved;
trace_assign_type(field, entry);
return print_graph_entry(field, s, iter);
saved = *field;
return print_graph_entry(&saved, s, iter);
}
case TRACE_GRAPH_RET: {
struct ftrace_graph_ret_entry *field;
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int t_show(struct seq_file *m, void *v)
const char *str = *fmt;
int i;

seq_printf(m, "0x%lx : \"", (unsigned long)fmt);
seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt);

/*
* Tabs and new lines need to be converted.
Expand Down
5 changes: 3 additions & 2 deletions scripts/recordmcount.pl
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ sub update_funcs
# section found, now is this a start of a function?
} elsif ($read_function && /$function_regex/) {
$text_found = 1;
$offset = hex $1;
$text = $2;

# if this is either a local function or a weak function
Expand All @@ -412,10 +411,12 @@ sub update_funcs
if (!defined($locals{$text}) && !defined($weak{$text})) {
$ref_func = $text;
$read_function = 0;
$offset = hex $1;
} else {
# if we already have a function, and this is weak, skip it
if (!defined($ref_func) || !defined($weak{$text})) {
if (!defined($ref_func) && !defined($weak{$text})) {
$ref_func = $text;
$offset = hex $1;
}
}
} elsif ($read_headers && /$mcount_section/) {
Expand Down

0 comments on commit 9c66812

Please sign in to comment.