Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/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

+25 -12
+1
kernel/panic.c
··· 301 301 */ 302 302 void oops_enter(void) 303 303 { 304 + tracing_off(); 304 305 /* can't trust the integrity of the kernel anymore: */ 305 306 debug_locks_off(); 306 307 do_oops_enter_exit();
+2 -2
kernel/trace/ftrace.c
··· 1662 1662 1663 1663 mutex_lock(&ftrace_regex_lock); 1664 1664 if ((file->f_mode & FMODE_WRITE) && 1665 - !(file->f_flags & O_APPEND)) 1665 + (file->f_flags & O_TRUNC)) 1666 1666 ftrace_filter_reset(enable); 1667 1667 1668 1668 if (file->f_mode & FMODE_READ) { ··· 2577 2577 2578 2578 mutex_lock(&graph_lock); 2579 2579 if ((file->f_mode & FMODE_WRITE) && 2580 - !(file->f_flags & O_APPEND)) { 2580 + (file->f_flags & O_TRUNC)) { 2581 2581 ftrace_graph_count = 0; 2582 2582 memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs)); 2583 2583 }
+8 -4
kernel/trace/trace.c
··· 2031 2031 2032 2032 /* If this file was open for write, then erase contents */ 2033 2033 if ((file->f_mode & FMODE_WRITE) && 2034 - !(file->f_flags & O_APPEND)) { 2034 + (file->f_flags & O_TRUNC)) { 2035 2035 long cpu = (long) inode->i_private; 2036 2036 2037 2037 if (cpu == TRACE_PIPE_ALL_CPU) ··· 3085 3085 break; 3086 3086 } 3087 3087 3088 - trace_consume(iter); 3088 + if (ret != TRACE_TYPE_NO_CONSUME) 3089 + trace_consume(iter); 3089 3090 rem -= count; 3090 3091 if (!find_next_entry_inc(iter)) { 3091 3092 rem = 0; ··· 4234 4233 iter.pos = -1; 4235 4234 4236 4235 if (find_next_entry_inc(&iter) != NULL) { 4237 - print_trace_line(&iter); 4238 - trace_consume(&iter); 4236 + int ret; 4237 + 4238 + ret = print_trace_line(&iter); 4239 + if (ret != TRACE_TYPE_NO_CONSUME) 4240 + trace_consume(&iter); 4239 4241 } 4240 4242 4241 4243 trace_printk_seq(&iter.seq);
+1 -1
kernel/trace/trace_events.c
··· 376 376 const struct seq_operations *seq_ops; 377 377 378 378 if ((file->f_mode & FMODE_WRITE) && 379 - !(file->f_flags & O_APPEND)) 379 + (file->f_flags & O_TRUNC)) 380 380 ftrace_clear_events(); 381 381 382 382 seq_ops = inode->i_private;
+9 -2
kernel/trace/trace_functions_graph.c
··· 843 843 844 844 switch (entry->type) { 845 845 case TRACE_GRAPH_ENT: { 846 - struct ftrace_graph_ent_entry *field; 846 + /* 847 + * print_graph_entry() may consume the current event, 848 + * thus @field may become invalid, so we need to save it. 849 + * sizeof(struct ftrace_graph_ent_entry) is very small, 850 + * it can be safely saved at the stack. 851 + */ 852 + struct ftrace_graph_ent_entry *field, saved; 847 853 trace_assign_type(field, entry); 848 - return print_graph_entry(field, s, iter); 854 + saved = *field; 855 + return print_graph_entry(&saved, s, iter); 849 856 } 850 857 case TRACE_GRAPH_RET: { 851 858 struct ftrace_graph_ret_entry *field;
+1 -1
kernel/trace/trace_printk.c
··· 176 176 const char *str = *fmt; 177 177 int i; 178 178 179 - seq_printf(m, "0x%lx : \"", (unsigned long)fmt); 179 + seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt); 180 180 181 181 /* 182 182 * Tabs and new lines need to be converted.
+3 -2
scripts/recordmcount.pl
··· 403 403 # section found, now is this a start of a function? 404 404 } elsif ($read_function && /$function_regex/) { 405 405 $text_found = 1; 406 - $offset = hex $1; 407 406 $text = $2; 408 407 409 408 # if this is either a local function or a weak function ··· 411 412 if (!defined($locals{$text}) && !defined($weak{$text})) { 412 413 $ref_func = $text; 413 414 $read_function = 0; 415 + $offset = hex $1; 414 416 } else { 415 417 # if we already have a function, and this is weak, skip it 416 - if (!defined($ref_func) || !defined($weak{$text})) { 418 + if (!defined($ref_func) && !defined($weak{$text})) { 417 419 $ref_func = $text; 420 + $offset = hex $1; 418 421 } 419 422 } 420 423 } elsif ($read_headers && /$mcount_section/) {