Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'trace-v4.11-rc5-5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull two more ftrace fixes from Steven Rostedt:
"While continuing my development, I uncovered two more small bugs.

One is a race condition when enabling the snapshot function probe
trigger. It enables the probe before allocating the snapshot, and if
the probe triggers first, it stops tracing with a warning that the
snapshot buffer was not allocated.

The seconds is that the snapshot file should show how to use it when
it is empty. But a bug fix from long ago broke the "is empty" test and
the snapshot file no longer displays the help message"

* tag 'trace-v4.11-rc5-5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
ring-buffer: Have ring_buffer_iter_empty() return true when empty
tracing: Allocate the snapshot buffer before enabling probe

+19 -5
+14 -2
kernel/trace/ring_buffer.c
··· 3405 3405 int ring_buffer_iter_empty(struct ring_buffer_iter *iter) 3406 3406 { 3407 3407 struct ring_buffer_per_cpu *cpu_buffer; 3408 + struct buffer_page *reader; 3409 + struct buffer_page *head_page; 3410 + struct buffer_page *commit_page; 3411 + unsigned commit; 3408 3412 3409 3413 cpu_buffer = iter->cpu_buffer; 3410 3414 3411 - return iter->head_page == cpu_buffer->commit_page && 3412 - iter->head == rb_commit_index(cpu_buffer); 3415 + /* Remember, trace recording is off when iterator is in use */ 3416 + reader = cpu_buffer->reader_page; 3417 + head_page = cpu_buffer->head_page; 3418 + commit_page = cpu_buffer->commit_page; 3419 + commit = rb_page_commit(commit_page); 3420 + 3421 + return ((iter->head_page == commit_page && iter->head == commit) || 3422 + (iter->head_page == reader && commit_page == head_page && 3423 + head_page->read == commit && 3424 + iter->head == rb_page_commit(cpu_buffer->reader_page))); 3413 3425 } 3414 3426 EXPORT_SYMBOL_GPL(ring_buffer_iter_empty); 3415 3427
+5 -3
kernel/trace/trace.c
··· 6733 6733 return ret; 6734 6734 6735 6735 out_reg: 6736 + ret = alloc_snapshot(&global_trace); 6737 + if (ret < 0) 6738 + goto out; 6739 + 6736 6740 ret = register_ftrace_function_probe(glob, ops, count); 6737 6741 6738 - if (ret >= 0) 6739 - alloc_snapshot(&global_trace); 6740 - 6742 + out: 6741 6743 return ret < 0 ? ret : 0; 6742 6744 } 6743 6745