History

Merge tag 'trace-fixes-v3.16-rc5-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt: "A few more fixes for ftrace infrastructure. I was cleaning out my INBOX and found two fixes from zhangwei from a year ago that were lost in my mail. These fix an inconsistency between trace_puts() and the way trace_printk() works. The reason this is important to fix is because when trace_printk() doesn't have any arguments, it turns into a trace_puts(). Not being able to enable a stack trace against trace_printk() because it does not have any arguments is quite confusing. Also, the fix is rather trivial and low risk. While porting some changes to PowerPC I discovered that it still has the function graph tracer filter bug that if you also enable stack tracing the function graph tracer filter is ignored. I fixed that up. Finally, Martin Lau, fixed a bug that would cause readers of the ftrace ring buffer to block forever even though it was suppose to be NONBLOCK" This also includes the fix from an earlier pull request: "Oleg Nesterov fixed a memory leak that happens if a user creates a tracing instance, sets up a filter in an event, and then removes that instance. The filter allocates memory that is never freed when the instance is destroyed" * tag 'trace-fixes-v3.16-rc5-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: ring-buffer: Fix polling on trace_pipe tracing: Add TRACE_ITER_PRINTK flag check in __trace_puts/__trace_bputs tracing: Fix graph tracer with stack tracer on other archs tracing: Add ftrace_trace_stack into __trace_puts/__trace_bputs tracing: instance_rmdir() leaks ftrace_event_file->filter

Linus Torvalds committed 12 years ago

Commit 22d36852 parents b6603fe 97b8ee84 files · +19 −8Browse files

Showing the changes to kernel (4 of 4 files). Show all

Unified · Split

4 files
  1. kernel/trace/ftrace.c +2 −2
  2. kernel/trace/ring_buffer.c +0 −4
  3. kernel/trace/trace.c +16 −2
  4. kernel/trace/trace_events.c +1 −0
kernel/trace/ftrace.c+2−2
@@ -265,12 +265,12 @@ static void update_ftrace_function(void) · 264 unmodified lines
265265 func = ftrace_ops_list_func;
266266 }
267267
268+ update_function_graph_func();
269+
268270 /* If there's no change, then do nothing more here */
269271 if (ftrace_trace_function == func)
270272 return;
271273
272− update_function_graph_func();
273−
274274 /*
275275 * If we are using the list function, it doesn't care
276276 * about the function_trace_ops.
kernel/trace/ring_buffer.c+0−4
@@ -616,10 +616,6 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, · 615 unmodified lines
616616 struct ring_buffer_per_cpu *cpu_buffer;
617617 struct rb_irq_work *work;
618618
619− if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) ||
620− (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu)))
621− return POLLIN | POLLRDNORM;
622−
623619 if (cpu == RING_BUFFER_ALL_CPUS)
624620 work = &buffer->irq_work;
625621 else {
kernel/trace/trace.c+16−2
@@ -466,6 +466,12 @@ int __trace_puts(unsigned long ip, const char *str, int size) · 465 unmodified lines
466466 struct print_entry *entry;
467467 unsigned long irq_flags;
468468 int alloc;
469+ int pc;
470+
471+ if (!(trace_flags & TRACE_ITER_PRINTK))
472+ return 0;
473+
474+ pc = preempt_count();
469475
470476 if (unlikely(tracing_selftest_running || tracing_disabled))
471477 return 0;
@@ -475,7 +481,7 @@ int __trace_puts(unsigned long ip, const char *str, int size) · 3 unmodified lines
475481 local_save_flags(irq_flags);
476482 buffer = global_trace.trace_buffer.buffer;
477483 event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc,
478− irq_flags, preempt_count());
484+ irq_flags, pc);
479485 if (!event)
480486 return 0;
481487
@@ -492,6 +498,7 @@ int __trace_puts(unsigned long ip, const char *str, int size) · 10 unmodified lines
492498 entry->buf[size] = '\0';
493499
494500 __buffer_unlock_commit(buffer, event);
501+ ftrace_trace_stack(buffer, irq_flags, 4, pc);
495502
496503 return size;
497504 }
@@ -509,6 +516,12 @@ int __trace_bputs(unsigned long ip, const char *str) · 11 unmodified lines
509516 struct bputs_entry *entry;
510517 unsigned long irq_flags;
511518 int size = sizeof(struct bputs_entry);
519+ int pc;
520+
521+ if (!(trace_flags & TRACE_ITER_PRINTK))
522+ return 0;
523+
524+ pc = preempt_count();
512525
513526 if (unlikely(tracing_selftest_running || tracing_disabled))
514527 return 0;
@@ -516,7 +529,7 @@ int __trace_bputs(unsigned long ip, const char *str) · 1 unmodified line
516529 local_save_flags(irq_flags);
517530 buffer = global_trace.trace_buffer.buffer;
518531 event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
519− irq_flags, preempt_count());
532+ irq_flags, pc);
520533 if (!event)
521534 return 0;
522535
@@ -525,6 +538,7 @@ int __trace_bputs(unsigned long ip, const char *str) · 2 unmodified lines
525538 entry->str = str;
526539
527540 __buffer_unlock_commit(buffer, event);
541+ ftrace_trace_stack(buffer, irq_flags, 4, pc);
528542
529543 return 1;
530544 }
kernel/trace/trace_events.c+1−0
@@ -470,6 +470,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file) · 469 unmodified lines
470470
471471 list_del(&file->list);
472472 remove_subsystem(file->system);
473+ free_event_filter(file->filter);
473474 kmem_cache_free(file_cachep, file);
474475 }
475476