linux/kernel/trace
Xiao Yang 0bbe7f7199 tracing: Fix the race between registering 'snapshot' event trigger and triggering 'snapshot' operation
Traced event can trigger 'snapshot' operation(i.e. calls snapshot_trigger()
or snapshot_count_trigger()) when register_snapshot_trigger() has completed
registration but doesn't allocate buffer for 'snapshot' event trigger.  In
the rare case, 'snapshot' operation always detects the lack of allocated
buffer so make register_snapshot_trigger() allocate buffer first.

trigger-snapshot.tc in kselftest reproduces the issue on slow vm:
-----------------------------------------------------------
cat trace
...
ftracetest-3028  [002] ....   236.784290: sched_process_fork: comm=ftracetest pid=3028 child_comm=ftracetest child_pid=3036
     <...>-2875  [003] ....   240.460335: tracing_snapshot_instance_cond: *** SNAPSHOT NOT ALLOCATED ***
     <...>-2875  [003] ....   240.460338: tracing_snapshot_instance_cond: *** stopping trace here!   ***
-----------------------------------------------------------

Link: http://lkml.kernel.org/r/20200414015145.66236-1-yangx.jy@cn.fujitsu.com

Cc: stable@vger.kernel.org
Fixes: 93e31ffbf4 ("tracing: Add 'snapshot' event trigger command")
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2020-04-14 22:02:10 -04:00
..
Kconfig bootconfig: Fix CONFIG_BOOTTIME_TRACING dependency issue 2020-02-25 19:07:58 -05:00
Makefile tracing: Add kprobe event command generation test module 2020-01-30 09:46:28 -05:00
blktrace.c blktrace: fix dereference after null check 2020-03-05 13:42:40 -07:00
bpf_trace.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-03-30 19:52:37 -07:00
fgraph.c
ftrace.c New tracing features: 2020-04-05 10:36:18 -07:00
ftrace_internal.h
kprobe_event_gen_test.c tracing: Add kprobe event command generation test module 2020-01-30 09:46:28 -05:00
power-traces.c
preemptirq_delay_test.c
ring_buffer.c ring-buffer/tracing: Have iterator acknowledge dropped events 2020-03-27 16:39:01 -04:00
ring_buffer_benchmark.c
rpm-traces.c
synth_event_gen_test.c tracing: Have synthetic event test use raw_smp_processor_id() 2020-02-20 17:43:41 -05:00
trace.c tracing: Do not allocate buffer in trace_find_next_entry() in atomic 2020-04-03 11:30:50 -04:00
trace.h tracing: Create set_event_notrace_pid to not trace tasks 2020-03-27 16:39:02 -04:00
trace_benchmark.c
trace_benchmark.h
trace_boot.c tracing: Change trace_boot to use synth_event interface 2020-01-31 12:59:26 -05:00
trace_branch.c
trace_clock.c
trace_dynevent.c tracing: Use seq_buf for building dynevent_cmd string 2020-02-01 13:10:15 -05:00
trace_dynevent.h tracing: Remove check_arg() callbacks from dynevent args 2020-02-01 13:09:23 -05:00
trace_entries.h tracing: Have hwlat ts be first instance and record count of instances 2020-03-03 17:33:43 -05:00
trace_event_perf.c
trace_events.c tracing: Create set_event_notrace_pid to not trace tasks 2020-03-27 16:39:02 -04:00
trace_events_filter.c
trace_events_filter_test.h
trace_events_hist.c Tracing updates: 2020-02-26 10:34:42 -08:00
trace_events_inject.c
trace_events_trigger.c tracing: Fix the race between registering 'snapshot' event trigger and triggering 'snapshot' operation 2020-04-14 22:02:10 -04:00
trace_export.c
trace_functions.c
trace_functions_graph.c ring-buffer: Rename ring_buffer_read() to read_buffer_iter_advance() 2020-03-19 19:11:19 -04:00
trace_hwlat.c tracing: Have hwlat ts be first instance and record count of instances 2020-03-03 17:33:43 -05:00
trace_irqsoff.c
trace_kdb.c
trace_kprobe.c ftrace/kprobe: Show the maxactive number on kprobe_events 2020-03-27 16:39:02 -04:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Save off entry when peeking at next entry 2020-03-19 17:48:36 -04:00
trace_output.h
trace_preemptirq.c
trace_printk.c
trace_probe.c
trace_probe.h
trace_probe_tmpl.h
trace_sched_switch.c tracing: Fix sched switch start/stop refcount racy updates 2020-01-30 09:46:10 -05:00
trace_sched_wakeup.c
trace_selftest.c
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c
trace_stat.c
trace_stat.h
trace_syscalls.c Tracing updates: 2020-02-06 07:12:11 +00:00
trace_uprobe.c bpf: disable preemption for bpf progs attached to uprobe 2020-02-24 16:17:14 -08:00
tracing_map.c
tracing_map.h