1
0
Fork 0
alistair23-linux/kernel/trace
Steven Rostedt (VMware) 78f7a45dac ring-buffer: Have ring_buffer_iter_empty() return true when empty
I noticed that reading the snapshot file when it is empty no longer gives a
status. It suppose to show the status of the snapshot buffer as well as how
to allocate and use it. For example:

 ># cat snapshot
 # tracer: nop
 #
 #
 # * Snapshot is allocated *
 #
 # Snapshot commands:
 # echo 0 > snapshot : Clears and frees snapshot buffer
 # echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.
 #                      Takes a snapshot of the main buffer.
 # echo 2 > snapshot : Clears snapshot buffer (but does not allocate or free)
 #                      (Doesn't have to be '2' works with any number that
 #                       is not a '0' or '1')

But instead it just showed an empty buffer:

 ># cat snapshot
 # tracer: nop
 #
 # entries-in-buffer/entries-written: 0/0   #P:4
 #
 #                              _-----=> irqs-off
 #                             / _----=> need-resched
 #                            | / _---=> hardirq/softirq
 #                            || / _--=> preempt-depth
 #                            ||| /     delay
 #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
 #              | |       |   ||||       |         |

What happened was that it was using the ring_buffer_iter_empty() function to
see if it was empty, and if it was, it showed the status. But that function
was returning false when it was empty. The reason was that the iter header
page was on the reader page, and the reader page was empty, but so was the
buffer itself. The check only tested to see if the iter was on the commit
page, but the commit page was no longer pointing to the reader page, but as
all pages were empty, the buffer is also.

Cc: stable@vger.kernel.org
Fixes: 651e22f270 ("ring-buffer: Always reset iterator to reader page")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-19 21:23:47 -04:00
..
Kconfig perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS 2017-03-01 10:26:39 +01:00
Makefile perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS 2017-03-01 10:26:39 +01:00
blktrace.c blktrace: use existing disk debugfs directory 2017-02-02 10:20:16 -07:00
bpf_trace.c bpf: mark all registered map/prog types as __ro_after_init 2017-02-17 13:40:04 -05:00
ftrace.c ftrace: Fix function pid filter on instances 2017-04-17 16:44:23 -04:00
power-traces.c cpufreq: schedutil: New governor based on scheduler utilization data 2016-04-02 01:09:12 +02:00
ring_buffer.c ring-buffer: Have ring_buffer_iter_empty() return true when empty 2017-04-19 21:23:47 -04:00
ring_buffer_benchmark.c sched/headers: Prepare for new header dependencies before moving code to <uapi/linux/sched/types.h> 2017-03-02 08:42:27 +01:00
rpm-traces.c PM / Runtime: Introduce trace points for tracing rpm_* functions 2011-09-27 22:53:27 +02:00
trace.c tracing: Allocate the snapshot buffer before enabling probe 2017-04-19 14:19:08 -04:00
trace.h ftrace: Fix function pid filter on instances 2017-04-17 16:44:23 -04:00
trace_benchmark.c tracing: Fix return value check in trace_benchmark_reg() 2017-02-15 09:02:27 -05:00
trace_benchmark.h tracing: Have the reg function allow to fail 2016-12-09 09:13:30 -05:00
trace_branch.c tracing: Add the constant count for branch tracer 2017-01-19 08:57:41 -05:00
trace_clock.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/clock.h> 2017-03-02 08:42:27 +01:00
trace_entries.h tracing: Add the constant count for branch tracer 2017-01-19 08:57:41 -05:00
trace_event_perf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-05-17 16:26:30 -07:00
trace_events.c tracing: Have system enable return error if one of the events fail 2016-12-09 09:15:41 -05:00
trace_events_filter.c tracing/filter: Define op as the enum that it is 2016-11-14 16:42:59 -05:00
trace_events_filter_test.h tracing/filter: Add startup tests for events filter 2011-08-19 14:35:59 -04:00
trace_events_hist.c sched/headers: Prepare to use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h> 2017-03-02 08:42:38 +01:00
trace_events_trigger.c sched/headers: Prepare to use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h> 2017-03-02 08:42:38 +01:00
trace_export.c tracing: ftrace_event_is_function() can return boolean 2015-11-02 14:28:05 -05:00
trace_functions.c ftrace: Have set_ftrace_pid use the bitmap like events do 2016-06-20 09:54:19 -04:00
trace_functions_graph.c tracing/fgraph: Have wakeup and irqsoff tracers ignore graph functions too 2016-12-09 09:21:35 -05:00
trace_hwlat.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/clock.h> 2017-03-02 08:42:27 +01:00
trace_irqsoff.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
trace_kdb.c tracing: Move trace_flags from global to a trace_array field 2015-09-30 15:22:55 -04:00
trace_kprobe.c sched/headers: Prepare to use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h> 2017-03-02 08:42:38 +01:00
trace_mmiotrace.c tracing: Expose CPU physical addresses (resource values) for PCI devices 2016-06-20 09:54:22 -04:00
trace_nop.c tracing: Fix typoes in code comment and printk in trace_nop.c 2016-03-08 11:23:57 -05:00
trace_output.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/mm.h> 2017-03-02 08:42:28 +01:00
trace_output.h tracing: Turn seq_print_user_ip() into a static function 2015-09-28 10:16:12 -04:00
trace_printk.c tracing: Handle NULL formats in hold_module_trace_bprintk_format() 2016-06-20 09:46:12 -04:00
trace_probe.c tracing/probes: Fix a warning message to show correct maximum length 2017-02-15 10:32:48 -05:00
trace_probe.h perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS 2017-03-01 10:26:39 +01:00
trace_sched_switch.c sched/core: Fix trace_sched_switch() 2015-10-06 17:08:15 +02:00
trace_sched_wakeup.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
trace_selftest.c sched/headers: Prepare for new header dependencies before moving code to <uapi/linux/sched/types.h> 2017-03-02 08:42:27 +01:00
trace_selftest_dynamic.c ftrace: Add self-tests for multiple function trace users 2011-05-18 19:24:51 -04:00
trace_seq.c tracing: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:37 -08:00
trace_stack.c scripts/spelling.txt: add "overide" pattern and fix typo instances 2017-03-09 17:01:09 -08:00
trace_stat.c kernel/...: convert pr_warning to pr_warn 2016-03-22 15:36:02 -07:00
trace_stat.h
trace_syscalls.c tracing/syscalls: fix multiline in error message text 2016-09-29 10:25:23 +02:00
trace_uprobe.c sched/headers: Prepare to use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h> 2017-03-02 08:42:38 +01:00
tracing_map.c tracing: Handle tracing_map_alloc_elts() error path correctly 2016-04-26 09:40:30 -04:00
tracing_map.h tracing: Update some tracing_map constants and comments 2016-04-19 12:16:06 -04:00